This package provides Codica's .eslintrc as an extensible shared config.
npm install eslint-config-codica --save-devyarn add -D eslint-config-codica{
"extends": ["codica"]
}Our config based on airbnb including some rewrites for ES6+ and React with config-prettier onboard. It requires eslint, eslint-plugin-import, eslint-plugin-prettier, eslint-plugin-react, and eslint-plugin-jsx-a11y.
To be sure, that you're using correct version of each package, you can list them by the command:
npm info "eslint-config-codica@latest" peerDependenciesIf you don't need a React and Prettier onboard - eslint-config-codica-base and eslint-config-codica-react is coming soon!
This config includes eslint-config-prettier and eslint-config-prettier/react. To feel up all advantages of automatic code formatting just add prettier to your project.
yarn add -D prettierand add .prettierrc to your project root with such a config to avoid conflicts with airbnb and prettier eslint configs.
{
"singleQuote": true,
"trailingComma": "all"
}The nice way to make your teammates or/and outstuff developers to push only valid and pretty code is to use pre-commit hooks using lint-staged and husky.
The configuration steps is next:
- Install packages:
yarn add -D husky lint-staged- Add some configuration to
rcfiles or topackage.jsondirectly:
{
...
"scripts": {
...
"lint:write": "./node_modules/.bin/eslint --debug . --fix",
"prettier": "./node_modules/.bin/prettier --write ./**/*.js"
},
"lint-staged": {
"*.(js|jsx)": [
"yarn lint:write",
"git add"
]
},
"husky": {
"hooks": {
"pre-commit": "lint-staged"
}
}
}- You are beautiful! Next time you'll try to commit something, husky will hook up your commit and run
eslintto validate all the new code!
eslint-config-codica is Copyright © 2015-2019 Codica. It is released under the MIT License.
We love open source software! See our other projects or hire us to design, develop, and grow your product.