eslint-stylistic / eslint-stylistic

Monorepo for ESLint Stylistic plugins and configs
https://eslint.style
MIT License
1.37k stars 93 forks source link

`padding-line-between-statements`: differentiating `fallthrough case` from `case` #442

Open Ericlm opened 3 months ago

Ericlm commented 3 months ago

Clear and concise description of the problem

I would like that the rule includes a new type of STATEMENT_TYPE to allow a different padding between case statements that are not fallthrough vs the ones that are.

Using the suggestion from the doc [{ blankLine: "always", prev: ["case", "default"], next: "*" }] makes fallthrough cases have a blank lines while it's not always desirable and conflicts with no-fallthrough. (although it does have an option to allow empty case)

Suggested solution

Suggestions :

Alternative

I looked for a way to disable the error from eslint, and it was possible with the { "allowEmptyCase": true } option.

Additional context

Personally, I prefer fallthrough statements to be just above other case statements so it's very clear that it does not have an implementation by its own.

Validations

Contributes

Ericlm commented 2 months ago

I think it could look like: