eslint-config-lenel
v1.2.1
Published
Eslint config for React apps
Downloads
26
Readme
eslint-config-lenel
An eslint config for React applications.
It contains plugins:
- eslint-plugin-babel - ESLint rules for babel
- eslint-plugin-react - ESLint rules for react
- eslint-plugin-lodash - ESLint rules for lodash (
underscore
is forbidden) - eslint-plugin-import - ESLint plugin with rules that help validate proper imports
Installation
npm install --save-dev eslint-config-lenel
Configure .eslintrc
{
"extends": "eslint-config-lenel"
}
Add scripts to package.json
"scripts": {
"lint": "eslint --ext jsx --ext js .",
"lint:fix": "npm run lint -- --fix"
}
Run scripts with -s
flag
npm run lint -s
npm run lint:fix -s
General notes
- Exceptions for
import/no-unresolved
Eslint will report errors if you use aliases in webpack.
Disable it by adding:'import/no-unresolved': [2, { ignore: ['^components/', '^containers/', '^services/', '^layouts/'] }]
- Chai and
no-unused-expressions
Eslint will report errors if you use syntax:expect(foo).to.be.true
.
Disable it by adding:
If you have unit tests in a separate folder e.g"no-unused-expressions": 0
test/
you can create a nested config.
Example:
Createtest/.eslintrc
and extend the base config.{ "extends" : "../.eslintrc", "env" : { "mocha" : true }, "globals": { "expect": true, }, "rules": { "no-unused-expressions": 0, "no-magic-numbers": 0, } }
Contributors
- lsentkiewicz - Łukasz Sentkiewicz
License
MIT