Proposed Rule: Enforce lines between class methods
See original GitHub issueI would like to propose a rule that enforces empty lines between class functions. When enabled and set to “always” it should make sure that there is at least one empty line between every method in a class declaration. If set to “never” the opposite would be true, that is, there should not be any empty lines at all between class methods.
A line with a comment on should not count as an empty line.
This rule should not concern itself with the class padding (empty lines before the first method and after the last method) since that is already taken care of by padded-blocks
.
It also shouldn’t concern itself with how many empty lines that are present, since that is a job for no-multiple-empty-lines
.
This is a stylistic rule.
The following patterns would be considered problems:
class Test1 {
constructor () {
// ...
}
otherFunc () {
// ...
}
}
class Test2 {
constructor () {
// ...
}
// comment
otherFunc () {
// ...
}
}
The following pattern would be considered valid:
class Test3 {
constructor () {
// ...
}
otherFunc () {
// ...
}
}
class Test4 {
constructor () {
// ...
}
otherFunc () {
// ...
}
}
class Test5 {
constructor () {
// ...
}
// comment
otherFunc () {
// ...
}
}
class Test6 {
constructor () {
// ...
}
// Comment
otherFunc () {
// ...
}
}
Issue Analytics
- State:
- Created 7 years ago
- Reactions:34
- Comments:59 (40 by maintainers)
Top GitHub Comments
What is the status of this issue?
I’m happy to help contribute to this to push it over the finish line. I wrote the JSCS rule this is discussing and this is one of the last rules left in my company’s conversion from JSCS to eslint.
I‘ll work on this, perhaps this weekend.😦