@felipelpk2023/eslint-config-base v0.0.3
Linting
This repository is intended to be used as a npm module on all projects to provide eslint/prettier config updates automatically. It encapsules all its dependencies in itself.
How to install
Go to a node/react repository and do the following:
1. Run on terminal yarn add -D @felipelpk/eslint-config-base
2. Run on terminal yarn add -D husky
3. Add the following to the "scripts" section of "package.json":
{
...
"scripts": {
...
"postinstall": "... && husky install",
"lint": "eslint 'src/**/*.ts' --max-warnings=0",
"lint:fix": "eslint --fix 'src/**/*.ts' --max-warnings=0"
...
}
...
}
- Create a .eslintrc.js and a .prettierrc.js with the following contents:
.eslintrc.js:
module.exports = {
extends: ['@felipelpk/base/node'],
parserOptions: {
project: ['./tsconfig.json'],
},
};
.prettierrc.js:
module.exports = {
...require('@felipelpk/eslint-config-base/node/.prettierrc.js')
};
- Run on terminal
yarn && npx husky add .husky/pre-commit "yarn lint"
Whenever git commit
is run on terminal, any linting problems found will block it. You can bypass validation with the "--no-verify" flag. Eg.: git commit -m "Message" --no-verify
If you have linting problems, it is possible to run yarn lint:fix
on terminal to try an automatic fix of all linting problems. Note that not all linting problems are automatically fixable
11 months ago