lines-around-comment ES2015 classes in new allowClassStart option
See original GitHub issueTell us about your environment
- ESLint Version: v4.0.0-alpha.2
- Node Version: v7.10.0
- npm Version: 4.5.0
What parser (default, Babel-ESLint, etc.) are you using? default
Please show your full configuration:
--env es6 --rule lines-around-comment:["error",{allowObjectStart:true}]
What did you do? Please include the actual source code causing the issue.
class A {
/* test */
constructor() {}
}
What did you expect to happen? No errors.
What actually happened? Please include the actual, raw output from ESLint. 2:3 error Expected line before comment lines-around-comment
For #2894 @gyandeeps added ES2015 classes to “allowBlockStart” via 9a2dcc2 disallowing an empty line before a comment block just within a class, but it seems like it would be more appropriate as part of its own “allowClassStart”.
This proposed change would better match the breaking change in #7879 by @alberto in e232464 where classes are treated differently than block statements. In particular, if someone had --rule padded-blocks:["error","never"]
in addition to the above --rule lines-around-comment:["error",{allowObjectStart:true}]
, neither rule would be happy with a line or without a line, but if the code was using let A = {
instead of a class
, it would be fine.
I would think that moving class from allowBlockStart
would also be a breaking change.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:4
- Comments:15 (15 by maintainers)
@Mardak @not-an-aardvark @ilyavolodin @ljharb Apologies, seems we’ve lost track of this.
Can anyone please summarize where we’re at and what our next steps should be? Thanks!
👍