@trevorblades/eslint-plugin
v1.4.0
Published
My favourite ESLint rules and configs.
Downloads
98
Maintainers
Readme
@trevorblades/eslint-plugin
This package is the successor to my old ESLint config, @trevorblades/eslint-config
. It's compatible with ESLint 8 and features a few major differences:
Installation
npm i -D @trevorblades/eslint-plugin
Usage
// .eslintrc.js
module.exports = {
extends: ["plugin:@trevorblades/node"]
};
Configs
This plugin contains the following configs:
plugin:@trevorblades/node
for basic JavaScript and Node.js projectsplugin:@trevorblades/react
for React projectsplugin:@trevorblades/typescript
for TypeScript projectsplugin:@trevorblades/graphql
for projects that contain GraphQL files
The react
config inherits rules and plugins from node
, but typescript
and graphql
don't inherit any rules, and must be combined with the other configs for best results.
Prettier
In my old config, the base config included Prettier and the other configs extended it, and then added on other plugins and configs afterward. This isn't ideal, since the docs for eslint-plugin-prettier
state that it must be included last in the array of extensions.
Now, users of these configs can combine them together, and then manually add Prettier support at the end of their own configs.
npm i -D eslint-plugin-prettier eslint-config-prettier
npm i --save-exact prettier
// .eslintrc.js
module.exports = {
extends: [
"plugin:@trevorblades/react",
"plugin:@trevorblades/typescript",
"plugin:@trevorblades/graphql",
"plugin:prettier/recommended"
]
};