npm install eslint @singularit/eslint-config -D
module.exports = {
extends: "@singularit"
}
For example:
{
"scripts": {
"lint": "eslint .",
"lint:fix": "eslint . --fix"
}
}
- Install and setup husky
npx husky-init && npm install
- Add
lint-staged
to pre-commit hook
# .husky/pre-commit
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"
- npm test
+ npx lint-staged
- Configure
lint-staged
// package.json
{
...
+ "lint-staged": {
+ "*.{js,jsx,ts,tsx,vue,md,yml,yaml}": "eslint --fix --max-warnings 0"
+ }
...
}
MIT