Skip to content

Latest commit

 

History

History
73 lines (67 loc) · 1.72 KB

README.md

File metadata and controls

73 lines (67 loc) · 1.72 KB

Standard ESLint for Zero41 Projects

Installation

  1. Install eslint:
yarn add eslint@^8 --dev
npm i eslint@^8 --save-dev
  1. 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
  1. Add eslint-config-zero41 to your ESLint .eslintrc.js config:
module.exports = {
  root: true,
  extends: ["eslint-config-zero41"],
  parserOptions: {
    project: "./tsconfig.json",
    tsconfigRootDir: __dirname,
  },
};
  1. 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,
  },
};
  1. 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,
  },
};

Other ESLint Configs