1.0.4 • Published 1 year ago
@mvlchain/eslint-config v1.0.4
@mvlchain/eslint-config
Common ESLint config used in MVL FE projects.
Install
$ yarn add -D @mvlchain/eslint-configUsage
.eslintrc.js
- Add the following to
.eslintrc.js
module.exports = {
extends: ['@mvlchain/eslint-config'], // or @mvlchain/eslint-config/react
};If you use
@mvlchain/eslint-config/react, you don't need to use@mvlchain/eslint-config.
package.json
- Add the following to
package.json
{
"eslintConfig": {
"extends": "@mvlchain/eslint-config" // or @mvlchain/eslint-config/react
}
}With Husky & Lint Staged
- Install husky, lint-staged:
$ yarn add -D husky lint-staged- Add the following to
package.json:
{
"scripts": {
// ...
"prepare": "husky install",
"lint-staged": "lint-staged",
"lint:fix": "./node_modules/.bin/eslint --fix",
// ...
},
"lint-staged": {
"**/*.{ts,tsx}": [
"yarn run lint:fix"
]
}
}- Set up pre-commit
$ yarn run prepare
$ npx husky add .husky/pre-commit "yarn run lint-staged"
$ git add .husky/pre-commit