Switch-case-specific linting rules for ESLint.
Install ESLint either locally or globally.
$ npm install eslint
If you installed ESLint
globally, you have to install the plugin globally too. Otherwise, install it locally.
$ npm install eslint-plugin-switch-case
Add a plugins
section and specify eslint-plugin-switch-case as a plugin.
Then, enable all of the rules that you would like to use.
This plugin exports a recommended
configuration that enforces all the rules. You can configure the plugin as follows:
{
"plugins": ["switch-case"],
"extends": ["plugin:switch-case/recommended"]
}
Rules are divided into categories for your convenience. All rules are off by default, unless you use one of the plugin's configurations which turn all relevant rules on.
These rules are purely matters of style and are quite subjective.
- no-case-curly: Forbid curly brackets around case statements.
- newline-between-switch-case: Configure newlines around switch cases.
Contributions are always welcome!.
eslint-plugin-switch-case is licensed under the MIT License.