-
Notifications
You must be signed in to change notification settings - Fork 6
/
.eslintrc.js
72 lines (72 loc) · 2.9 KB
/
.eslintrc.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
module.exports = {
root: true,
env: {
node: true,
es6: true,
},
overrides: [
{
files: ["**/*.ts", "**/*.tsx"],
parserOptions: {
parser: "@typescript-eslint/parser",
ecmaVersion: 2018,
sourceType: "module",
ecmaFeatures: {
impliedStrict: true,
},
},
extends: [
"airbnb-base", // TURN ON airbnb-base rules.
"plugin:jest/recommended", // TURN ON Jest rules by using "jest-community/eslint-plugin-jest".
"plugin:prettier/recommended", // RUN Prettier as ESLint rule by using `prettier/eslint-plugin-prettier` and TURN OFF ESLint rules which conflict with Prettier by using `prettier/eslint-config-prettier`.
"eslint:recommended", // TURN ON ESLint recommended rules.
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended", // TURN ON TypeScript rules by using `typescript-eslint/typescript-eslint`.
],
plugins: ["@typescript-eslint"],
settings: {
"import/resolver": {
node: {
extensions: [".js", ".jsx", ".mjs", ".ts", ".tsx"], // Allow import and resolve for *.ts modules.
},
},
},
rules: {
"lines-between-class-members": ["warn", "always", { exceptAfterSingleLine: true }],
"no-dupe-class-members": "off", // Prevents method overload in TypeScript, and TypeScript already checks duplicates.
"no-unused-vars": "off", // @typescript-eslint/recommended has same rule
"no-underscore-dangle": "off",
"import/prefer-default-export": "off",
"@typescript-eslint/explicit-function-return-type": ["warn", { allowExpressions: true, allowTypedFunctionExpressions: true }],
"@typescript-eslint/no-explicit-any": "off",
"import/extensions": ["error", "ignorePackages", { js: "never", mjs: "never", jsx: "never", ts: "never", tsx: "never" }],
"@typescript-eslint/no-use-before-define": "off",
"no-undef-init": "off", // To prevent "Variable is used before being assigned" TS errors.
"default-param-last": "off",
},
overrides: [
{
files: ["*.spec.ts", "*.test.ts"],
env: {
jest: true,
},
rules: {
"@typescript-eslint/explicit-function-return-type": "off",
},
},
],
},
{
files: ["*.js"],
extends: [
"eslint:recommended", // TURN ON ESLint recommended rules.
"plugin:jest/recommended", // TURN ON Jest rules by using "jest-community/eslint-plugin-jest".
"airbnb-base", // TURN ON airbnb-base rules.
"plugin:prettier/recommended", // RUN Prettier as ESLint rule by using `prettier/eslint-plugin-prettier` and TURN OFF ESLint rules which conflict with Prettier by using `prettier/eslint-config-prettier`.
],
rules: {
"import/extensions": "off",
},
},
],
};