-
Notifications
You must be signed in to change notification settings - Fork 3
/
.eslintrc.cjs
78 lines (75 loc) · 1.93 KB
/
.eslintrc.cjs
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
const baseRules = {
"array-callback-return": "error",
"no-await-in-loop": "warn",
"no-constant-binary-expression": "warn",
"no-self-compare": "warn",
"arrow-body-style": "warn",
camelcase: "warn",
curly: "error",
"func-names": "error",
"logical-assignment-operators": "warn",
"no-case-declarations": "error",
"no-eval": "error",
"no-multi-assign": "error",
"no-mixed-operators": "warn",
"no-sequences": "error",
"no-useless-computed-key": "warn",
"no-var": "error",
"object-shorthand": "warn",
"one-var": ["error", "never"],
"prefer-const": "warn",
"prefer-destructuring": [
"warn",
{
array: false,
},
],
"prefer-object-spread": "warn",
"prefer-rest-params": "warn",
"prefer-spread": "warn",
radix: "error",
"sort-imports": "warn",
yoda: "warn",
"arrow-parens": "error",
// Assume the developer knows what they're doing
"no-fallthrough": "off",
};
const typescriptRules = Object.entries({
"array-type": "error",
"consistent-generic-constructors": "warn",
"explicit-member-accessibility": "error",
"member-ordering": "warn",
"no-confusing-non-null-assertion": "error",
"no-import-type-side-effects": "warn",
"prefer-as-const": "warn",
"prefer-optional-chain": "warn",
"sort-type-constituents": "warn",
"no-duplicate-imports": "warn",
"no-extra-parens": "warn",
"no-invalid-this": "error",
// Assume the developer knows what they're doing
"no-explicit-any": "off",
"no-non-null-assertion": "off",
}).reduce(
(obj, [key, value]) => ({ ...obj, [`@typescript-eslint/${key}`]: value }),
{},
);
const rules = {
...baseRules,
...typescriptRules,
};
module.exports = {
extends: ["eslint:recommended", "plugin:@typescript-eslint/recommended", "prettier"],
parser: "@typescript-eslint/parser",
plugins: ["@typescript-eslint"],
root: true,
overrides: [
{
files: ["**/bin/*.js"],
env: {
node: true,
},
},
],
rules,
};