-
Notifications
You must be signed in to change notification settings - Fork 34
/
eslint.config.mjs
126 lines (107 loc) · 2.86 KB
/
eslint.config.mjs
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
import importPlugin from "eslint-plugin-import";
import js from "@eslint/js";
import ts from 'typescript-eslint';
export default ts.config({
// https://stackoverflow.com/a/79115209/22200513
ignores: ["**/*.js"]
}, {
files: ["src/**/*.ts"],
extends: [
js.configs.recommended,
...ts.configs.recommended,
importPlugin.flatConfigs.recommended,
importPlugin.flatConfigs.typescript,
],
languageOptions: {
ecmaVersion: 5,
sourceType: "script",
parserOptions: {
tsconfigRootDir: ".",
project: ["./tsconfig.json"],
},
},
rules: {
indent: ["warn", "tab", {
SwitchCase: 1,
MemberExpression: 1,
flatTernaryExpressions: true,
ArrayExpression: "first",
ObjectExpression: "first",
}],
"eol-last": ["error", "always"],
semi: ["error", "always"],
"semi-spacing": ["error", {
before: false,
after: true,
}],
quotes: ["warn", "single"],
"comma-dangle": ["warn", "always-multiline"],
"keyword-spacing": ["error", {
before: true,
after: true,
}],
"key-spacing": ["error", {
beforeColon: false,
afterColon: true,
}],
"arrow-spacing": ["error", {
before: true,
after: true,
}],
"padded-blocks": ["error", "never"],
eqeqeq: ["error", "always", {
null: "ignore",
}],
"no-multi-spaces": ["error"],
"no-var": ["error"],
"prefer-arrow-callback": ["error"],
"no-throw-literal": ["warn"],
"no-param-reassign": ["warn"],
"no-constant-condition": ["warn", { "checkLoops": "all" }],
"no-empty-pattern": ["warn"],
"no-async-promise-executor": ["off"],
"no-useless-escape": ["off"],
"no-multiple-empty-lines": ["error", {
max: 1,
}],
"no-control-regex": ["warn"],
"no-empty": ["warn"],
"no-inner-declarations": ["off"],
"no-sparse-arrays": ["off"],
"nonblock-statement-body-position": ["error", "beside"],
"object-curly-spacing": ["error", "always"],
"space-infix-ops": ["error"],
"space-before-blocks": ["error", "always"],
"@typescript-eslint/no-explicit-any": ["warn"],
"@typescript-eslint/no-unnecessary-condition": ["warn"],
"@typescript-eslint/no-var-requires": ["warn"],
"@typescript-eslint/no-inferrable-types": ["warn"],
"@typescript-eslint/no-empty-function": ["off"],
"@typescript-eslint/no-non-null-assertion": ["off"],
"@typescript-eslint/explicit-function-return-type": ["warn"],
"@typescript-eslint/no-misused-promises": ["error", {
checksVoidReturn: false,
}],
"@typescript-eslint/consistent-type-imports": "error",
"import/no-unresolved": ["off"],
"import/no-default-export": ["warn"],
"import/order": ["warn", {
groups: [
"builtin",
"external",
"internal",
"parent",
"sibling",
"index",
"object",
"type",
],
}],
"@typescript-eslint/no-unused-vars": ["warn", {
argsIgnorePattern: "^_",
varsIgnorePattern: "^_",
caughtErrorsIgnorePattern: "^_",
destructuredArrayIgnorePattern: "^_",
}],
},
});