Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Indentation broken when "vue/max-attributes-per-line" reformats line #8

Open
sid-6581 opened this issue May 20, 2022 · 10 comments
Open
Labels
enhancement New feature or request

Comments

@sid-6581
Copy link

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.

@rashfael
Copy link
Owner

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.

@rashfael rashfael added the enhancement New feature or request label May 20, 2022
@sid-6581
Copy link
Author

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.

@bjufre
Copy link

bjufre commented Sep 6, 2022

@sid-6581 @rashfael any news on this? We're currently trying to integrate with this plugin and we're having the exact same issue 🙏

@rashfael
Copy link
Owner

rashfael commented Sep 7, 2022

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.

@Cl0ser01
Copy link

@rashfael any news on this? is this issue still in work or abandoned?

@rashfael
Copy link
Owner

I haven't done any work on this issue, but the plugin is not abandoned. I'm still using it and pug myself.

@Tipwheal
Copy link

Tipwheal commented Feb 6, 2024

Same issue and finnally used vim visual selection and regex to fix indent manually😂

@SkyaTura
Copy link

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"]

@icebob
Copy link

icebob commented Aug 5, 2024

@rashfael Any news about fixing this issue?

@Nathan7139
Copy link

Is there any update regarding this? I'm particularly interested in enabling vue/html-indent rule for Pug templates.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

8 participants