ESLint-plugin-JSX-control-statements
Installation
Install ESLint either locally or globally.
$ npm install eslint
If you installed ESLint
globally, you have to install React plugin globally too. Otherwise, install it locally.
$ npm install eslint-plugin-jsx-control-statements
Configuration
Add plugins
section and specify ESLint-plugin-JSX-Control-Statements as a plugin.
{
"plugins": [
"jsx-control-statements"
]
}
If it is not already the case you must also configure ESLint
to support JSX.
{
"ecmaFeatures": {
"jsx": true
}
}
Finally, enable all of the rules that you would like to use.
{
"rules": {
"jsx-control-statements/jsx-if-condition": 1,
"jsx-control-statements/jsx-if-single-child": 1
}
}
List of supported rules
Credits
Thanks to @yannickcr for his awesome eslint-plugin-react.
License
MIT License. Copyright(c) Vivek Kumar Bansal