forked from DesModder/DesModder
-
Notifications
You must be signed in to change notification settings - Fork 0
/
eslint.config.mjs
126 lines (122 loc) · 3.95 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 rulesDirPlugin from "eslint-plugin-rulesdir";
import love from "eslint-config-love";
import eslintConfigPrettier from "eslint-config-prettier";
import globals from "globals";
import tsParser from "@typescript-eslint/parser";
import tseslint from "typescript-eslint";
rulesDirPlugin.RULES_DIR = "scripts/eslint-rules";
export default tseslint.config(
{
ignores: [
"coverage",
"node_modules",
"dist",
"dist-ts",
"hooks",
"LICENSE*",
"**/dist",
// Opt-out instead of opt-in to avoid forgetting to include some js file.
"**/*.md",
"**/*.json",
"**/*.replacements",
"**/*.grammar",
"**/*.woff",
"**/*.css",
"**/*.less",
"**/*.sh",
"**/*.png",
"**/*.ftl",
"**/*.html",
"**/*.svg",
"**/*.zip",
"eslint.config.mjs",
],
},
{
files: ["**/*.{ts,tsx,js,cjs,mjs}"],
languageOptions: {
globals: {
...globals.browser,
...globals.es2024,
},
parser: tsParser,
ecmaVersion: 2024,
sourceType: "module",
parserOptions: {
projectService: true,
tsconfigRootDir: import.meta.dirname,
},
},
},
// "love" is a new name for "standard-with-typescript"
love,
eslintConfigPrettier,
{
rules: {
"@typescript-eslint/no-non-null-assertion": "off",
"@typescript-eslint/array-type": "off",
"@typescript-eslint/strict-boolean-expressions": "off",
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/restrict-template-expressions": "off",
"@typescript-eslint/no-confusing-void-expression": [
"error",
{
ignoreArrowShorthand: true,
},
],
"@typescript-eslint/consistent-type-imports": "off",
"no-unused-vars": "off",
"@typescript-eslint/no-unused-vars": "off",
"no-console": "error",
"@typescript-eslint/no-unsafe-argument": "off",
"@typescript-eslint/prefer-destructuring": [
"error",
{ array: true, object: true },
{
enforceForRenamedProperties: false,
enforceForDeclarationWithTypeAnnotation: false,
},
],
// Workarounds to avoid errors in existing code
"@typescript-eslint/only-throw-error": [
"error",
{ allowThrowingAny: false, allowThrowingUnknown: true },
],
"@typescript-eslint/class-methods-use-this": "off",
"@typescript-eslint/max-params": "off",
"@typescript-eslint/init-declarations": "off",
"@typescript-eslint/no-empty-function": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-loop-func": "off",
"@typescript-eslint/no-inferrable-types": "off",
"@typescript-eslint/no-deprecated": "off",
"@typescript-eslint/no-magic-numbers": "off",
"@typescript-eslint/no-redundant-type-constituents": "off",
"@typescript-eslint/no-unnecessary-condition": "off",
"@typescript-eslint/no-unnecessary-type-arguments": "off",
"@typescript-eslint/no-unnecessary-type-parameters": "off",
"@typescript-eslint/no-unsafe-assignment": "off",
"@typescript-eslint/no-unsafe-call": "off",
"@typescript-eslint/no-unsafe-member-access": "off",
"@typescript-eslint/no-unsafe-return": "off",
"@typescript-eslint/no-unsafe-unary-minus": "off",
"eslint-comments/require-description": "off",
"@typescript-eslint/switch-exhaustiveness-check": "off",
"@typescript-eslint/no-unsafe-type-assertion": "off",
"@typescript-eslint/use-unknown-in-catch-callback-variable": "off",
"@typescript-eslint/require-await": "off",
},
},
{
plugins: {
rulesdir: rulesDirPlugin,
},
rules: {
"rulesdir/no-format-in-ts": "error",
"rulesdir/no-expect-promise": "error",
"rulesdir/no-reach-past-exports": "error",
"rulesdir/no-external-imports": "error",
"rulesdir/no-timeouts-in-intellisense": "error",
},
}
);