prettier / prettier/plugin-pug

Bug: Unable to pass inlined object literal to custom vue directive

Open
#419 16 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

framework: Vue type: bug
Dominant language
TypeScript
Stars
208
Forks
49
Avg merge
4h 26m
Merged PRs (30d)
8

Description

Plugin Version

v2.3.0

Prettier Version

v2.7.1

Which frameworks are affected?
  • none
  • vue
  • angular
  • svelte
Node Version

v18.12.0

Which operating systems have you used?
  • Linux
  • macOS
  • Windows
Prettier config
{
  "printWidth": 80,
  "semi": false,
  "singleQuote": true,
  "quoteProps": "consistent",
  "arrowParens": "avoid",
  "trailingComma": "none",
  "pugSingleQuote": false,
  "pugAttributeSeparator": "none",
  "pugCommentPreserveSpaces": "trim-all",
  "pugWrapAttributesThreshold": 1,
  "pugWrapAttributesPattern": "^(@|v-)"
}
Input
.topic(
  v-for="topic in topics"
  v-delayed-unhide="{ disabled: !!selectedTopic }"
)
Output or Error
The following expression could not be formatted correctly. Please try to fix it yourself and if there is a problem, please open a bug issue: disabled: !!selectedTopic
Expected Output
The plugin should be able to handle the correct JS input in the custom directive's value and should not complain about it.
Additional Context

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue using the supplied Pug input, Prettier configuration, plugin version v2.3.0, and Node v18.12.0, then trace the custom directive value handling. Done means the inline object literal in v-delayed-unhide is accepted and formatted without the reported expression error.

Written by the indexing model from the issue text.

Assessment

Tech stack
pug, typescript
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.