@prettier/plugin-pug support
See original GitHub issueHello,
Thank you for svelte. My current workflow is vue, and I have been happily using prettier-eslint
with vscode to format all my pug templates. I decided to explore svelte last night but had some issues with the environment config.
I used preprocess
to enable pug compiling and that was smooth, but for some reason I’m not able to get prettier to format pug
templates. I tried a few things including invoking prettier from the cli and it also wouldn’t format the pug
template. If you could shed some light I will surely appreciate it.
Is what I’m trying to do is supported?
<template lang="pug">
main
h1.something(
x="a",
b="a" )
| Hello {name}
</template>
"[svelte]": {
"editor.formatOnSave": true,
"editor.formatOnType": false,
"editor.formatOnPaste": false,
"editor.highlightActiveIndentGuide": false,
"editor.renderIndentGuides": false,
"editor.defaultFormatter": "svelte.svelte-vscode"
},
module.exports = {
trailingComma: "es5",
tabWidth: 4,
semi: true,
printWidth: 100,
singleQuote: true,
overrides: [
{
files: "*.svelte",
options: {
// "svelteSortOrder" : "scripts-markup-options-styles",
// "svelteStrictMode": true,
svelteBracketNewLine: false,
// "svelteAllowShorthand": false,
svelteIndentScriptAndStyle: false,
tabWidth: 8,
pugTabWidth: 8,
pugPrintWidth: 90,
pugSingleFileComponentIndentation: false,
pugWrapAttributesThreshold: 3,
pugClassNotation: "as-is",
pugWrapAttributesPattern: "^v-(if|else|for)",
pugSortAttributes: "asc",
pugClosingBracketPosition: "last-line",
},
},
],
};
// svelte options above are functional and they work. But not the pug options.
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (2 by maintainers)
Top Results From Across the Web
prettier/plugin-pug - GitHub
This plugin adds support for the Pug language to Prettier. Getting started; Usage; Configuration; Workarounds / Known Issues; Integration with editors ...
Read more >@prettier/plugin-pug - npm
Prettier Pug Plugin. Latest version: 2.3.0, last published: a month ago. Start using @prettier/plugin-pug in your project by running `npm i ...
Read more >Prettier Plugin Pug | Format your pug code with Prettier
This plugin adds support for the Pug language to Prettier. Released under the MIT License. Copyright © 2019-2022 Christopher Quadflieg.
Read more >@prettier/plugin-pug | Yarn - Package Manager
Fast, reliable, and secure dependency management.
Read more >Plugins - Prettier
Plugins are ways of adding new languages or formatting rules to Prettier. Prettier's own implementations of all languages are expressed using the plugin...
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
If you install
prettier
and the latest version ofprettier-plugin-svelte
and@prettier/plugin-pug
, Pug will be formatted within<template lang="pug">
tags now.Hello, https://github.com/sveltejs/prettier-plugin-svelte/issues/57 seems to be different than what I encountered. In that issue, the author is trying to use
prettier
withineslint
as a plugin. I tried to useprettier-eslint
module, which executesprettier
first andeslint
second. So conflicting rules shouldn’t really matter,eslint
should just override any changes made by prettier.I will debug
prettier-eslint
over the weekend and update here with my findings.