eslint: `eslint-` comments cause `lines-around-comment` rule to error
-
The version of ESLint you are using
1.8.0
-
What you did (the source code and ESLint configuration)
/* eslint-disable no-underscore-dangle */ this._values = values; this._values2 = true; /* eslint-enable no-underscore-dangle */
with the following configuration:
"lines-around-comment": [2, { "allowArrayStart": true, "allowBlockStart": true, "allowObjectStart": true, "beforeBlockComment": true, "beforeLineComment": true }],
-
The actual ESLint output complete with numbers
error Expected line before comment lines-around-comment
-
What you expected to happen instead
No error. I don’t think
lines-around-comment
should be enforced foreslint-enable
/eslint-disable
type comments. This follows with the fact thatno-inline-comments
ignoreseslint-disable-line
comments even when it’s enabled.
<bountysource-plugin>
Want to back this issue? Post a bounty on it! We accept bounties via Bountysource. </bountysource-plugin>
About this issue
- Original URL
- State: closed
- Created 9 years ago
- Reactions: 2
- Comments: 37 (33 by maintainers)
Commits related to this issue
- Update: ignore eslint comments in lines-arount-comment (fixes #4345) — committed to eslint/eslint by alberto 7 years ago
- Update: ignore eslint comments in lines-around-comment (fixes #4345) — committed to eslint/eslint by alberto 7 years ago
- Update: ignore eslint comments in lines-around-comment (fixes #4345) — committed to eslint/eslint by alberto 7 years ago
I’m working on this
Per TSC meeting, we decided that globally excluding comments has too many problems and we shouldn’t proceed down that path. We do think it’s useful to be able to exclude configuration comments from
lines-around-comments
, and have decided on adding anignorePattern
option to the rule that behaves the same as in https://github.com/eslint/eslint/issues/6077.I feel like we just keep going round and round on this, so maybe the best solution is just not to make any changes. What we had now may be a bit weird, but it seems like any potential change to that behavior has some other weird side effect or implication.
I think
ignorePattern
should be made into helper method, so it can be reused across multiple rules, if necessary.