@5rabbits/eslint-config
v1.0.2
Published
Shared ESLint configuration for Lemontech products.
Downloads
271
Readme
5rabbits ESLint config
Shared ESLint configuration for Lemontech products.
Installation
- Install
@5rabbits/eslint-configand its dependencies:
$ export PKG=@5rabbits/eslint-config && npm info $PKG peerDependencies --json | command sed 's/[\{\},]//g ; s/: /@/g' | xargs yarn add --dev $PKGIf you have an
.eslintrcfile, add"extends": ["@5rabbits"].If you don't have an
.eslintrcfile, create it on the root of your project:
$ echo '{\n "extends": ["@5rabbits"]\n}' > .eslintrcUsage
Add a
lintscript to yourpackage.json:{ "scripts": { "lint": "eslint . --ext .js,.jsx" } }Run with
yarn lintto check the entire project.
Prettier
If the projects uses prettier (recommended), install eslint-config-prettier and append "prettier" to the .eslintrc extends array.
Integrations
Git
You can use husky and lint-staged to lint the changed files before commiting. Example:
// package.json
{
"lint-staged": {
"*.{js,jsx}": ["eslint"]
},
"husky": {
"hooks": {
"pre-commit": "lint-staged"
}
}
}If the changes causes lint errors the commit will fail until you fix them.
Webpack
Use eslint-loader to automatically lint files on webpack builds.
Rollup
Use rollup-plugin-eslint to automatically lint files on rollup builds.
