- Install with
npm install eslint --save-dev
- Setup the configuration with
npx eslint --init
- Install the ESlint CLI
npm i -g eslint
- Install with
npm install --save-dev prettier eslint-config-prettier
- Hookup with a pre-commit automatic format
npm install pretty-quick husky --save-dev
- add
{
"husky": {
"hooks": {
"pre-commit": "pretty-quick --staged"
}
}
}
to package.json.
- Just do
npm install
After you pull the code from a configured master.
- To see the problems with current code style, run
npx eslint yourfile1.tsx
or
eslint yourfile1.tsx
- To automatically fix the code style, run
npx eslint yourfile.tsx --fix
or
eslint yourfile.tsx --fix
- To check code style for all files, run
npm run lint
- To fix the code style for all files, run
npm run lint -- --fix
- No action needed, when you do
git commit
it should automatically format the code style for you.