8000 `html-indent`: extra warning on line with comment · Issue #330 · vuejs/eslint-plugin-vue · GitHub
[go: up one dir, main page]

Skip to content

html-indent: extra warning on line with comment #330

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

Closed
usernamehw opened this issue Jan 6, 2018 · 2 comments · Fixed by #333
Closed

html-indent: extra warning on line with comment #330

usernamehw opened this issue Jan 6, 2018 · 2 comments · Fixed by #333
Labels

Comments

@usernamehw
Copy link
usernamehw commented Jan 6, 2018
  • ESLint Version: 4.14.0
  • eslint-plugin-vue Version: 4.1.0
  • babel-eslint 8.1.2
  • Node Version: 8.9.3
// this is not full configuration
"parserOptions": {
    "parser": "babel-eslint",
},
"rules": {
    "vue/html-indent": [1, 4, {
        "attribute": 1,
        "closeBracket": 0
    }],
}

What did you do? Please include the actual source code causing the issue.

<!-- this code is perfectly valid -->
<template>
    <div>
        <div></div>
    </div>
</template>

<!-- [eslint] Expected indentation of 4 spaces 
but found 8 spaces. (vue/html-indent) -->
<template>
    <div>
        <!-- <div></div> -->
    </div>
</template>



What did you expect to happen?
For it to treat comment beginning the same way as it does for tag.

@michalsnik
Copy link
Member

Hey @usernamehw Thanks for posting this issue. There was a recent change in indentation of comments, perhaps this is related to that change. With comments sometimes you want to add information about closing tag, and the other time as you showed you want to treat it like an element. We want to support both cases.

We'll look into this :)

@michalsnik michalsnik added the bug label Jan 6, 2018
@usernamehw
Copy link
Author
usernamehw commented Jan 7, 2018

Actually, there is no need to consider comments at all. I just don't want to see a bunch of warnings.

They could be at 0 column or at any other. html-indent rule should simply ignore lines: /^\s*<!--/ .

@usernamehw usernamehw changed the title html-indent rule ignores comments html-indent: extra warning on line with comment Jan 7, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants
0