Ornikar eslint config
Based on Airbnb.
This is the config to use when you don't have babel on the project.
Also see:
- @ornikar/eslint-config-babel
- @ornikar/eslint-config-react
- @ornikar/eslint-config-typescript
- @ornikar/eslint-config-typescript-react
npm install --save-dev eslint @ornikar/eslint-config
- Add
"extends": ["@ornikar/eslint-config/root"]
to your eslint config
npm install --save-dev eslint @ornikar/eslint-config
- Add
"extends": ["@ornikar/eslint-config", "@ornikar/eslint-config/node"]
to your eslint config
npm install --save-dev eslint @ornikar/eslint-config @ornikar/eslint-config-babel
- Add
"extends": ["@ornikar/eslint-config-babel", "@ornikar/eslint-config/node""]
to your eslint config
npm install --save-dev eslint @ornikar/eslint-config @ornikar/eslint-config-typescript
- Add
"extends": ["@ornikar/eslint-config-typescript", "@ornikar/eslint-config/node"]
to your eslint config
{
"root": true,
"extends": ["@ornikar/eslint-config/root"],
"overrides": [
{
"files": ["test-setup.js"],
"extends": ["@ornikar/eslint-config/node-module-override"]
}
]
}
In a project you should have two configurations files:
- /.eslintrc.json
- /{src,lib}/.eslintrc.json
If the project is compiled, use src
for source and dist
for compilation with rollup.
If the project is not compiled, use lib
.
If the project is CRA, next or build with webpack, use src
for source and build
or the build directory your tool uses.
Using two config files is important:
- the root eslintrc is for config files and scripts. It should allow dev dependencies
- the source eslintrc is for your source and tests files.
Both the configuration shoud set "root": true
to prevent eslint to merge the config file with other higher eslintrc configs. See Cascading and hierarchy in eslint config documentation.
The advantage of using 2 config files is to avoid overriding rules set for root. For example, root config should use plugin node, but not always your source config !
Use ignorePatterns
instead of .eslintignore file. We have enough configuration files !
Really usefull tip, it prevents leaving unused eslint-disable directives.
Assuming your package.json looks like "workspaces": ["packages/*"]
:
- /.eslintrc.json
- /packages/*/{src,lib}/.eslintrc.json