Standard ESLint for Zero41 Projects
Install eslint
:
npm i eslint@^8 --save-dev
Install eslint-config-zero41
:
yarn add eslint-config-zero41@https://github.com/Zero41/eslint-config-zero41.git --dev
npm install eslint-config-zero41@github:Zero41/eslint-config-zero41 --save-dev
Add eslint-config-zero41
to your ESLint .eslintrc.js
config:
module . exports = {
root : true ,
extends : [ "eslint-config-zero41" ] ,
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"],
+ settings: {
+ "import/resolver": {
+ node: {
+ paths: ["./"],
+ },
+ },
+ },
parserOptions: {
project: "./tsconfig.json",
tsconfigRootDir: __dirname,
},
};
If you have files types other than *.js
or *.ts
add them:
module.exports = {
root: true,
extends: ["eslint-config-zero41"],
settings: {
"import/resolver": {
node: {
paths: ["./"],
+ extensions: [".js", ".ts", ".mjs"],
},
},
},
parserOptions: {
project: "./tsconfig.json",
tsconfigRootDir: __dirname,
},
};