Prettier Pug Plugin: Not formatting as expected.
See original GitHub issueInfo
- I have searched through existing issues
- I have read through docs
- I have read FAQ
- Platform: macOS
- Vetur version: 0.28.0 Problem Problem
Problem
Pug templates don’t use @prettier/plugin-pug
specific settings. According the developer over on @prettier/plugin-pug
I think this is because the package needs to be updated in Vetur’s package.json
.
Original Issue I opened on @prettier/plugin-pug
Issue: https://github.com/prettier/plugin-pug/issues/124 Related Issue: https://github.com/vuejs/vetur/issues/527
Temporary Solution
I had to downgrade Vetur’s version to 0.27.3
, and then any @prettier/plugin-pug settings work. I will open a request on the Vetur repo and see about getting them to update to the current version.
Input
<template lang="pug">
button.hello( class="world" disabled @click="handleClick" )
</template>
Expected Output
<template lang="pug">
button.hello.world( disabled @click="handleClick" )
</template>
Actual Output
<template lang="pug">
button.hello.world( disabled, @click="handleClick" )
</template>
Additional Context
My project has a .prettierrc
file with the options
{
"semi": false,
"arrowParens": "always",
"printWidth": 600,
"pugAttributeSeparator": "none"
}
Issue Analytics
- State:
- Created 3 years ago
- Comments:10 (2 by maintainers)
Top Results From Across the Web
@prettier/plugin-pug - npm
Installing @prettier/plugin-pug either locally or globally may require you to restart the editor if formatting does not work right away.
Read more >Plugins - Prettier
Plugins are ways of adding new languages or formatting rules to Prettier. ... When plugins cannot be found automatically, you can load them...
Read more >@prettier/plugin-pug | Yarn - Package Manager
Installing @prettier/plugin-pug either locally or globally may require you to restart the editor if formatting does not work right away. Implementation details.
Read more >Prettier 2.1: new --embedded-language-formatting option and ...
Prettier 2.1 [error] test.ts: SyntaxError: Did not expect a type annotation here. ... @prettier/plugin-pug is required for this example.
Read more >Efficient Code Analyzing and Formatting (for Vue.js) with ...
As we see later, there exists an official ESLint Plugin for Vue.js ... Its only purpose is to reformat source code; but Prettier...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@octref A bunch of new features made it into 1.8.0 🎉
Would be really nice if you upgrade and release 😃
@octref funny to cross paths again! I started working on
plugin-pug
recently (after taking note of its existence throughVetur
), you can see me pop up in the commits here and there 😉