/
.eslintrc.json
134 lines (134 loc) 路 4.24 KB
/
.eslintrc.json
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
{
"extends": [],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"tsconfigRootDir": ".",
"project": [
"shared/tsconfig.json",
"frontend/tsconfig.json",
"backend/tsconfig.json",
"data/tsconfig.json"
]
},
"overrides": [
// we disable these rules until https://github.com/typescript-eslint/typescript-eslint/issues/6314 is fixed
{
"files": [
"*/src/**/*.ts"
],
"rules": {
"@typescript-eslint/no-unsafe-assignment": "off",
"@typescript-eslint/no-unsafe-member-access": "off",
"@typescript-eslint/no-unsafe-argument": "off",
"@typescript-eslint/no-unsafe-call": "off",
"@typescript-eslint/no-unsafe-return": "off"
}
},
{
"files": [
"**/*.tsx"
],
// these rules aren't really working with tsx, seems like a eslint bug
"rules": {
"@typescript-eslint/no-unsafe-assignment": "off",
"@typescript-eslint/no-unsafe-member-access": "off",
"@typescript-eslint/no-unsafe-argument": "off",
"@typescript-eslint/no-unsafe-call": "off",
"@typescript-eslint/no-unsafe-return": "off"
}
},
{
"files": ["**/*.tsx"],
"rules": {
"@typescript-eslint/explicit-function-return-type": "off"
}
}
],
"ignorePatterns": [
"**/*.cjs",
"**/*.config.ts",
"**/*.esm",
"**/*.js",
"**/*.test.ts"
],
"plugins": [
"@typescript-eslint"
],
"root": true,
"rules": {
"eqeqeq": "error",
"use-isnan": "error",
"valid-typeof": "error",
"no-invalid-regexp": "error",
"no-dupe-else-if": "error",
"no-duplicate-case": "error",
"no-new-symbol": "error",
"no-unreachable": "error",
"no-debugger": "warn",
"require-atomic-updates": "warn",
"no-console": [
"error",
{
"allow": [
"error"
]
}
],
"@typescript-eslint/array-type": "error",
"@typescript-eslint/await-thenable": "error",
"@typescript-eslint/no-unused-vars": "warn",
"@typescript-eslint/dot-notation": "error",
"@typescript-eslint/ban-types": "error",
"@typescript-eslint/consistent-type-imports": "error",
"@typescript-eslint/consistent-type-exports": "error",
"@typescript-eslint/no-array-constructor": "error",
"@typescript-eslint/no-for-in-array": "error",
"@typescript-eslint/no-implied-eval": "error",
"@typescript-eslint/no-invalid-this": "error",
"@typescript-eslint/no-invalid-void-type": "error",
"@typescript-eslint/no-meaningless-void-operator": "error",
"@typescript-eslint/no-misused-new": "error",
"@typescript-eslint/no-misused-promises": "error",
"@typescript-eslint/no-throw-literal": "error",
"@typescript-eslint/no-unnecessary-condition": "error",
"@typescript-eslint/prefer-as-const": "error",
"@typescript-eslint/prefer-enum-initializers": "error",
"@typescript-eslint/prefer-nullish-coalescing": "error",
"@typescript-eslint/return-await": "error",
// because we need to deal with API gateways, we inevitably
// will run into any, especially after any JSON.parse() call.
// so we only warn about it instead of throwing errors
"@typescript-eslint/no-unsafe-argument": "warn",
"@typescript-eslint/no-unsafe-assignment": "warn",
"@typescript-eslint/no-unsafe-call": "warn",
"@typescript-eslint/no-unsafe-member-access": "warn",
"@typescript-eslint/no-unsafe-return": "warn",
"@typescript-eslint/no-loop-func": "warn",
"@typescript-eslint/prefer-for-of": "warn",
"@typescript-eslint/restrict-plus-operands": "warn",
"@typescript-eslint/prefer-function-type": "warn",
"@typescript-eslint/prefer-includes": "warn",
"@typescript-eslint/prefer-readonly": "warn",
"@typescript-eslint/require-array-sort-compare": "warn",
"@typescript-eslint/no-floating-promises": [
"warn",
{
"ignoreIIFE": true
}
],
"@typescript-eslint/no-confusing-non-null-assertion": "warn",
"@typescript-eslint/consistent-type-assertions": [
"error",
{
"assertionStyle": "as"
}
],
"@typescript-eslint/explicit-function-return-type": [
"error",
{
"allowExpressions": true,
"allowIIFEs": true
}
]
}
}