tools
tools copied to clipboard
chore(rome_js_analyze): `noSwitchDeclarations`
Summary
This implements ESLint's no-case-declarations under the name noSwitchDeclarations.
In contrast to ESLint, this rule handles TypeScript declarations (enum, ...).
Test Plan
Uni test and doc-tests included.
Deploy Preview for docs-rometools canceled.
Built without sensitive environment variables
| Name | Link |
|---|---|
| Latest commit | 2c49a0a5e858196875a8df44d8799cac15be16ba |
| Latest deploy log | https://app.netlify.com/sites/docs-rometools/deploys/63ea9e24bcfa930008c18c8f |
@MichaReiser
This rule has overlaps with the UseSingleCaseStatement. What's your recommendation on how these rules should (or should not) co-exist?
I could suggest removing useSingleCaseStatement of the recommended rule set, moving the rule to style. The rule has already some negative user feedbacks.
I could also propose to eventually make useSingleCaseStatement obsolete, and adding an option (disabled by default) to useBlock for requiring a block for every non-empty case/default clause.
I could also propose to eventually make useSingleCaseStatement obsolete
We could deprecate useSingleCaseStatement in this release cycle and suggest this new rule. This won't create breaking changes.
I could also propose to eventually make useSingleCaseStatement obsolete
We could deprecate
useSingleCaseStatementin this release cycle and suggest this new rule. This won't create breaking changes.
The useSingleCaseStatement rule has already been moved to the style group and removed from the recommended set in 11.0.0. I don't think we should go as far as deprecating it since its use case (enforce that case clause are wrapped in a block) is somewhat different from what noSwitchDeclaration is enforcing (disallow declarations in case clause), and some users may want to keep both rules enabled.