React specific linting rules for ESLint
Install ESLint either locally or globally.
$ npm install eslint --save-dev
If you installed ESLint
globally, you have to install React plugin globally too. Otherwise, install it locally.
$ npm install eslint-plugin-react-ssr --save-dev
Add plugins
section and specify ESLint-plugin-React as a plugin.
{
"plugins": [
"react-ssr"
]
}
- react/no-constructor-dom: Prevent usage of
window/document
inconstructor
- react/no-will-mount-dom: Prevent usage of
window/document
incomponentWillMount
This plugin also exports an all
configuration that includes every available rule.
This pairs well with the eslint:all
rule.
{
"plugins": [
"react-ssr"
],
"extends": ["eslint:all", "plugin:react-ssr/all"]
}
Note: These configurations will import eslint-plugin-react-ssr
and enable JSX in parser options.
ESLint-plugin-React-SSR is licensed under the MIT License.