-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
padded-blocks fails on comment #2788
Comments
Can you share your eslint configuration? Do you use the default parser? |
Default parser it is. {
"rules": {
"padded-blocks": [2, "never"]
}
} |
You disabled the rule in your configuration. So it should never warn. However, I've tried your example in the online demo and can’t reproduce the problem: /* eslint padded-blocks: [2, "never"] */
if (a) {
// we really need to test it
if (b) {
c();
}
d();
} Which version of ESLint do you use? |
ESLint version: 0.22.1 |
same on 0.23.0 |
Please try this /* eslint padded-blocks: [2, "never"] */
var xxx = function () {
// foo
if (
// bar
a ||
// baz
b
) {
return;
}
}; |
Now I can reproduce it. Here is more minimal example: /* eslint padded-blocks: [2, "never"] */
{
// comment
if (// comment
a) {}
} This is a problem with the comment attachment algorithm of espree. Both comments are getting attached to the |
Can you file an espree bug? |
Just stumbled upon this too. Same issue with trailing comments. function foo() {
console.log("Hi")
// Long text.
// Long text.
// Long text.
} |
For reference eslint/espree#155 |
Great to have that fixed! Waiting for next stable release ;) |
Hi. When I have a code:
The rule warns me:
Block must not be padded by blank lines padded-blocks
.It should not since comment is not blank line.
When I remove a comment then rule passes.
The text was updated successfully, but these errors were encountered: