eslint-plugin-vue-pug
eslint-plugin-vue-pug copied to clipboard
Indentation broken when "vue/max-attributes-per-line" reformats line
When vue/max-attributes-per-line reformats the line, the attributes end up completely unindented:
a(href="link" @click="click")
becomes:
a(
href="link"
@click="click")
when ideally it should be:
a(
href="link"
@click="click"
)
I'm not sure if this plugin alone is enough to lint things like indentation for the pug templates in SFCs? I know I can use prettier/plugin-pug with prettier, but I would prefer to avoid prettier altogether and rely on just eslint.
I am planning to add some pug-specific rules to this plugin, for example for attribute delimiters. I need to look into indentation too.
I think in eslint-plugin-vue this rule just adds a newline and then another rule fixes indentation (even in html just a newline would look weird). Since the pug parser seems to understand the unindented version I will probably create a rule that lints pug attribute indents. In eslint-plugin-vue this is handled by vue/html-indent I think, which is currently disabled for eslint-plugin-vue-pug because it has some issues with pug templates.
That would be fantastic. Handling the indentation, and also the closing parenthesis on a new line, would be a great improvement. I'd be happy to contribute if needed, feel free to ping me if so.
@sid-6581 @rashfael any news on this? We're currently trying to integrate with this plugin and we're having the exact same issue 🙏
I've been quite busy with some other projects these last few months, but adding pug indent rules is definitely on my list of things to do. I can't tell you when, though, sorry.
@rashfael any news on this? is this issue still in work or abandoned?
I haven't done any work on this issue, but the plugin is not abandoned. I'm still using it and pug myself.
Same issue and finnally used vim visual selection and regex to fix indent manually😂
I'm disabling these rules alongside with prettier-plugin-pug to enforcing them
"vue/first-attribute-linebreak": ["off"]
"vue/html-closing-bracket-newline": ["off"]
"vue/html-closing-bracket-spacing": ["off"]
"vue/max-attributes-per-line": ["off"]
"vue/multiline-html-element-content-newline": ["off"]
"vue/mustache-interpolation-spacing": ["off"]
"vue/no-multi-spaces": ["off"]
"vue/no-spaces-around-equal-signs-in-attribute": ["off"]
"vue/singleline-html-element-content-newline": ["off"]
"vue/attributes-order": ["off"]
"vue/component-tags-order": ["off"]
"vue/order-in-components": ["off"]
"vue/html-comment-content-newline": ["off"]
"vue/html-comment-content-spacing": ["off"]
"vue/html-comment-indent": ["off"]
"vue/new-line-between-multi-line-property": ["off"]
"vue/padding-line-between-tags": ["off"]
"vue/padding-line-between-blocks": ["off"]
@rashfael Any news about fixing this issue?