- Install
eslint
:
yarn add eslint^8 --dev
npm i eslint@^8 --save-dev
- Install
eslint-config-zero41-react
:
yarn add esling-config-zero41@https://github.com/Zero41/eslint-config-zero41-react.git --dev
npm install eslint-config-zero41-react@github:Zero41/eslint-config-zero41-react --save-dev
- Add
eslint-config-zero41-react
to your ESLint.eslintrc.js
config:
module.exports = {
root: true,
extends: ["eslint-config-zero41-react"],
parserOptions: {
project: "./tsconfig.json",
tsconfigRootDir: __dirname,
},
};
- If you are using absolute imports, use paths to define the root:
module.exports = {
root: true,
extends: ["eslint-config-zero41-react"],
+ settings: {
+ "import/resolver": {
+ node: {
+ paths: ["./"],
+ },
+ },
+ },
parserOptions: {
project: "./tsconfig.json",
tsconfigRootDir: __dirname,
},
};
- If you have files types other than
*.js
,*.jsx
,*.ts
or*.tsx
add them:
module.exports = {
root: true,
extends: ["eslint-config-zero41-react"],
settings: {
"import/resolver": {
node: {
paths: ["./"],
+ extensions: [".js", ".jsx", ".ts", ".tsx", ".mjs"],
},
},
},
parserOptions: {
project: "./tsconfig.json",
tsconfigRootDir: __dirname,
},
};
- Standard ESLint for Zero41 Projects: eslint-config-zero41
- Standard ESLint for React Native Zero41 Projects: eslint-config-zero41-react-native