Rule option proposal: multi-case for padding-line-between-statements
See original GitHub issueThe version of ESLint you are using. 5.10.0
The problem you want to solve.
Currently, the rule padding-line-between-statements
can’t tell the difference between case
and multi-case
(stacked empty case statements that fall through to the next case block).
For example, if you take the following snippet through ESLint:
switch ( current_argv ) {
case "-v":
case "--version":
console.log( 5 );
break;
}
No matter what configuration I use, I can’t seem to get padding-line-between-statements
to require a newline before and after case blocks, but never between case statements in a multi-case block (above).
Your take on the correct solution to problem.
A new STATEMENT_TYPE
called multi-case
to account for this:
{
"rules": {
"padding-line-between-statements": [ "error",
{ "blankLine": "always", "prev": "*", "next": "multi-case" },
{ "blankLine": "never", "prev": "multi-case", "next": "case" },
],
}
}
Are you willing to submit a pull request to implement this change?
Haven’t hacked on ESLint before, but over the coming weekend, I’ll check to see if I can do this. If I can, and no ones implemented it by then, I’ll give it a go 😄
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:6 (2 by maintainers)
@futagoza I would have loved that as well, but our process for accepting rule change proposals requires 1 team member to champion the proposal and 3 other team members to 👍 it, and none of that had happened before my previous comment.
I’ll try to work with the team to get this in before the next release.
Hi @futagoza, looks like this slipped through the cracks. Sorry about that!
I’ll support this proposal.