- Install all peer dependencies. You can use your favourite tool or just type:
For React:
yarn add --dev eslint@8 @typescript-eslint/eslint-plugin@5 @typescript-eslint/parser@5 [email protected] [email protected] typescript@4
For Node:
yarn add --dev eslint@8 @typescript-eslint/eslint-plugin@5 @typescript-eslint/parser@5 typescript@4
- Install package with configuration:
yarn add --dev @leocode/eslint-config
For node put this in .eslintrc.js
file:
module.exports = {
extends: ['@leocode/eslint-config/node'],
};
For React put this in .eslintrc.js
file:
module.exports = {
extends: ['@leocode/eslint-config/react'],
};
If ESLint doesn't work by default in your editor (it cannot find tsconfig.json
file), you may need to specify in .eslintrc.js
:
module.exports = {
extends: ['@leocode/eslint-config/node'],
parserOptions: {
tsconfigRootDir: __dirname, // or any other directory relative to `.eslintrc.js` file
},
};
MIT