eslint-plugin-class-extends
v2.0.0
Published
ESLint rule to prevent extending classes.
Downloads
13
Maintainers
Readme
eslint-plugin-class-extends
ESLint rule to prevent extending classes.
Installation
You'll first need to install ESLint:
$ npm i eslint --save-dev
Next, install eslint-plugin-class-extends
:
$ npm install eslint-plugin-class-extends --save-dev
Note: If you installed ESLint globally (using the -g
flag) then you must also install eslint-plugin-class-extends
globally.
Usage
Add class-extends
to the plugins section of your .eslintrc
configuration file. You can omit the eslint-plugin-
prefix:
{
"plugins": ["class-extends"]
}
Then configure the rules you want to use under the rules section.
{
"rules": {
"class-extends/react-extends-only": 2
}
}
Recommended
This plugin exports a recommended
configuration that includes the one rule to
prevent extending classes other than [React.]Component
and
[React.]PureComponent
.
To enable this configuration use the extends
property in your .eslintrc
config file:
{
"extends": [
"eslint:recommended",
"plugin:react/recommended",
"plugin:class-extends/recommended"
]
}