@ethang/eslint-config 19.4.6 → 19.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -1
- package/build/create-config-file.ts +51 -0
- package/build/{create-config.js → create-config.ts} +13 -3
- package/build/{get-react-version.js → get-react-version.ts} +1 -1
- package/build/{list-utils.mjs → list-utils.ts} +21 -26
- package/build/{rule-list.mjs → rule-list.ts} +97 -87
- package/build/{update-readme.js → update-readme.ts} +29 -13
- package/build/{update-rules.js → update-rules.ts} +29 -20
- package/build.mjs +2 -2
- package/config.solid.js +0 -1
- package/eslint.config.js +3 -47
- package/package.json +7 -1
- package/setup/a11y.ts +13 -0
- package/setup/astro.ts +13 -0
- package/setup/barrel.ts +13 -0
- package/setup/compat.ts +12 -0
- package/setup/cspell.ts +13 -0
- package/setup/depend.ts +13 -0
- package/setup/{deprecated.js → deprecated.ts} +2 -2
- package/setup/eslint.ts +233 -0
- package/setup/{ethang.js → ethang.ts} +2 -1
- package/setup/gen-rules.ts +60 -0
- package/setup/json.ts +15 -0
- package/setup/lodash.ts +50 -0
- package/setup/markdown.ts +12 -0
- package/setup/n.ts +85 -0
- package/setup/{perfectionist.js → perfectionist.ts} +4 -2
- package/setup/react.ts +63 -0
- package/setup/solid.ts +15 -0
- package/setup/{sonar.js → sonar.ts} +2 -20
- package/setup/{stylistic.js → stylistic.ts} +3 -3
- package/setup/{tailwind.js → tailwind.ts} +2 -2
- package/setup/tanstack-query.ts +7 -0
- package/setup/{typescript-eslint.js → typescript-eslint.ts} +6 -26
- package/setup/unicorn.ts +37 -0
- package/tsconfig.json +5 -1
- package/build/create-config-file.js +0 -45
- package/setup/a11y.js +0 -25
- package/setup/astro.js +0 -7
- package/setup/barrel.js +0 -9
- package/setup/compat.js +0 -10
- package/setup/depend.js +0 -11
- package/setup/eslint.js +0 -71
- package/setup/gen-rules.js +0 -39
- package/setup/json.js +0 -7
- package/setup/lodash.js +0 -19
- package/setup/markdown.js +0 -7
- package/setup/n.js +0 -31
- package/setup/react.js +0 -35
- package/setup/solid.js +0 -10
- package/setup/tanstack-query.js +0 -7
- package/setup/unicorn.js +0 -32
package/setup/eslint.ts
ADDED
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
import eslint from "@eslint/js";
|
|
2
|
+
|
|
3
|
+
import { genRules } from "./gen-rules.ts";
|
|
4
|
+
|
|
5
|
+
const ruleNames = Object.keys(eslint.configs.all.rules);
|
|
6
|
+
const changedRules = [
|
|
7
|
+
{
|
|
8
|
+
name: "arrow-body-style",
|
|
9
|
+
rule: ["error", "always"],
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
name: "camelcase",
|
|
13
|
+
rule: "off",
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
name: "capitalized-comments",
|
|
17
|
+
rule: "off",
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
name: "class-methods-use-this",
|
|
21
|
+
rule: "off",
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
name: "complexity",
|
|
25
|
+
rule: "off",
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
name: "consistent-return",
|
|
29
|
+
rule: "off",
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
name: "consistent-this",
|
|
33
|
+
rule: "off",
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
name: "curly",
|
|
37
|
+
rule: "off",
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
name: "default-case",
|
|
41
|
+
rule: "off",
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
name: "default-case-last",
|
|
45
|
+
rule: "off",
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
name: "default-param-last",
|
|
49
|
+
rule: "off",
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
name: "dot-notation",
|
|
53
|
+
rule: "off",
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
name: "func-names",
|
|
57
|
+
rule: "off",
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
name: "func-style",
|
|
61
|
+
rule: ["error", "declaration", { allowArrowFunctions: true }],
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
name: "id-denylist",
|
|
65
|
+
rule: "off",
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
name: "id-length",
|
|
69
|
+
rule: "off",
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
name: "id-match",
|
|
73
|
+
rule: "off",
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
name: "init-declarations",
|
|
77
|
+
rule: "off",
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
name: "max-lines",
|
|
81
|
+
rule: "off",
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
name: "max-lines-per-function",
|
|
85
|
+
rule: "off",
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
name: "max-params",
|
|
89
|
+
rule: "off",
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
name: "new-cap",
|
|
93
|
+
rule: "off",
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
name: "no-array-constructor",
|
|
97
|
+
rule: "off",
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
name: "no-empty-function",
|
|
101
|
+
rule: "off",
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
name: "no-implicit-globals",
|
|
105
|
+
rule: "off",
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
name: "no-implied-eval",
|
|
109
|
+
rule: "off",
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
name: "no-inline-comments",
|
|
113
|
+
rule: "off",
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
name: "no-magic-numbers",
|
|
117
|
+
rule: "off",
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
name: "no-redeclare",
|
|
121
|
+
rule: "off",
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
name: "no-restricted-exports",
|
|
125
|
+
rule: "off",
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
name: "no-restricted-globals",
|
|
129
|
+
rule: "off",
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
name: "no-restricted-imports",
|
|
133
|
+
rule: "off",
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
name: "no-restricted-properties",
|
|
137
|
+
rule: "off",
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
name: "no-restricted-syntax",
|
|
141
|
+
rule: "off",
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
name: "no-shadow",
|
|
145
|
+
rule: "off",
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
name: "no-template-curly-in-string",
|
|
149
|
+
rule: "off",
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
name: "no-ternary",
|
|
153
|
+
rule: "off",
|
|
154
|
+
},
|
|
155
|
+
{
|
|
156
|
+
name: "no-throw-literal",
|
|
157
|
+
rule: "off",
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
name: "no-undef",
|
|
161
|
+
rule: "off",
|
|
162
|
+
},
|
|
163
|
+
{
|
|
164
|
+
name: "no-undefined",
|
|
165
|
+
rule: "off",
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
name: "no-underscore-dangle",
|
|
169
|
+
rule: "off",
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
name: "no-unexpected-multiline",
|
|
173
|
+
rule: "off",
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
name: "no-unsafe-optional-chaining",
|
|
177
|
+
rule: ["error", { disallowArithmeticOperators: true }],
|
|
178
|
+
},
|
|
179
|
+
{
|
|
180
|
+
name: "no-unused-expressions",
|
|
181
|
+
rule: "off",
|
|
182
|
+
},
|
|
183
|
+
{
|
|
184
|
+
name: "no-unused-vars",
|
|
185
|
+
rule: "off",
|
|
186
|
+
},
|
|
187
|
+
{
|
|
188
|
+
name: "no-use-before-define",
|
|
189
|
+
rule: "off",
|
|
190
|
+
},
|
|
191
|
+
{
|
|
192
|
+
name: "no-useless-assignment",
|
|
193
|
+
rule: "off",
|
|
194
|
+
},
|
|
195
|
+
{
|
|
196
|
+
name: "no-useless-constructor",
|
|
197
|
+
rule: "off",
|
|
198
|
+
},
|
|
199
|
+
{
|
|
200
|
+
name: "no-warning-comments",
|
|
201
|
+
rule: "off",
|
|
202
|
+
},
|
|
203
|
+
{
|
|
204
|
+
name: "one-var",
|
|
205
|
+
rule: "off",
|
|
206
|
+
},
|
|
207
|
+
{
|
|
208
|
+
name: "prefer-destructuring",
|
|
209
|
+
rule: "off",
|
|
210
|
+
},
|
|
211
|
+
{
|
|
212
|
+
name: "prefer-promise-reject-errors",
|
|
213
|
+
rule: "off",
|
|
214
|
+
},
|
|
215
|
+
{
|
|
216
|
+
name: "require-await",
|
|
217
|
+
rule: "off",
|
|
218
|
+
},
|
|
219
|
+
{
|
|
220
|
+
name: "sort-imports",
|
|
221
|
+
rule: "off",
|
|
222
|
+
},
|
|
223
|
+
{
|
|
224
|
+
name: "sort-keys",
|
|
225
|
+
rule: "off",
|
|
226
|
+
},
|
|
227
|
+
{
|
|
228
|
+
name: "yoda",
|
|
229
|
+
rule: ["error", "always"],
|
|
230
|
+
},
|
|
231
|
+
];
|
|
232
|
+
|
|
233
|
+
export const eslintRules = genRules(ruleNames, changedRules);
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { Rule } from "eslint";
|
|
2
|
+
|
|
3
|
+
export type EsLintRules = Record<string, Rule.RuleModule>;
|
|
4
|
+
|
|
5
|
+
export const getNonDeprecatedRules = (rules: EsLintRules) => {
|
|
6
|
+
const filtered: EsLintRules = {};
|
|
7
|
+
|
|
8
|
+
for (const [key, value] of Object.entries(rules)) {
|
|
9
|
+
if (value.meta?.deprecated !== true) {
|
|
10
|
+
filtered[key] = value;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
return filtered;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export type CustomRules = {
|
|
18
|
+
name: string;
|
|
19
|
+
rule: unknown;
|
|
20
|
+
}[];
|
|
21
|
+
|
|
22
|
+
export const genRules = (
|
|
23
|
+
ruleNames: string[],
|
|
24
|
+
customRules: CustomRules,
|
|
25
|
+
prefix?: string,
|
|
26
|
+
defaultOverride = "error",
|
|
27
|
+
) => {
|
|
28
|
+
const rules: Record<string, unknown> = {};
|
|
29
|
+
|
|
30
|
+
for (const rule of ruleNames) {
|
|
31
|
+
if (prefix === undefined) {
|
|
32
|
+
rules[rule] = defaultOverride ?? "error";
|
|
33
|
+
} else {
|
|
34
|
+
rules[`${prefix}/${rule}`] = defaultOverride ?? "error";
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
if (customRules) {
|
|
39
|
+
for (const rule of customRules) {
|
|
40
|
+
if (ruleNames.includes(rule.name)) {
|
|
41
|
+
if (prefix === undefined) {
|
|
42
|
+
rules[rule.name] = rule.rule;
|
|
43
|
+
} else {
|
|
44
|
+
rules[`${prefix}/${rule.name}`] = rule.rule;
|
|
45
|
+
}
|
|
46
|
+
} else {
|
|
47
|
+
// eslint-disable-next-line no-console
|
|
48
|
+
console.error(
|
|
49
|
+
`${rule.name} in ${prefix ?? "(unknown prefix)"} does not exist.`,
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
return Object.fromEntries(
|
|
56
|
+
Object.entries(rules).sort(([a], [b]) => {
|
|
57
|
+
return a.localeCompare(b);
|
|
58
|
+
}),
|
|
59
|
+
);
|
|
60
|
+
};
|
package/setup/json.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import json from "@eslint/json";
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
type CustomRules,
|
|
5
|
+
genRules,
|
|
6
|
+
getNonDeprecatedRules,
|
|
7
|
+
type EsLintRules,
|
|
8
|
+
} from "./gen-rules.ts";
|
|
9
|
+
|
|
10
|
+
const ruleNames = Object.keys(
|
|
11
|
+
getNonDeprecatedRules(json.rules as unknown as EsLintRules),
|
|
12
|
+
);
|
|
13
|
+
const customRules: CustomRules = [];
|
|
14
|
+
|
|
15
|
+
export const jsonRules = genRules(ruleNames, customRules, "json");
|
package/setup/lodash.ts
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
// @ts-expect-error no types
|
|
2
|
+
import lodash from "eslint-plugin-lodash";
|
|
3
|
+
|
|
4
|
+
import { genRules, getNonDeprecatedRules } from "./gen-rules.ts";
|
|
5
|
+
|
|
6
|
+
const ruleNames = Object.keys(getNonDeprecatedRules(lodash.rules));
|
|
7
|
+
const customRules = [
|
|
8
|
+
{
|
|
9
|
+
name: "chain-style",
|
|
10
|
+
rule: ["error", "as-needed"],
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
name: "consistent-compose",
|
|
14
|
+
rule: ["error", "flow"],
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
name: "identity-shorthand",
|
|
18
|
+
rule: ["error", "always"],
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
name: "import-scope",
|
|
22
|
+
rule: ["error", "method"],
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
name: "matches-prop-shorthand",
|
|
26
|
+
rule: ["error", "always"],
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
name: "matches-shorthand",
|
|
30
|
+
rule: ["error", "always", 3],
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
name: "path-style",
|
|
34
|
+
rule: ["error", "array"],
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
name: "prefer-includes",
|
|
38
|
+
rule: ["error", { includeNative: true }],
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
name: "prefer-some",
|
|
42
|
+
rule: ["error", { includeNative: true }],
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
name: "prop-shorthand",
|
|
46
|
+
rule: ["error", "always"],
|
|
47
|
+
},
|
|
48
|
+
];
|
|
49
|
+
|
|
50
|
+
export const lodashRules = genRules(ruleNames, customRules, "lodash");
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import markdown from "@eslint/markdown";
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
type CustomRules,
|
|
5
|
+
genRules,
|
|
6
|
+
getNonDeprecatedRules,
|
|
7
|
+
} from "./gen-rules.ts";
|
|
8
|
+
|
|
9
|
+
const ruleNames = Object.keys(getNonDeprecatedRules(markdown.rules ?? {}));
|
|
10
|
+
const customRules: CustomRules = [];
|
|
11
|
+
|
|
12
|
+
export const markdownRules = genRules(ruleNames, customRules, "markdown");
|
package/setup/n.ts
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import n from "eslint-plugin-n";
|
|
2
|
+
|
|
3
|
+
import { genRules, getNonDeprecatedRules } from "./gen-rules.ts";
|
|
4
|
+
|
|
5
|
+
const ruleNames = Object.keys(getNonDeprecatedRules(n.rules ?? {}));
|
|
6
|
+
const changedRules = [
|
|
7
|
+
{
|
|
8
|
+
name: "callback-return",
|
|
9
|
+
rule: "off",
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
name: "exports-style",
|
|
13
|
+
rule: ["error", "exports"],
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
name: "file-extension-in-import",
|
|
17
|
+
rule: "off",
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
name: "global-require",
|
|
21
|
+
rule: "off",
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
name: "no-callback-literal",
|
|
25
|
+
rule: "off",
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
name: "no-missing-import",
|
|
29
|
+
rule: "off",
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
name: "no-mixed-requires",
|
|
33
|
+
rule: "off",
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
name: "no-new-require",
|
|
37
|
+
rule: "off",
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
name: "no-process-env",
|
|
41
|
+
rule: "off",
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
name: "no-process-exit",
|
|
45
|
+
rule: "off",
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
name: "no-restricted-import",
|
|
49
|
+
rule: "off",
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
name: "no-restricted-require",
|
|
53
|
+
rule: "off",
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
name: "no-sync",
|
|
57
|
+
rule: "off",
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
name: "no-unpublished-import",
|
|
61
|
+
rule: "off",
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
name: "no-unpublished-require",
|
|
65
|
+
rule: "off",
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
name: "prefer-promises/dns",
|
|
69
|
+
rule: "off",
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
name: "prefer-promises/fs",
|
|
73
|
+
rule: "off",
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
name: "process-exit-as-throw",
|
|
77
|
+
rule: "off",
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
name: "hashbang",
|
|
81
|
+
rule: "off",
|
|
82
|
+
},
|
|
83
|
+
];
|
|
84
|
+
|
|
85
|
+
export const nRules = genRules(ruleNames, changedRules, "n");
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import perfectionist from "eslint-plugin-perfectionist";
|
|
2
2
|
|
|
3
|
-
import { genRules } from "./gen-rules.
|
|
3
|
+
import { EsLintRules, genRules, getNonDeprecatedRules } from "./gen-rules.ts";
|
|
4
4
|
|
|
5
|
-
const ruleNames = Object.keys(
|
|
5
|
+
const ruleNames = Object.keys(
|
|
6
|
+
getNonDeprecatedRules(perfectionist.rules as unknown as EsLintRules),
|
|
7
|
+
);
|
|
6
8
|
const customRules = [
|
|
7
9
|
{
|
|
8
10
|
name: "sort-astro-attributes",
|
package/setup/react.ts
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import react from "@eslint-react/eslint-plugin";
|
|
2
|
+
// @ts-expect-error no types
|
|
3
|
+
import reactHooks from "eslint-plugin-react-hooks";
|
|
4
|
+
|
|
5
|
+
import { genRules, getNonDeprecatedRules } from "./gen-rules.ts";
|
|
6
|
+
|
|
7
|
+
const reactRuleNames = Object.keys(getNonDeprecatedRules(react.rules));
|
|
8
|
+
const customReactRules = [
|
|
9
|
+
{
|
|
10
|
+
name: "avoid-shorthand-boolean",
|
|
11
|
+
rule: "off",
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
name: "avoid-shorthand-fragment",
|
|
15
|
+
rule: "off",
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
name: "debug/class-component",
|
|
19
|
+
rule: "off",
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
name: "debug/function-component",
|
|
23
|
+
rule: "off",
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
name: "debug/hook",
|
|
27
|
+
rule: "off",
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
name: "debug/is-from-react",
|
|
31
|
+
rule: "off",
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
name: "debug/react-hooks",
|
|
35
|
+
rule: "off",
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
name: "naming-convention/filename",
|
|
39
|
+
rule: ["error", { rule: "kebab-case" }],
|
|
40
|
+
},
|
|
41
|
+
];
|
|
42
|
+
const reactGen = genRules(reactRuleNames, customReactRules, "react");
|
|
43
|
+
|
|
44
|
+
const reactHookRuleNames = Object.keys(reactHooks.rules);
|
|
45
|
+
const customHookRules = [
|
|
46
|
+
{
|
|
47
|
+
name: "exhaustive-deps",
|
|
48
|
+
rule: "error",
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
name: "rules-of-hooks",
|
|
52
|
+
rule: "error",
|
|
53
|
+
},
|
|
54
|
+
];
|
|
55
|
+
const hookGen = genRules(reactHookRuleNames, customHookRules, "react-hooks");
|
|
56
|
+
|
|
57
|
+
export const reactRules = {
|
|
58
|
+
...reactGen,
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
export const reactHookRules = {
|
|
62
|
+
...hookGen,
|
|
63
|
+
};
|
package/setup/solid.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import solid from "eslint-plugin-solid";
|
|
2
|
+
|
|
3
|
+
import { EsLintRules, genRules, getNonDeprecatedRules } from "./gen-rules.ts";
|
|
4
|
+
|
|
5
|
+
const ruleNames = Object.keys(
|
|
6
|
+
getNonDeprecatedRules(solid.rules as unknown as EsLintRules),
|
|
7
|
+
);
|
|
8
|
+
const customRules = [
|
|
9
|
+
{
|
|
10
|
+
name: "no-proxy-apis",
|
|
11
|
+
rule: "off",
|
|
12
|
+
},
|
|
13
|
+
];
|
|
14
|
+
|
|
15
|
+
export const solidRules = genRules(ruleNames, customRules, "solid");
|
|
@@ -1,19 +1,12 @@
|
|
|
1
1
|
/* eslint-disable */
|
|
2
2
|
import sonar from "eslint-plugin-sonarjs";
|
|
3
|
-
import { genRules } from "./gen-rules.
|
|
3
|
+
import { genRules, getNonDeprecatedRules } from "./gen-rules.ts";
|
|
4
4
|
|
|
5
|
-
const ruleNames = Object.keys(sonar.rules);
|
|
5
|
+
const ruleNames = Object.keys(getNonDeprecatedRules(sonar.rules));
|
|
6
6
|
const customRules = [
|
|
7
|
-
{ name: "aws-s3-bucket-server-encryption", rule: "off" },
|
|
8
7
|
{ name: "arrow-function-convention", rule: "off" },
|
|
9
|
-
{ name: "brace-style", rule: "off" },
|
|
10
|
-
{ name: "conditional-indentation", rule: "off" },
|
|
11
8
|
{ name: "comment-regex", rule: "off" },
|
|
12
|
-
{ name: "cookies", rule: "off" },
|
|
13
9
|
{ name: "cyclomatic-complexity", rule: "off" },
|
|
14
|
-
{ name: "dns-prefetching", rule: "off" },
|
|
15
|
-
{ name: "encryption", rule: "off" },
|
|
16
|
-
{ name: "enforce-trailing-comma", rule: "off" },
|
|
17
10
|
{ name: "file-header", rule: "off" },
|
|
18
11
|
{
|
|
19
12
|
name: "function-name",
|
|
@@ -27,26 +20,15 @@ const customRules = [
|
|
|
27
20
|
{ name: "function-return-type", rule: "off" },
|
|
28
21
|
{ name: "max-union-size", rule: "off" },
|
|
29
22
|
{ name: "new-cap", rule: "off" },
|
|
30
|
-
{ name: "no-extra-semi", rule: "off" },
|
|
31
23
|
{ name: "no-implicit-dependencies", rule: "off" },
|
|
32
24
|
{ name: "no-inconsistent-returns", rule: "off" },
|
|
33
|
-
{ name: "no-redundant-parentheses", rule: "off" },
|
|
34
25
|
{ name: "no-reference-error", rule: "off" }, // TODO bug: reports globals
|
|
35
|
-
{ name: "no-tab", rule: "off" },
|
|
36
26
|
{ name: "no-undefined-assignment", rule: "off" },
|
|
37
|
-
{ name: "process-argv", rule: "off" },
|
|
38
|
-
{ name: "regular-expr", rule: "off" },
|
|
39
|
-
{ name: "semi", rule: "off" },
|
|
40
27
|
{ name: "shorthand-property-grouping", rule: "off" }, // Conflicts with perfectionist sorting
|
|
41
|
-
{ name: "sockets", rule: "off" },
|
|
42
28
|
{ name: "sonar-no-fallthrough", rule: "off" }, // TODO readd with v9 compat?
|
|
43
29
|
{ name: "sonar-no-magic-numbers", rule: "off" },
|
|
44
|
-
{ name: "standard-input", rule: "off" },
|
|
45
30
|
{ name: "switch-without-default", rule: "off" }, // @typescript-eslint/switch-exhaustiveness-check works better
|
|
46
31
|
{ name: "todo-tag", rule: "off" },
|
|
47
|
-
{ name: "useless-string-operation", rule: "off" },
|
|
48
|
-
{ name: "web-sql-database", rule: "off" },
|
|
49
|
-
{ name: "xpath", rule: "off" },
|
|
50
32
|
];
|
|
51
33
|
|
|
52
34
|
const rules = genRules(ruleNames, customRules, "sonar");
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
/* eslint-disable */
|
|
2
2
|
import stylistic from "@stylistic/eslint-plugin";
|
|
3
|
-
import { genRules } from "./gen-rules.
|
|
3
|
+
import { genRules, getNonDeprecatedRules } from "./gen-rules.ts";
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
// @ts-expect-error this exists
|
|
6
|
+
const ruleNames = Object.keys(getNonDeprecatedRules(stylistic.rules));
|
|
6
7
|
const customRules = [
|
|
7
8
|
{ name: "array-bracket-newline", rule: ["error", "consistent"] },
|
|
8
9
|
{ name: "array-element-newline", rule: ["error", "consistent"] },
|
|
@@ -49,7 +50,6 @@ const customRules = [
|
|
|
49
50
|
},
|
|
50
51
|
],
|
|
51
52
|
},
|
|
52
|
-
{ name: "jsx-indent", rule: "off" },
|
|
53
53
|
{ name: "jsx-indent-props", rule: ["error", 2] },
|
|
54
54
|
{ name: "jsx-newline", rule: ["error", { prevent: true }] },
|
|
55
55
|
{ name: "jsx-sort-props", rule: "off" },
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/* eslint-disable */
|
|
2
2
|
import tailwind from "eslint-plugin-tailwindcss";
|
|
3
|
-
import { genRules } from "./gen-rules.
|
|
3
|
+
import { genRules, getNonDeprecatedRules } from "./gen-rules.ts";
|
|
4
4
|
|
|
5
|
-
const ruleNames = Object.keys(tailwind.rules);
|
|
5
|
+
const ruleNames = Object.keys(getNonDeprecatedRules(tailwind.rules ?? {}));
|
|
6
6
|
const customRules = [{ name: "no-custom-classname", rule: "off" }];
|
|
7
7
|
|
|
8
8
|
export const tailwindRules = genRules(ruleNames, customRules, "tailwind");
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import tanstack from "@tanstack/eslint-plugin-query";
|
|
2
|
+
|
|
3
|
+
import { genRules, getNonDeprecatedRules } from "./gen-rules.ts";
|
|
4
|
+
|
|
5
|
+
const ruleNames = Object.keys(getNonDeprecatedRules(tanstack.rules));
|
|
6
|
+
|
|
7
|
+
export const tanstackQueryRules = genRules(ruleNames, [], "@tanstack/query");
|