ESLint rules that have been developed at Saxo to enforce a range of project specific and general standards.
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-saxo
Add a plugins
section and specify eslint-plugin-saxo 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": ["saxo"],
"extends": ["plugin:saxo/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.
- jsx-conditional-indent: Require a indented line when a conditional expression spans multiple lines inside JSX.
- jsx-conditional-newline: Require a newline when a conditional expression is used within JSX.
- jsx-conditional-parens: Require no parens when JSX is used within a conditional.
- jsx-curly-spacing-opinionated: Require particular spacing rules that cannot be defined using jsx-curly-spacing inside eslint-plugin-react.
- jsx-enforce-prop-usage: Enforce how props are used. Can help to enforce extracting inline function calls to variables.
- jsx-enforce-spec-describe: Enforces .spec. unit tests top level describe method to have first argument matching path of file under test.
- clean-jest-snapshots: Checks for code smells in jest snapshots.
- cy-viewport-max: Enforces a limit on cypress viewport.
- cy-viewport-literals: Enforces the use of literals when setting cypress viewport.
- cy-viewport-presets: Enforces a specific set of cypress viewport presets.
Contributions are always welcome!.
eslint-plugin-saxo is licensed under the MIT License.