@dhzh/eslint-config 1.26.0 → 1.27.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/dist/chunk-CKQMccvm.cjs +28 -0
- package/dist/cli/index.cjs +139 -279
- package/dist/cli/index.d.cts +1 -2
- package/dist/cli/index.d.mts +1 -0
- package/dist/cli/index.mjs +269 -0
- package/dist/index.cjs +1398 -1800
- package/dist/index.d.cts +8617 -9986
- package/dist/{index.d.ts → index.d.mts} +8617 -9986
- package/dist/index.mjs +1417 -0
- package/package.json +3 -3
- package/dist/cli/index.d.ts +0 -2
- package/dist/cli/index.js +0 -391
- package/dist/index.js +0 -1812
package/dist/index.cjs
CHANGED
|
@@ -1,1849 +1,1447 @@
|
|
|
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
|
-
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_chunk = require("./chunk-CKQMccvm.cjs");
|
|
3
|
+
let _eslint_react_eslint_plugin = require("@eslint-react/eslint-plugin");
|
|
4
|
+
_eslint_react_eslint_plugin = require_chunk.__toESM(_eslint_react_eslint_plugin, 1);
|
|
5
|
+
let eslint_plugin_react_hooks = require("eslint-plugin-react-hooks");
|
|
6
|
+
eslint_plugin_react_hooks = require_chunk.__toESM(eslint_plugin_react_hooks, 1);
|
|
7
|
+
let eslint_plugin_react_refresh = require("eslint-plugin-react-refresh");
|
|
8
|
+
eslint_plugin_react_refresh = require_chunk.__toESM(eslint_plugin_react_refresh, 1);
|
|
9
|
+
let eslint_plugin_react_compiler = require("eslint-plugin-react-compiler");
|
|
10
|
+
eslint_plugin_react_compiler = require_chunk.__toESM(eslint_plugin_react_compiler, 1);
|
|
11
|
+
let eslint_plugin_react_google_translate = require("eslint-plugin-react-google-translate");
|
|
12
|
+
eslint_plugin_react_google_translate = require_chunk.__toESM(eslint_plugin_react_google_translate, 1);
|
|
13
|
+
let local_pkg = require("local-pkg");
|
|
14
|
+
let eslint_config = require("eslint/config");
|
|
15
|
+
let _eslint_js = require("@eslint/js");
|
|
16
|
+
_eslint_js = require_chunk.__toESM(_eslint_js, 1);
|
|
17
|
+
let typescript_eslint = require("typescript-eslint");
|
|
18
|
+
typescript_eslint = require_chunk.__toESM(typescript_eslint, 1);
|
|
19
|
+
let eslint_plugin_vue = require("eslint-plugin-vue");
|
|
20
|
+
eslint_plugin_vue = require_chunk.__toESM(eslint_plugin_vue, 1);
|
|
21
|
+
let globals = require("globals");
|
|
22
|
+
globals = require_chunk.__toESM(globals, 1);
|
|
23
|
+
let eslint_merge_processors = require("eslint-merge-processors");
|
|
24
|
+
let eslint_processor_vue_blocks = require("eslint-processor-vue-blocks");
|
|
25
|
+
eslint_processor_vue_blocks = require_chunk.__toESM(eslint_processor_vue_blocks, 1);
|
|
26
|
+
let _stylistic_eslint_plugin = require("@stylistic/eslint-plugin");
|
|
27
|
+
_stylistic_eslint_plugin = require_chunk.__toESM(_stylistic_eslint_plugin, 1);
|
|
28
|
+
let eslint_plugin_antfu = require("eslint-plugin-antfu");
|
|
29
|
+
eslint_plugin_antfu = require_chunk.__toESM(eslint_plugin_antfu, 1);
|
|
30
|
+
let node_process = require("node:process");
|
|
31
|
+
node_process = require_chunk.__toESM(node_process, 1);
|
|
32
|
+
let eslint_plugin_n = require("eslint-plugin-n");
|
|
33
|
+
eslint_plugin_n = require_chunk.__toESM(eslint_plugin_n, 1);
|
|
34
|
+
let eslint_plugin_jsonc = require("eslint-plugin-jsonc");
|
|
35
|
+
eslint_plugin_jsonc = require_chunk.__toESM(eslint_plugin_jsonc, 1);
|
|
36
|
+
let eslint_plugin_package_json = require("eslint-plugin-package-json");
|
|
37
|
+
eslint_plugin_package_json = require_chunk.__toESM(eslint_plugin_package_json, 1);
|
|
38
|
+
let eslint_plugin_unicorn = require("eslint-plugin-unicorn");
|
|
39
|
+
eslint_plugin_unicorn = require_chunk.__toESM(eslint_plugin_unicorn, 1);
|
|
40
|
+
let eslint_plugin_import_x = require("eslint-plugin-import-x");
|
|
41
|
+
eslint_plugin_import_x = require_chunk.__toESM(eslint_plugin_import_x, 1);
|
|
42
|
+
let eslint_plugin_unused_imports = require("eslint-plugin-unused-imports");
|
|
43
|
+
eslint_plugin_unused_imports = require_chunk.__toESM(eslint_plugin_unused_imports, 1);
|
|
44
|
+
let eslint_plugin_simple_import_sort = require("eslint-plugin-simple-import-sort");
|
|
45
|
+
eslint_plugin_simple_import_sort = require_chunk.__toESM(eslint_plugin_simple_import_sort, 1);
|
|
46
|
+
let eslint_plugin_format = require("eslint-plugin-format");
|
|
47
|
+
eslint_plugin_format = require_chunk.__toESM(eslint_plugin_format, 1);
|
|
48
|
+
let eslint_plugin_tailwindcss = require("eslint-plugin-tailwindcss");
|
|
49
|
+
eslint_plugin_tailwindcss = require_chunk.__toESM(eslint_plugin_tailwindcss, 1);
|
|
50
|
+
let _unocss_eslint_config_flat = require("@unocss/eslint-config/flat");
|
|
51
|
+
_unocss_eslint_config_flat = require_chunk.__toESM(_unocss_eslint_config_flat, 1);
|
|
52
|
+
let eslint_plugin_yml = require("eslint-plugin-yml");
|
|
53
|
+
eslint_plugin_yml = require_chunk.__toESM(eslint_plugin_yml, 1);
|
|
54
|
+
let eslint_plugin_toml = require("eslint-plugin-toml");
|
|
55
|
+
eslint_plugin_toml = require_chunk.__toESM(eslint_plugin_toml, 1);
|
|
56
|
+
let toml_eslint_parser = require("toml-eslint-parser");
|
|
57
|
+
toml_eslint_parser = require_chunk.__toESM(toml_eslint_parser, 1);
|
|
58
|
+
let eslint_plugin_regexp = require("eslint-plugin-regexp");
|
|
59
|
+
eslint_plugin_regexp = require_chunk.__toESM(eslint_plugin_regexp, 1);
|
|
60
|
+
let _eslint_community_eslint_plugin_eslint_comments_configs = require("@eslint-community/eslint-plugin-eslint-comments/configs");
|
|
61
|
+
_eslint_community_eslint_plugin_eslint_comments_configs = require_chunk.__toESM(_eslint_community_eslint_plugin_eslint_comments_configs, 1);
|
|
62
|
+
//#region src/consts.ts
|
|
63
|
+
const RULE_PREFIX = "tinywaves";
|
|
64
|
+
const GLOB_YML = "**/*.y?(a)ml";
|
|
65
|
+
const GLOB_TOML = "**/*.toml";
|
|
66
|
+
const GLOB_JSON = "**/*.json";
|
|
67
|
+
const GLOB_JSON5 = "**/*.json5";
|
|
68
|
+
const GLOB_JSONC = "**/*.jsonc";
|
|
69
|
+
const GLOB_PACKAGE_JSON = "**/package.json";
|
|
70
|
+
const GLOB_HTML = "**/*.htm?(l)";
|
|
71
|
+
const GLOB_CSS = "**/*.css";
|
|
72
|
+
const GLOB_POSTCSS = "**/*.{p,post}css";
|
|
73
|
+
const GLOB_LESS = "**/*.less";
|
|
74
|
+
const GLOB_SCSS = "**/*.scss";
|
|
75
|
+
const GLOB_GRAPHQL = "**/*.{g,graph}ql";
|
|
76
|
+
const GLOB_XML = "**/*.xml";
|
|
77
|
+
const GLOB_SVG = "**/*.svg";
|
|
78
|
+
const GLOB_VUE = "**/*.vue";
|
|
79
|
+
const GLOB_JSON_SRC = [
|
|
80
|
+
GLOB_JSON,
|
|
81
|
+
GLOB_JSON5,
|
|
82
|
+
GLOB_JSONC,
|
|
83
|
+
GLOB_PACKAGE_JSON
|
|
68
84
|
];
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
85
|
+
const GLOB_TS_SRC = [
|
|
86
|
+
"**/*.cts",
|
|
87
|
+
"**/*.mts",
|
|
88
|
+
"**/*.ts",
|
|
89
|
+
"**/*.tsx"
|
|
74
90
|
];
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
91
|
+
const GLOB_JS_SRC = [
|
|
92
|
+
"**/*.cjs",
|
|
93
|
+
"**/*.mjs",
|
|
94
|
+
"**/*.js",
|
|
95
|
+
"**/*.jsx"
|
|
80
96
|
];
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
var GLOB_TESTS = GLOB_SRC_EXT.flatMap((item) => [
|
|
91
|
-
`**/__tests__/**/*.${item}`,
|
|
92
|
-
`**/*.spec.${item}`,
|
|
93
|
-
`**/*.test.${item}`,
|
|
94
|
-
`**/*.bench.${item}`,
|
|
95
|
-
`**/*.benchmark.${item}`
|
|
97
|
+
const GLOB_JSX_SRC = ["**/*.jsx", "**/*.tsx"];
|
|
98
|
+
const GLOB_SRC = [...GLOB_TS_SRC, ...GLOB_JS_SRC];
|
|
99
|
+
const GLOB_SRC_EXT = GLOB_SRC.map((item) => item.replace("**/*.", ""));
|
|
100
|
+
GLOB_SRC_EXT.flatMap((item) => [
|
|
101
|
+
`**/__tests__/**/*.${item}`,
|
|
102
|
+
`**/*.spec.${item}`,
|
|
103
|
+
`**/*.test.${item}`,
|
|
104
|
+
`**/*.bench.${item}`,
|
|
105
|
+
`**/*.benchmark.${item}`
|
|
96
106
|
]);
|
|
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
|
-
|
|
107
|
+
const GLOB_EXCLUDE = [
|
|
108
|
+
"**/node_modules",
|
|
109
|
+
"**/dist",
|
|
110
|
+
"**/package-lock.json",
|
|
111
|
+
"**/yarn.lock",
|
|
112
|
+
"**/pnpm-lock.yaml",
|
|
113
|
+
"**/bun.lockb",
|
|
114
|
+
"**/output",
|
|
115
|
+
"**/coverage",
|
|
116
|
+
"**/temp",
|
|
117
|
+
"**/.temp",
|
|
118
|
+
"**/tmp",
|
|
119
|
+
"**/.tmp",
|
|
120
|
+
"**/.history",
|
|
121
|
+
"**/.vitepress/cache",
|
|
122
|
+
"**/.nuxt",
|
|
123
|
+
"**/.next",
|
|
124
|
+
"**/.svelte-kit",
|
|
125
|
+
"**/.vercel",
|
|
126
|
+
"**/.changeset",
|
|
127
|
+
"**/.idea",
|
|
128
|
+
"**/.cache",
|
|
129
|
+
"**/.output",
|
|
130
|
+
"**/.vite-inspect",
|
|
131
|
+
"**/.yarn",
|
|
132
|
+
"**/vite.config.*.timestamp-*",
|
|
133
|
+
"**/CHANGELOG*.md",
|
|
134
|
+
"**/*.min.*",
|
|
135
|
+
"**/LICENSE*",
|
|
136
|
+
"**/__snapshots__",
|
|
137
|
+
"**/auto-import?(s).d.ts",
|
|
138
|
+
"**/components.d.ts"
|
|
129
139
|
];
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
isPlain: true
|
|
151
|
-
},
|
|
152
|
-
visitorKeys: {
|
|
153
|
-
Program: []
|
|
154
|
-
}
|
|
155
|
-
})
|
|
140
|
+
//#endregion
|
|
141
|
+
//#region src/utils.ts
|
|
142
|
+
const parserPlain = {
|
|
143
|
+
meta: { name: "parser-plain" },
|
|
144
|
+
parseForESLint: (code) => ({
|
|
145
|
+
ast: {
|
|
146
|
+
body: [],
|
|
147
|
+
comments: [],
|
|
148
|
+
loc: {
|
|
149
|
+
end: code.length,
|
|
150
|
+
start: 0
|
|
151
|
+
},
|
|
152
|
+
range: [0, code.length],
|
|
153
|
+
tokens: [],
|
|
154
|
+
type: "Program"
|
|
155
|
+
},
|
|
156
|
+
scopeManager: null,
|
|
157
|
+
services: { isPlain: true },
|
|
158
|
+
visitorKeys: { Program: [] }
|
|
159
|
+
})
|
|
156
160
|
};
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
if (Object.keys(finalOptions).length === 0) {
|
|
178
|
-
return finalLevel;
|
|
179
|
-
}
|
|
180
|
-
return [finalLevel, finalOptions];
|
|
161
|
+
const mergeRule = (...rules) => {
|
|
162
|
+
let finalLevel;
|
|
163
|
+
let finalOptions = {};
|
|
164
|
+
for (const rule of rules) {
|
|
165
|
+
if (!rule) continue;
|
|
166
|
+
if (!Array.isArray(rule)) {
|
|
167
|
+
finalLevel = rule;
|
|
168
|
+
continue;
|
|
169
|
+
}
|
|
170
|
+
const [level, options] = rule;
|
|
171
|
+
finalLevel = level;
|
|
172
|
+
if (options && typeof options === "object") finalOptions = {
|
|
173
|
+
...finalOptions,
|
|
174
|
+
...options
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
if (Object.keys(finalOptions).length === 0) return finalLevel;
|
|
178
|
+
return [finalLevel, finalOptions];
|
|
181
179
|
};
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
180
|
+
//#endregion
|
|
181
|
+
//#region src/configs/react.ts
|
|
182
|
+
const ReactRefreshAllowConstantExportPackages = ["vite"];
|
|
183
|
+
const RemixPackages = [
|
|
184
|
+
"@remix-run/node",
|
|
185
|
+
"@remix-run/react",
|
|
186
|
+
"@remix-run/serve",
|
|
187
|
+
"@remix-run/dev"
|
|
190
188
|
];
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
189
|
+
const ReactRouterPackages = [
|
|
190
|
+
"@react-router/node",
|
|
191
|
+
"@react-router/react",
|
|
192
|
+
"@react-router/serve",
|
|
193
|
+
"@react-router/dev"
|
|
196
194
|
];
|
|
197
|
-
|
|
198
|
-
|
|
195
|
+
const NextJsPackages = ["next"];
|
|
196
|
+
const ExpoPackages = ["expo"];
|
|
199
197
|
function react(options = {}) {
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
{
|
|
308
|
-
name: `${RULE_PREFIX}/react/compiler/customize`,
|
|
309
|
-
files: GLOB_SRC,
|
|
310
|
-
rules: overrides.compiler || {}
|
|
311
|
-
},
|
|
312
|
-
{
|
|
313
|
-
name: `${RULE_PREFIX}/react/google-translate`,
|
|
314
|
-
files: GLOB_JSX_SRC,
|
|
315
|
-
plugins: {
|
|
316
|
-
"react-google-translate": import_eslint_plugin_react_google_translate.default
|
|
317
|
-
},
|
|
318
|
-
rules: {
|
|
319
|
-
"react-google-translate/no-conditional-text-nodes-with-siblings": "warn",
|
|
320
|
-
"react-google-translate/no-return-text-nodes": "warn",
|
|
321
|
-
...overrides.googleTranslate
|
|
322
|
-
}
|
|
323
|
-
}
|
|
324
|
-
];
|
|
198
|
+
const { language = "typescript", overrides = {
|
|
199
|
+
compiler: {},
|
|
200
|
+
core: {},
|
|
201
|
+
hooks: {},
|
|
202
|
+
refresh: {},
|
|
203
|
+
googleTranslate: {}
|
|
204
|
+
} } = options;
|
|
205
|
+
const config = language === "typescript" ? _eslint_react_eslint_plugin.default.configs["recommended-type-checked"] : _eslint_react_eslint_plugin.default.configs.recommended;
|
|
206
|
+
const isAllowConstantExport = ReactRefreshAllowConstantExportPackages.some((i) => (0, local_pkg.isPackageExists)(i));
|
|
207
|
+
const isUsingRemix = RemixPackages.some((i) => (0, local_pkg.isPackageExists)(i));
|
|
208
|
+
const isUsingReactRouter = ReactRouterPackages.some((i) => (0, local_pkg.isPackageExists)(i));
|
|
209
|
+
const isUsingNext = NextJsPackages.some((i) => (0, local_pkg.isPackageExists)(i));
|
|
210
|
+
const isUsingExpo = ExpoPackages.some((i) => (0, local_pkg.isPackageExists)(i));
|
|
211
|
+
return [
|
|
212
|
+
{
|
|
213
|
+
...config,
|
|
214
|
+
name: `${RULE_PREFIX}/react/core/shared`,
|
|
215
|
+
files: GLOB_SRC
|
|
216
|
+
},
|
|
217
|
+
{
|
|
218
|
+
name: `${RULE_PREFIX}/react/core/customize`,
|
|
219
|
+
files: GLOB_SRC,
|
|
220
|
+
rules: {
|
|
221
|
+
"@eslint-react/no-missing-context-display-name": "warn",
|
|
222
|
+
"@eslint-react/no-missing-component-display-name": "off",
|
|
223
|
+
"@eslint-react/dom-no-hydrate": "error",
|
|
224
|
+
"@eslint-react/jsx-no-useless-fragment": ["warn", {
|
|
225
|
+
allowEmptyFragment: true,
|
|
226
|
+
allowExpressions: true
|
|
227
|
+
}],
|
|
228
|
+
"@eslint-react/no-unnecessary-use-prefix": "warn",
|
|
229
|
+
"@eslint-react/naming-convention-context-name": "warn",
|
|
230
|
+
...language === "typescript" ? { "@eslint-react/no-leaked-conditional-rendering": "warn" } : {},
|
|
231
|
+
...overrides.core
|
|
232
|
+
}
|
|
233
|
+
},
|
|
234
|
+
...(0, eslint_config.defineConfig)([eslint_plugin_react_hooks.default.configs.flat["recommended-latest"]]).map((item) => ({
|
|
235
|
+
...item,
|
|
236
|
+
name: `${RULE_PREFIX}/react/hooks/shared`,
|
|
237
|
+
files: GLOB_SRC
|
|
238
|
+
})),
|
|
239
|
+
{
|
|
240
|
+
name: `${RULE_PREFIX}/react/hooks/customize`,
|
|
241
|
+
files: GLOB_SRC,
|
|
242
|
+
rules: overrides.hooks || {}
|
|
243
|
+
},
|
|
244
|
+
{
|
|
245
|
+
...eslint_plugin_react_refresh.default.configs.recommended,
|
|
246
|
+
name: `${RULE_PREFIX}/react/refresh/shared`,
|
|
247
|
+
files: GLOB_JSX_SRC
|
|
248
|
+
},
|
|
249
|
+
{
|
|
250
|
+
name: `${RULE_PREFIX}/react/refresh/customize`,
|
|
251
|
+
files: GLOB_JSX_SRC,
|
|
252
|
+
rules: {
|
|
253
|
+
"react-refresh/only-export-components": mergeRule(["warn", { allowConstantExport: isAllowConstantExport }], ["warn", { allowExportNames: [
|
|
254
|
+
...isUsingNext ? [
|
|
255
|
+
"dynamic",
|
|
256
|
+
"dynamicParams",
|
|
257
|
+
"revalidate",
|
|
258
|
+
"fetchCache",
|
|
259
|
+
"runtime",
|
|
260
|
+
"preferredRegion",
|
|
261
|
+
"maxDuration",
|
|
262
|
+
"config",
|
|
263
|
+
"generateMetadata",
|
|
264
|
+
"generateViewport",
|
|
265
|
+
"experimental_ppr",
|
|
266
|
+
"metadata",
|
|
267
|
+
"viewport",
|
|
268
|
+
"generateImageMetadata",
|
|
269
|
+
"generateSitemaps",
|
|
270
|
+
"generateStaticParams"
|
|
271
|
+
] : [],
|
|
272
|
+
...isUsingRemix || isUsingReactRouter ? [
|
|
273
|
+
"meta",
|
|
274
|
+
"links",
|
|
275
|
+
"headers",
|
|
276
|
+
"loader",
|
|
277
|
+
"action"
|
|
278
|
+
] : [],
|
|
279
|
+
...isUsingExpo ? ["unstable_settings"] : []
|
|
280
|
+
] }]),
|
|
281
|
+
...overrides.refresh
|
|
282
|
+
}
|
|
283
|
+
},
|
|
284
|
+
{
|
|
285
|
+
...eslint_plugin_react_compiler.default.configs.recommended,
|
|
286
|
+
name: `${RULE_PREFIX}/react/compiler/shared`,
|
|
287
|
+
files: GLOB_SRC
|
|
288
|
+
},
|
|
289
|
+
{
|
|
290
|
+
name: `${RULE_PREFIX}/react/compiler/customize`,
|
|
291
|
+
files: GLOB_SRC,
|
|
292
|
+
rules: overrides.compiler || {}
|
|
293
|
+
},
|
|
294
|
+
{
|
|
295
|
+
name: `${RULE_PREFIX}/react/google-translate`,
|
|
296
|
+
files: GLOB_JSX_SRC,
|
|
297
|
+
plugins: { "react-google-translate": eslint_plugin_react_google_translate.default },
|
|
298
|
+
rules: {
|
|
299
|
+
"react-google-translate/no-conditional-text-nodes-with-siblings": "warn",
|
|
300
|
+
"react-google-translate/no-return-text-nodes": "warn",
|
|
301
|
+
...overrides.googleTranslate
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
];
|
|
325
305
|
}
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
var import_config2 = require("eslint/config");
|
|
329
|
-
var import_js = __toESM(require("@eslint/js"), 1);
|
|
330
|
-
var import_typescript_eslint = __toESM(require("typescript-eslint"), 1);
|
|
331
|
-
var import_eslint_plugin_vue = __toESM(require("eslint-plugin-vue"), 1);
|
|
332
|
-
var import_globals = __toESM(require("globals"), 1);
|
|
333
|
-
var import_eslint_merge_processors = require("eslint-merge-processors");
|
|
334
|
-
var import_eslint_processor_vue_blocks = __toESM(require("eslint-processor-vue-blocks"), 1);
|
|
306
|
+
//#endregion
|
|
307
|
+
//#region src/configs/vue.ts
|
|
335
308
|
function vue(options = {}) {
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
(0, import_eslint_processor_vue_blocks.default)({
|
|
367
|
-
blocks: {
|
|
368
|
-
styles: true,
|
|
369
|
-
customBlocks: true,
|
|
370
|
-
script: false,
|
|
371
|
-
template: false
|
|
372
|
-
}
|
|
373
|
-
})
|
|
374
|
-
]),
|
|
375
|
-
rules: overrides
|
|
376
|
-
}
|
|
377
|
-
);
|
|
309
|
+
const { overrides = {} } = options;
|
|
310
|
+
return (0, eslint_config.defineConfig)({
|
|
311
|
+
..._eslint_js.default.configs.recommended,
|
|
312
|
+
name: `${RULE_PREFIX}/vue/shared/javascript`,
|
|
313
|
+
files: [GLOB_VUE]
|
|
314
|
+
}, typescript_eslint.default.configs.recommended.map((item) => ({
|
|
315
|
+
...item,
|
|
316
|
+
name: `${RULE_PREFIX}/vue/shared/typescript/${item.name?.replace("typescript-eslint/", "")}`,
|
|
317
|
+
files: [GLOB_VUE]
|
|
318
|
+
})), eslint_plugin_vue.default.configs["flat/recommended"].map((item) => ({
|
|
319
|
+
...item,
|
|
320
|
+
name: `${RULE_PREFIX}/vue/shared/${item.name?.replace("vue/", "")}`,
|
|
321
|
+
files: [GLOB_VUE]
|
|
322
|
+
})), {
|
|
323
|
+
name: `${RULE_PREFIX}/vue/customize`,
|
|
324
|
+
files: [GLOB_VUE],
|
|
325
|
+
languageOptions: {
|
|
326
|
+
ecmaVersion: "latest",
|
|
327
|
+
sourceType: "module",
|
|
328
|
+
globals: globals.default.browser,
|
|
329
|
+
parserOptions: { parser: typescript_eslint.default.parser }
|
|
330
|
+
},
|
|
331
|
+
processor: (0, eslint_merge_processors.mergeProcessors)([eslint_plugin_vue.default.processors[".vue"], (0, eslint_processor_vue_blocks.default)({ blocks: {
|
|
332
|
+
styles: true,
|
|
333
|
+
customBlocks: true,
|
|
334
|
+
script: false,
|
|
335
|
+
template: false
|
|
336
|
+
} })]),
|
|
337
|
+
rules: overrides
|
|
338
|
+
});
|
|
378
339
|
}
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
var import_eslint_plugin2 = __toESM(require("@stylistic/eslint-plugin"), 1);
|
|
382
|
-
var import_eslint_plugin_antfu = __toESM(require("eslint-plugin-antfu"), 1);
|
|
340
|
+
//#endregion
|
|
341
|
+
//#region src/configs/stylistic.ts
|
|
383
342
|
function stylistic(options = {}) {
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
"stylistic/jsx-closing-tag-location": ["error", "tag-aligned"],
|
|
574
|
-
"stylistic/jsx-curly-brace-presence": [
|
|
575
|
-
"error",
|
|
576
|
-
{
|
|
577
|
-
props: "never",
|
|
578
|
-
children: "never",
|
|
579
|
-
propElementValues: "always"
|
|
580
|
-
}
|
|
581
|
-
],
|
|
582
|
-
"stylistic/jsx-curly-newline": [
|
|
583
|
-
"error",
|
|
584
|
-
{
|
|
585
|
-
singleline: "consistent",
|
|
586
|
-
multiline: "consistent"
|
|
587
|
-
}
|
|
588
|
-
],
|
|
589
|
-
"stylistic/jsx-curly-spacing": [
|
|
590
|
-
"error",
|
|
591
|
-
{
|
|
592
|
-
when: "never",
|
|
593
|
-
attributes: {
|
|
594
|
-
when: "never"
|
|
595
|
-
},
|
|
596
|
-
children: {
|
|
597
|
-
when: "never"
|
|
598
|
-
}
|
|
599
|
-
}
|
|
600
|
-
],
|
|
601
|
-
"stylistic/jsx-first-prop-new-line": ["error", "multiline"],
|
|
602
|
-
"stylistic/jsx-one-expression-per-line": [
|
|
603
|
-
"error",
|
|
604
|
-
{
|
|
605
|
-
allow: "non-jsx"
|
|
606
|
-
}
|
|
607
|
-
],
|
|
608
|
-
"stylistic/jsx-pascal-case": [
|
|
609
|
-
"error",
|
|
610
|
-
{
|
|
611
|
-
allowAllCaps: false,
|
|
612
|
-
allowLeadingUnderscore: false,
|
|
613
|
-
allowNamespace: true
|
|
614
|
-
}
|
|
615
|
-
],
|
|
616
|
-
"stylistic/jsx-props-no-multi-spaces": "error",
|
|
617
|
-
"stylistic/jsx-quotes": ["error", "prefer-double"],
|
|
618
|
-
"stylistic/jsx-self-closing-comp": [
|
|
619
|
-
"error",
|
|
620
|
-
{
|
|
621
|
-
component: true,
|
|
622
|
-
html: true
|
|
623
|
-
}
|
|
624
|
-
],
|
|
625
|
-
"stylistic/jsx-sort-props": "off",
|
|
626
|
-
"stylistic/jsx-indent-props": "off",
|
|
627
|
-
...overrides
|
|
628
|
-
}
|
|
629
|
-
}
|
|
630
|
-
];
|
|
343
|
+
const { overrides = {} } = options;
|
|
344
|
+
const jsxIgnoreNodes = [
|
|
345
|
+
"TemplateLiteral *",
|
|
346
|
+
"TSUnionType",
|
|
347
|
+
"TSIntersectionType",
|
|
348
|
+
"TSTypeParameterInstantiation",
|
|
349
|
+
"FunctionExpression > .params[decorators.length > 0]",
|
|
350
|
+
"FunctionExpression > .params > :matches(Decorator, :not(:first-child))"
|
|
351
|
+
];
|
|
352
|
+
const nonJsxIgnoreNodes = ["JSXOpeningElement", "JSXClosingElement"];
|
|
353
|
+
const basicIndentRuleOptions = {
|
|
354
|
+
ArrayExpression: 1,
|
|
355
|
+
CallExpression: { arguments: 1 },
|
|
356
|
+
flatTernaryExpressions: false,
|
|
357
|
+
FunctionDeclaration: {
|
|
358
|
+
body: 1,
|
|
359
|
+
parameters: 1
|
|
360
|
+
},
|
|
361
|
+
FunctionExpression: {
|
|
362
|
+
body: 1,
|
|
363
|
+
parameters: 1
|
|
364
|
+
},
|
|
365
|
+
ignoreComments: false,
|
|
366
|
+
ImportDeclaration: 1,
|
|
367
|
+
MemberExpression: 1,
|
|
368
|
+
ObjectExpression: 1,
|
|
369
|
+
offsetTernaryExpressions: true,
|
|
370
|
+
outerIIFEBody: 1,
|
|
371
|
+
SwitchCase: 1,
|
|
372
|
+
VariableDeclarator: 1
|
|
373
|
+
};
|
|
374
|
+
return [
|
|
375
|
+
{
|
|
376
|
+
..._stylistic_eslint_plugin.default.configs.customize({
|
|
377
|
+
arrowParens: true,
|
|
378
|
+
semi: true,
|
|
379
|
+
braceStyle: "1tbs"
|
|
380
|
+
}),
|
|
381
|
+
name: `${RULE_PREFIX}/stylistic/shared`,
|
|
382
|
+
files: [
|
|
383
|
+
...GLOB_SRC,
|
|
384
|
+
...GLOB_JSON_SRC,
|
|
385
|
+
GLOB_VUE
|
|
386
|
+
]
|
|
387
|
+
},
|
|
388
|
+
{
|
|
389
|
+
name: `${RULE_PREFIX}/stylistic/customize`,
|
|
390
|
+
files: [
|
|
391
|
+
...GLOB_SRC,
|
|
392
|
+
...GLOB_JSON_SRC,
|
|
393
|
+
GLOB_VUE
|
|
394
|
+
],
|
|
395
|
+
plugins: {
|
|
396
|
+
stylistic: _stylistic_eslint_plugin.default,
|
|
397
|
+
antfu: eslint_plugin_antfu.default
|
|
398
|
+
},
|
|
399
|
+
rules: {
|
|
400
|
+
"curly": ["error", "all"],
|
|
401
|
+
"object-shorthand": "error",
|
|
402
|
+
"prefer-destructuring": [
|
|
403
|
+
"error",
|
|
404
|
+
{
|
|
405
|
+
VariableDeclarator: {
|
|
406
|
+
array: false,
|
|
407
|
+
object: true
|
|
408
|
+
},
|
|
409
|
+
AssignmentExpression: {
|
|
410
|
+
array: false,
|
|
411
|
+
object: false
|
|
412
|
+
}
|
|
413
|
+
},
|
|
414
|
+
{ enforceForRenamedProperties: false }
|
|
415
|
+
],
|
|
416
|
+
"prefer-template": "error",
|
|
417
|
+
"stylistic/array-bracket-newline": ["error", { multiline: true }],
|
|
418
|
+
"stylistic/array-element-newline": ["error", "consistent"],
|
|
419
|
+
"stylistic/brace-style": [
|
|
420
|
+
"error",
|
|
421
|
+
"1tbs",
|
|
422
|
+
{ allowSingleLine: false }
|
|
423
|
+
],
|
|
424
|
+
"stylistic/function-call-spacing": ["error", "never"],
|
|
425
|
+
"stylistic/function-paren-newline": "off",
|
|
426
|
+
"stylistic/indent": [
|
|
427
|
+
"error",
|
|
428
|
+
2,
|
|
429
|
+
{
|
|
430
|
+
...basicIndentRuleOptions,
|
|
431
|
+
ignoredNodes: [...jsxIgnoreNodes, ...nonJsxIgnoreNodes]
|
|
432
|
+
}
|
|
433
|
+
],
|
|
434
|
+
"stylistic/key-spacing": ["error", {
|
|
435
|
+
beforeColon: false,
|
|
436
|
+
afterColon: true,
|
|
437
|
+
mode: "strict"
|
|
438
|
+
}],
|
|
439
|
+
"stylistic/keyword-spacing": ["error", {
|
|
440
|
+
before: true,
|
|
441
|
+
after: true
|
|
442
|
+
}],
|
|
443
|
+
"stylistic/line-comment-position": "off",
|
|
444
|
+
"stylistic/linebreak-style": ["error", "unix"],
|
|
445
|
+
"stylistic/lines-around-comment": "off",
|
|
446
|
+
"stylistic/new-parens": ["error", "always"],
|
|
447
|
+
"stylistic/no-confusing-arrow": ["error", {
|
|
448
|
+
allowParens: true,
|
|
449
|
+
onlyOneSimpleParam: true
|
|
450
|
+
}],
|
|
451
|
+
"stylistic/no-extra-semi": "error",
|
|
452
|
+
"stylistic/object-property-newline": ["error", { allowAllPropertiesOnSameLine: true }],
|
|
453
|
+
"stylistic/space-before-function-paren": ["error", {
|
|
454
|
+
named: "never",
|
|
455
|
+
anonymous: "always",
|
|
456
|
+
asyncArrow: "always",
|
|
457
|
+
catch: "always"
|
|
458
|
+
}],
|
|
459
|
+
"stylistic/switch-colon-spacing": ["error", {
|
|
460
|
+
after: true,
|
|
461
|
+
before: false
|
|
462
|
+
}],
|
|
463
|
+
"stylistic/type-annotation-spacing": "error",
|
|
464
|
+
"stylistic/wrap-regex": "error",
|
|
465
|
+
"stylistic/quotes": [
|
|
466
|
+
"error",
|
|
467
|
+
"single",
|
|
468
|
+
{
|
|
469
|
+
allowTemplateLiterals: true,
|
|
470
|
+
avoidEscape: true
|
|
471
|
+
}
|
|
472
|
+
],
|
|
473
|
+
"stylistic/no-tabs": "off",
|
|
474
|
+
"antfu/consistent-chaining": "error",
|
|
475
|
+
"antfu/consistent-list-newline": "error",
|
|
476
|
+
"antfu/top-level-function": "off",
|
|
477
|
+
"antfu/curly": "off",
|
|
478
|
+
...overrides
|
|
479
|
+
}
|
|
480
|
+
},
|
|
481
|
+
{
|
|
482
|
+
name: `${RULE_PREFIX}/stylistic/customize/jsx`,
|
|
483
|
+
files: [...GLOB_JSX_SRC, GLOB_VUE],
|
|
484
|
+
plugins: { stylistic: _stylistic_eslint_plugin.default },
|
|
485
|
+
rules: {
|
|
486
|
+
"stylistic/indent": [
|
|
487
|
+
"error",
|
|
488
|
+
2,
|
|
489
|
+
{
|
|
490
|
+
...basicIndentRuleOptions,
|
|
491
|
+
ignoredNodes: jsxIgnoreNodes
|
|
492
|
+
}
|
|
493
|
+
],
|
|
494
|
+
"stylistic/jsx-closing-bracket-location": ["error", {
|
|
495
|
+
nonEmpty: "tag-aligned",
|
|
496
|
+
selfClosing: "tag-aligned"
|
|
497
|
+
}],
|
|
498
|
+
"stylistic/jsx-closing-tag-location": ["error", "tag-aligned"],
|
|
499
|
+
"stylistic/jsx-curly-brace-presence": ["error", {
|
|
500
|
+
props: "never",
|
|
501
|
+
children: "never",
|
|
502
|
+
propElementValues: "always"
|
|
503
|
+
}],
|
|
504
|
+
"stylistic/jsx-curly-newline": ["error", {
|
|
505
|
+
singleline: "consistent",
|
|
506
|
+
multiline: "consistent"
|
|
507
|
+
}],
|
|
508
|
+
"stylistic/jsx-curly-spacing": ["error", {
|
|
509
|
+
when: "never",
|
|
510
|
+
attributes: { when: "never" },
|
|
511
|
+
children: { when: "never" }
|
|
512
|
+
}],
|
|
513
|
+
"stylistic/jsx-first-prop-new-line": ["error", "multiline"],
|
|
514
|
+
"stylistic/jsx-one-expression-per-line": ["error", { allow: "non-jsx" }],
|
|
515
|
+
"stylistic/jsx-pascal-case": ["error", {
|
|
516
|
+
allowAllCaps: false,
|
|
517
|
+
allowLeadingUnderscore: false,
|
|
518
|
+
allowNamespace: true
|
|
519
|
+
}],
|
|
520
|
+
"stylistic/jsx-props-no-multi-spaces": "error",
|
|
521
|
+
"stylistic/jsx-quotes": ["error", "prefer-double"],
|
|
522
|
+
"stylistic/jsx-self-closing-comp": ["error", {
|
|
523
|
+
component: true,
|
|
524
|
+
html: true
|
|
525
|
+
}],
|
|
526
|
+
"stylistic/jsx-sort-props": "off",
|
|
527
|
+
"stylistic/jsx-indent-props": "off",
|
|
528
|
+
...overrides
|
|
529
|
+
}
|
|
530
|
+
}
|
|
531
|
+
];
|
|
631
532
|
}
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
var import_node_process = __toESM(require("process"), 1);
|
|
635
|
-
var import_config3 = require("eslint/config");
|
|
636
|
-
var import_typescript_eslint2 = __toESM(require("typescript-eslint"), 1);
|
|
533
|
+
//#endregion
|
|
534
|
+
//#region src/configs/typescript.ts
|
|
637
535
|
function typescript(options = {}) {
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
arguments: false,
|
|
698
|
-
attributes: false
|
|
699
|
-
}
|
|
700
|
-
}
|
|
701
|
-
],
|
|
702
|
-
"@typescript-eslint/restrict-template-expressions": ["error", {}],
|
|
703
|
-
"@typescript-eslint/no-deprecated": "warn",
|
|
704
|
-
"@typescript-eslint/no-empty-function": "off",
|
|
705
|
-
"@typescript-eslint/consistent-type-definitions": "off",
|
|
706
|
-
"@typescript-eslint/array-type": [
|
|
707
|
-
"error",
|
|
708
|
-
{
|
|
709
|
-
default: "array-simple"
|
|
710
|
-
}
|
|
711
|
-
],
|
|
712
|
-
"@typescript-eslint/prefer-nullish-coalescing": "off",
|
|
713
|
-
"@typescript-eslint/no-confusing-void-expression": [
|
|
714
|
-
"error",
|
|
715
|
-
{
|
|
716
|
-
ignoreArrowShorthand: true
|
|
717
|
-
}
|
|
718
|
-
],
|
|
719
|
-
...typeSafe ? {} : {
|
|
720
|
-
"@typescript-eslint/no-unsafe-assignment": "off",
|
|
721
|
-
"@typescript-eslint/no-unsafe-member-access": "off",
|
|
722
|
-
"@typescript-eslint/no-unsafe-call": "off",
|
|
723
|
-
"@typescript-eslint/no-unsafe-return": "off",
|
|
724
|
-
"@typescript-eslint/no-unsafe-argument": "off"
|
|
725
|
-
},
|
|
726
|
-
...strict ? {} : {
|
|
727
|
-
"@typescript-eslint/no-extraneous-class": "off"
|
|
728
|
-
},
|
|
729
|
-
...overrides
|
|
730
|
-
}
|
|
731
|
-
}
|
|
732
|
-
];
|
|
536
|
+
const { overrides = {}, typeSafe = false, strict = false } = options;
|
|
537
|
+
return [...(0, eslint_config.defineConfig)(typescript_eslint.default.configs.base, typescript_eslint.default.configs.recommendedTypeChecked, typescript_eslint.default.configs.strictTypeChecked, typescript_eslint.default.configs.stylisticTypeChecked).map((item) => ({
|
|
538
|
+
...item,
|
|
539
|
+
name: `${RULE_PREFIX}/typescript/shared/${item.name?.replace("typescript-eslint/", "")}`,
|
|
540
|
+
files: GLOB_TS_SRC
|
|
541
|
+
})), {
|
|
542
|
+
name: `${RULE_PREFIX}/typescript/customize`,
|
|
543
|
+
files: GLOB_TS_SRC,
|
|
544
|
+
languageOptions: {
|
|
545
|
+
parserOptions: {
|
|
546
|
+
projectService: true,
|
|
547
|
+
tsconfigRootDir: node_process.default.cwd()
|
|
548
|
+
},
|
|
549
|
+
sourceType: "module"
|
|
550
|
+
},
|
|
551
|
+
rules: {
|
|
552
|
+
"@typescript-eslint/consistent-type-imports": ["error", { disallowTypeAnnotations: false }],
|
|
553
|
+
"@typescript-eslint/no-import-type-side-effects": "error",
|
|
554
|
+
"@typescript-eslint/method-signature-style": ["error", "property"],
|
|
555
|
+
"no-unused-expressions": "off",
|
|
556
|
+
"@typescript-eslint/no-unused-expressions": ["error", {
|
|
557
|
+
allowShortCircuit: true,
|
|
558
|
+
allowTernary: true
|
|
559
|
+
}],
|
|
560
|
+
"@typescript-eslint/no-dynamic-delete": "off",
|
|
561
|
+
"@typescript-eslint/no-empty-object-type": ["error", {
|
|
562
|
+
allowInterfaces: "with-single-extends",
|
|
563
|
+
allowObjectTypes: "never",
|
|
564
|
+
allowWithName: "Props$"
|
|
565
|
+
}],
|
|
566
|
+
"@typescript-eslint/no-non-null-assertion": "off",
|
|
567
|
+
"@typescript-eslint/ban-ts-comment": "off",
|
|
568
|
+
"@typescript-eslint/no-explicit-any": "off",
|
|
569
|
+
"@typescript-eslint/no-non-null-asserted-optional-chain": "warn",
|
|
570
|
+
"@typescript-eslint/await-thenable": "error",
|
|
571
|
+
"@typescript-eslint/no-floating-promises": "error",
|
|
572
|
+
"@typescript-eslint/consistent-type-exports": "error",
|
|
573
|
+
"@typescript-eslint/no-misused-promises": ["error", { checksVoidReturn: {
|
|
574
|
+
arguments: false,
|
|
575
|
+
attributes: false
|
|
576
|
+
} }],
|
|
577
|
+
"@typescript-eslint/restrict-template-expressions": ["error", {}],
|
|
578
|
+
"@typescript-eslint/no-deprecated": "warn",
|
|
579
|
+
"@typescript-eslint/no-empty-function": "off",
|
|
580
|
+
"@typescript-eslint/consistent-type-definitions": "off",
|
|
581
|
+
"@typescript-eslint/array-type": ["error", { default: "array-simple" }],
|
|
582
|
+
"@typescript-eslint/prefer-nullish-coalescing": "off",
|
|
583
|
+
"@typescript-eslint/no-confusing-void-expression": ["error", { ignoreArrowShorthand: true }],
|
|
584
|
+
...typeSafe ? {} : {
|
|
585
|
+
"@typescript-eslint/no-unsafe-assignment": "off",
|
|
586
|
+
"@typescript-eslint/no-unsafe-member-access": "off",
|
|
587
|
+
"@typescript-eslint/no-unsafe-call": "off",
|
|
588
|
+
"@typescript-eslint/no-unsafe-return": "off",
|
|
589
|
+
"@typescript-eslint/no-unsafe-argument": "off"
|
|
590
|
+
},
|
|
591
|
+
...strict ? {} : { "@typescript-eslint/no-extraneous-class": "off" },
|
|
592
|
+
...overrides
|
|
593
|
+
}
|
|
594
|
+
}];
|
|
733
595
|
}
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
var import_js2 = __toESM(require("@eslint/js"), 1);
|
|
737
|
-
var import_eslint_plugin_antfu2 = __toESM(require("eslint-plugin-antfu"), 1);
|
|
738
|
-
var import_globals2 = __toESM(require("globals"), 1);
|
|
596
|
+
//#endregion
|
|
597
|
+
//#region src/configs/javascript.ts
|
|
739
598
|
function javascript(options = {}) {
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
ignoreRestSiblings: true,
|
|
968
|
-
vars: "all"
|
|
969
|
-
}
|
|
970
|
-
],
|
|
971
|
-
"no-use-before-define": [
|
|
972
|
-
"error",
|
|
973
|
-
{
|
|
974
|
-
classes: false,
|
|
975
|
-
functions: false,
|
|
976
|
-
variables: true
|
|
977
|
-
}
|
|
978
|
-
],
|
|
979
|
-
"no-useless-backreference": "error",
|
|
980
|
-
"no-useless-call": "error",
|
|
981
|
-
"no-useless-catch": "error",
|
|
982
|
-
"no-useless-computed-key": "error",
|
|
983
|
-
"no-useless-constructor": "error",
|
|
984
|
-
"no-useless-rename": "error",
|
|
985
|
-
"no-useless-return": "error",
|
|
986
|
-
"no-var": "error",
|
|
987
|
-
"no-with": "error",
|
|
988
|
-
"object-shorthand": [
|
|
989
|
-
"error",
|
|
990
|
-
"always",
|
|
991
|
-
{
|
|
992
|
-
avoidQuotes: true,
|
|
993
|
-
ignoreConstructors: false
|
|
994
|
-
}
|
|
995
|
-
],
|
|
996
|
-
"one-var": [
|
|
997
|
-
"error",
|
|
998
|
-
{
|
|
999
|
-
initialized: "never"
|
|
1000
|
-
}
|
|
1001
|
-
],
|
|
1002
|
-
"prefer-arrow-callback": [
|
|
1003
|
-
"error",
|
|
1004
|
-
{
|
|
1005
|
-
allowNamedFunctions: false,
|
|
1006
|
-
allowUnboundThis: true
|
|
1007
|
-
}
|
|
1008
|
-
],
|
|
1009
|
-
"prefer-const": [
|
|
1010
|
-
"error",
|
|
1011
|
-
{
|
|
1012
|
-
destructuring: "all",
|
|
1013
|
-
ignoreReadBeforeAssign: true
|
|
1014
|
-
}
|
|
1015
|
-
],
|
|
1016
|
-
"prefer-exponentiation-operator": "error",
|
|
1017
|
-
"prefer-promise-reject-errors": "error",
|
|
1018
|
-
"prefer-regex-literals": [
|
|
1019
|
-
"error",
|
|
1020
|
-
{
|
|
1021
|
-
disallowRedundantWrapping: true
|
|
1022
|
-
}
|
|
1023
|
-
],
|
|
1024
|
-
"prefer-rest-params": "error",
|
|
1025
|
-
"prefer-spread": "error",
|
|
1026
|
-
"prefer-template": "error",
|
|
1027
|
-
"symbol-description": "error",
|
|
1028
|
-
"unicode-bom": ["error", "never"],
|
|
1029
|
-
"use-isnan": [
|
|
1030
|
-
"error",
|
|
1031
|
-
{
|
|
1032
|
-
enforceForIndexOf: true,
|
|
1033
|
-
enforceForSwitchCase: true
|
|
1034
|
-
}
|
|
1035
|
-
],
|
|
1036
|
-
"valid-typeof": [
|
|
1037
|
-
"error",
|
|
1038
|
-
{
|
|
1039
|
-
requireStringLiterals: true
|
|
1040
|
-
}
|
|
1041
|
-
],
|
|
1042
|
-
"vars-on-top": "error",
|
|
1043
|
-
"yoda": ["error", "never"],
|
|
1044
|
-
...overrides
|
|
1045
|
-
}
|
|
1046
|
-
}
|
|
1047
|
-
];
|
|
599
|
+
const { overrides = {} } = options;
|
|
600
|
+
return [{
|
|
601
|
+
name: `${RULE_PREFIX}/javascript/shared`,
|
|
602
|
+
files: GLOB_SRC,
|
|
603
|
+
languageOptions: {
|
|
604
|
+
ecmaVersion: 2022,
|
|
605
|
+
globals: {
|
|
606
|
+
...globals.default.browser,
|
|
607
|
+
...globals.default.es2021,
|
|
608
|
+
...globals.default.node,
|
|
609
|
+
document: "readonly",
|
|
610
|
+
navigator: "readonly",
|
|
611
|
+
window: "readonly"
|
|
612
|
+
},
|
|
613
|
+
parserOptions: {
|
|
614
|
+
ecmaFeatures: { jsx: true },
|
|
615
|
+
ecmaVersion: 2022,
|
|
616
|
+
sourceType: "module"
|
|
617
|
+
},
|
|
618
|
+
sourceType: "module"
|
|
619
|
+
},
|
|
620
|
+
linterOptions: { reportUnusedDisableDirectives: true },
|
|
621
|
+
rules: _eslint_js.default.configs.recommended.rules
|
|
622
|
+
}, {
|
|
623
|
+
name: `${RULE_PREFIX}/javascript/customize`,
|
|
624
|
+
files: GLOB_SRC,
|
|
625
|
+
plugins: { antfu: eslint_plugin_antfu.default },
|
|
626
|
+
rules: {
|
|
627
|
+
"arrow-body-style": ["error", "as-needed"],
|
|
628
|
+
"func-style": [
|
|
629
|
+
"warn",
|
|
630
|
+
"declaration",
|
|
631
|
+
{ allowArrowFunctions: true }
|
|
632
|
+
],
|
|
633
|
+
"no-empty-function": "off",
|
|
634
|
+
"prefer-destructuring": "off",
|
|
635
|
+
"capitalized-comments": "off",
|
|
636
|
+
"id-length": "off",
|
|
637
|
+
"accessor-pairs": ["error", {
|
|
638
|
+
enforceForClassMembers: true,
|
|
639
|
+
setWithoutGet: true
|
|
640
|
+
}],
|
|
641
|
+
"antfu/no-top-level-await": "error",
|
|
642
|
+
"array-callback-return": "error",
|
|
643
|
+
"block-scoped-var": "error",
|
|
644
|
+
"constructor-super": "error",
|
|
645
|
+
"default-case-last": "error",
|
|
646
|
+
"dot-notation": ["error", { allowKeywords: true }],
|
|
647
|
+
"eqeqeq": ["error", "smart"],
|
|
648
|
+
"new-cap": ["error", {
|
|
649
|
+
capIsNew: false,
|
|
650
|
+
newIsCap: true,
|
|
651
|
+
properties: true
|
|
652
|
+
}],
|
|
653
|
+
"no-alert": "error",
|
|
654
|
+
"no-array-constructor": "error",
|
|
655
|
+
"no-async-promise-executor": "error",
|
|
656
|
+
"no-caller": "error",
|
|
657
|
+
"no-case-declarations": "error",
|
|
658
|
+
"no-class-assign": "error",
|
|
659
|
+
"no-compare-neg-zero": "error",
|
|
660
|
+
"no-cond-assign": ["error", "always"],
|
|
661
|
+
"no-console": ["error", { allow: [
|
|
662
|
+
"warn",
|
|
663
|
+
"error",
|
|
664
|
+
"info"
|
|
665
|
+
] }],
|
|
666
|
+
"no-const-assign": "error",
|
|
667
|
+
"no-control-regex": "error",
|
|
668
|
+
"no-debugger": "error",
|
|
669
|
+
"no-delete-var": "error",
|
|
670
|
+
"no-dupe-args": "error",
|
|
671
|
+
"no-dupe-class-members": "error",
|
|
672
|
+
"no-dupe-keys": "error",
|
|
673
|
+
"no-duplicate-case": "error",
|
|
674
|
+
"no-empty": ["error", { allowEmptyCatch: true }],
|
|
675
|
+
"no-empty-character-class": "error",
|
|
676
|
+
"no-empty-pattern": "error",
|
|
677
|
+
"no-eval": "error",
|
|
678
|
+
"no-ex-assign": "error",
|
|
679
|
+
"no-extend-native": "error",
|
|
680
|
+
"no-extra-bind": "error",
|
|
681
|
+
"no-extra-boolean-cast": "error",
|
|
682
|
+
"no-fallthrough": "error",
|
|
683
|
+
"no-func-assign": "error",
|
|
684
|
+
"no-global-assign": "error",
|
|
685
|
+
"no-implied-eval": "error",
|
|
686
|
+
"no-import-assign": "error",
|
|
687
|
+
"no-invalid-regexp": "error",
|
|
688
|
+
"no-irregular-whitespace": "error",
|
|
689
|
+
"no-iterator": "error",
|
|
690
|
+
"no-labels": ["error", {
|
|
691
|
+
allowLoop: false,
|
|
692
|
+
allowSwitch: false
|
|
693
|
+
}],
|
|
694
|
+
"no-lone-blocks": "error",
|
|
695
|
+
"no-loss-of-precision": "error",
|
|
696
|
+
"no-misleading-character-class": "error",
|
|
697
|
+
"no-multi-str": "error",
|
|
698
|
+
"no-new": "error",
|
|
699
|
+
"no-new-func": "error",
|
|
700
|
+
"no-new-native-nonconstructor": "error",
|
|
701
|
+
"no-new-wrappers": "error",
|
|
702
|
+
"no-obj-calls": "error",
|
|
703
|
+
"no-octal": "error",
|
|
704
|
+
"no-octal-escape": "error",
|
|
705
|
+
"no-param-reassign": "warn",
|
|
706
|
+
"no-proto": "error",
|
|
707
|
+
"no-prototype-builtins": "error",
|
|
708
|
+
"no-redeclare": ["error", { builtinGlobals: false }],
|
|
709
|
+
"no-regex-spaces": "error",
|
|
710
|
+
"no-restricted-globals": [
|
|
711
|
+
"error",
|
|
712
|
+
{
|
|
713
|
+
message: "Use `globalThis` instead.",
|
|
714
|
+
name: "global"
|
|
715
|
+
},
|
|
716
|
+
{
|
|
717
|
+
message: "Use `globalThis` instead.",
|
|
718
|
+
name: "self"
|
|
719
|
+
}
|
|
720
|
+
],
|
|
721
|
+
"no-restricted-properties": [
|
|
722
|
+
"error",
|
|
723
|
+
{
|
|
724
|
+
message: "Use `Object.getPrototypeOf` or `Object.setPrototypeOf` instead.",
|
|
725
|
+
property: "__proto__"
|
|
726
|
+
},
|
|
727
|
+
{
|
|
728
|
+
message: "Use `Object.defineProperty` instead.",
|
|
729
|
+
property: "__defineGetter__"
|
|
730
|
+
},
|
|
731
|
+
{
|
|
732
|
+
message: "Use `Object.defineProperty` instead.",
|
|
733
|
+
property: "__defineSetter__"
|
|
734
|
+
},
|
|
735
|
+
{
|
|
736
|
+
message: "Use `Object.getOwnPropertyDescriptor` instead.",
|
|
737
|
+
property: "__lookupGetter__"
|
|
738
|
+
},
|
|
739
|
+
{
|
|
740
|
+
message: "Use `Object.getOwnPropertyDescriptor` instead.",
|
|
741
|
+
property: "__lookupSetter__"
|
|
742
|
+
}
|
|
743
|
+
],
|
|
744
|
+
"no-restricted-syntax": [
|
|
745
|
+
"error",
|
|
746
|
+
"TSEnumDeclaration[const=true]",
|
|
747
|
+
"TSExportAssignment"
|
|
748
|
+
],
|
|
749
|
+
"no-self-assign": ["error", { props: true }],
|
|
750
|
+
"no-self-compare": "error",
|
|
751
|
+
"no-sequences": "error",
|
|
752
|
+
"no-shadow-restricted-names": "error",
|
|
753
|
+
"no-sparse-arrays": "error",
|
|
754
|
+
"no-template-curly-in-string": "error",
|
|
755
|
+
"no-this-before-super": "error",
|
|
756
|
+
"no-throw-literal": "error",
|
|
757
|
+
"no-undef": "error",
|
|
758
|
+
"no-undef-init": "error",
|
|
759
|
+
"no-unexpected-multiline": "error",
|
|
760
|
+
"no-unmodified-loop-condition": "error",
|
|
761
|
+
"no-unneeded-ternary": ["error", { defaultAssignment: false }],
|
|
762
|
+
"no-unreachable": "error",
|
|
763
|
+
"no-unreachable-loop": "error",
|
|
764
|
+
"no-unsafe-finally": "error",
|
|
765
|
+
"no-unsafe-negation": "error",
|
|
766
|
+
"no-unused-expressions": ["error", {
|
|
767
|
+
allowShortCircuit: true,
|
|
768
|
+
allowTaggedTemplates: true,
|
|
769
|
+
allowTernary: true
|
|
770
|
+
}],
|
|
771
|
+
"no-unused-vars": ["error", {
|
|
772
|
+
args: "none",
|
|
773
|
+
caughtErrors: "none",
|
|
774
|
+
ignoreRestSiblings: true,
|
|
775
|
+
vars: "all"
|
|
776
|
+
}],
|
|
777
|
+
"no-use-before-define": ["error", {
|
|
778
|
+
classes: false,
|
|
779
|
+
functions: false,
|
|
780
|
+
variables: true
|
|
781
|
+
}],
|
|
782
|
+
"no-useless-backreference": "error",
|
|
783
|
+
"no-useless-call": "error",
|
|
784
|
+
"no-useless-catch": "error",
|
|
785
|
+
"no-useless-computed-key": "error",
|
|
786
|
+
"no-useless-constructor": "error",
|
|
787
|
+
"no-useless-rename": "error",
|
|
788
|
+
"no-useless-return": "error",
|
|
789
|
+
"no-var": "error",
|
|
790
|
+
"no-with": "error",
|
|
791
|
+
"object-shorthand": [
|
|
792
|
+
"error",
|
|
793
|
+
"always",
|
|
794
|
+
{
|
|
795
|
+
avoidQuotes: true,
|
|
796
|
+
ignoreConstructors: false
|
|
797
|
+
}
|
|
798
|
+
],
|
|
799
|
+
"one-var": ["error", { initialized: "never" }],
|
|
800
|
+
"prefer-arrow-callback": ["error", {
|
|
801
|
+
allowNamedFunctions: false,
|
|
802
|
+
allowUnboundThis: true
|
|
803
|
+
}],
|
|
804
|
+
"prefer-const": ["error", {
|
|
805
|
+
destructuring: "all",
|
|
806
|
+
ignoreReadBeforeAssign: true
|
|
807
|
+
}],
|
|
808
|
+
"prefer-exponentiation-operator": "error",
|
|
809
|
+
"prefer-promise-reject-errors": "error",
|
|
810
|
+
"prefer-regex-literals": ["error", { disallowRedundantWrapping: true }],
|
|
811
|
+
"prefer-rest-params": "error",
|
|
812
|
+
"prefer-spread": "error",
|
|
813
|
+
"prefer-template": "error",
|
|
814
|
+
"symbol-description": "error",
|
|
815
|
+
"unicode-bom": ["error", "never"],
|
|
816
|
+
"use-isnan": ["error", {
|
|
817
|
+
enforceForIndexOf: true,
|
|
818
|
+
enforceForSwitchCase: true
|
|
819
|
+
}],
|
|
820
|
+
"valid-typeof": ["error", { requireStringLiterals: true }],
|
|
821
|
+
"vars-on-top": "error",
|
|
822
|
+
"yoda": ["error", "never"],
|
|
823
|
+
...overrides
|
|
824
|
+
}
|
|
825
|
+
}];
|
|
1048
826
|
}
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
var import_eslint_plugin_n = __toESM(require("eslint-plugin-n"), 1);
|
|
827
|
+
//#endregion
|
|
828
|
+
//#region src/configs/node.ts
|
|
1052
829
|
function node(options = {}) {
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
...overrides
|
|
1072
|
-
}
|
|
1073
|
-
}
|
|
1074
|
-
];
|
|
830
|
+
const { overrides = {} } = options;
|
|
831
|
+
return [{
|
|
832
|
+
...eslint_plugin_n.default.configs["flat/recommended"],
|
|
833
|
+
name: `${RULE_PREFIX}/node/shared`,
|
|
834
|
+
files: GLOB_SRC
|
|
835
|
+
}, {
|
|
836
|
+
name: `${RULE_PREFIX}/node/customize`,
|
|
837
|
+
files: GLOB_SRC,
|
|
838
|
+
rules: {
|
|
839
|
+
"n/handle-callback-err": ["error", "^(err|error)$"],
|
|
840
|
+
"n/no-new-require": "error",
|
|
841
|
+
"n/no-path-concat": "error",
|
|
842
|
+
"n/prefer-global/buffer": ["error", "never"],
|
|
843
|
+
"n/prefer-global/process": ["error", "never"],
|
|
844
|
+
"n/no-missing-import": "off",
|
|
845
|
+
...overrides
|
|
846
|
+
}
|
|
847
|
+
}];
|
|
1075
848
|
}
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
var import_eslint_plugin_jsonc = __toESM(require("eslint-plugin-jsonc"), 1);
|
|
1079
|
-
var import_eslint_plugin_package_json = __toESM(require("eslint-plugin-package-json"), 1);
|
|
849
|
+
//#endregion
|
|
850
|
+
//#region src/configs/json.ts
|
|
1080
851
|
function json(options = {}) {
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
"resolutions",
|
|
1217
|
-
"husky",
|
|
1218
|
-
"simple-git-hooks",
|
|
1219
|
-
"lint-staged",
|
|
1220
|
-
"eslintConfig"
|
|
1221
|
-
]
|
|
1222
|
-
}
|
|
1223
|
-
],
|
|
1224
|
-
"package-json/require-type": packageJsonRequireType ? "error" : "off",
|
|
1225
|
-
...overrides.packageJson
|
|
1226
|
-
}
|
|
1227
|
-
}
|
|
1228
|
-
];
|
|
852
|
+
const { overrides = {
|
|
853
|
+
core: {},
|
|
854
|
+
packageJson: {}
|
|
855
|
+
}, indent = 2, packageJsonRequireType = true } = options;
|
|
856
|
+
return [
|
|
857
|
+
...eslint_plugin_jsonc.default.configs["recommended-with-json"].map((item) => ({
|
|
858
|
+
...item,
|
|
859
|
+
name: `${RULE_PREFIX}/json/shared/json`,
|
|
860
|
+
files: [GLOB_JSON]
|
|
861
|
+
})),
|
|
862
|
+
...eslint_plugin_jsonc.default.configs["recommended-with-jsonc"].map((item) => ({
|
|
863
|
+
...item,
|
|
864
|
+
name: `${RULE_PREFIX}/json/shared/jsonc`,
|
|
865
|
+
files: [GLOB_JSONC]
|
|
866
|
+
})),
|
|
867
|
+
...eslint_plugin_jsonc.default.configs["recommended-with-json5"].map((item) => ({
|
|
868
|
+
...item,
|
|
869
|
+
name: `${RULE_PREFIX}/json/shared/json5`,
|
|
870
|
+
files: [GLOB_JSON5]
|
|
871
|
+
})),
|
|
872
|
+
{
|
|
873
|
+
name: `${RULE_PREFIX}/json/customize`,
|
|
874
|
+
files: [
|
|
875
|
+
GLOB_JSON,
|
|
876
|
+
GLOB_JSON5,
|
|
877
|
+
GLOB_JSONC
|
|
878
|
+
],
|
|
879
|
+
rules: {
|
|
880
|
+
"jsonc/array-bracket-spacing": ["error", "never"],
|
|
881
|
+
"jsonc/comma-dangle": ["error", "never"],
|
|
882
|
+
"jsonc/comma-style": ["error", "last"],
|
|
883
|
+
"jsonc/indent": ["error", indent],
|
|
884
|
+
"jsonc/no-comments": "off",
|
|
885
|
+
"jsonc/key-spacing": ["error", {
|
|
886
|
+
afterColon: true,
|
|
887
|
+
beforeColon: false
|
|
888
|
+
}],
|
|
889
|
+
"jsonc/object-curly-newline": ["error", {
|
|
890
|
+
consistent: true,
|
|
891
|
+
multiline: true
|
|
892
|
+
}],
|
|
893
|
+
"jsonc/object-curly-spacing": ["error", "always"],
|
|
894
|
+
"jsonc/quote-props": "error",
|
|
895
|
+
"jsonc/quotes": "error",
|
|
896
|
+
"jsonc/no-bigint-literals": "error",
|
|
897
|
+
"jsonc/object-property-newline": ["error", { allowMultiplePropertiesPerLine: true }],
|
|
898
|
+
"jsonc/no-binary-expression": "error",
|
|
899
|
+
"jsonc/no-binary-numeric-literals": "error",
|
|
900
|
+
"jsonc/no-dupe-keys": "error",
|
|
901
|
+
"jsonc/no-escape-sequence-in-identifier": "error",
|
|
902
|
+
"jsonc/no-floating-decimal": "error",
|
|
903
|
+
"jsonc/no-hexadecimal-numeric-literals": "error",
|
|
904
|
+
"jsonc/no-infinity": "error",
|
|
905
|
+
"jsonc/no-multi-str": "error",
|
|
906
|
+
"jsonc/no-nan": "error",
|
|
907
|
+
"jsonc/no-number-props": "error",
|
|
908
|
+
"jsonc/no-numeric-separators": "error",
|
|
909
|
+
"jsonc/no-octal": "error",
|
|
910
|
+
"jsonc/no-octal-escape": "error",
|
|
911
|
+
"jsonc/no-octal-numeric-literals": "error",
|
|
912
|
+
"jsonc/no-parenthesized": "error",
|
|
913
|
+
"jsonc/no-plus-sign": "error",
|
|
914
|
+
"jsonc/no-regexp-literals": "error",
|
|
915
|
+
"jsonc/no-sparse-arrays": "error",
|
|
916
|
+
"jsonc/no-template-literals": "error",
|
|
917
|
+
"jsonc/no-undefined-value": "error",
|
|
918
|
+
"jsonc/no-unicode-codepoint-escapes": "error",
|
|
919
|
+
"jsonc/no-useless-escape": "error",
|
|
920
|
+
"jsonc/space-unary-ops": "error",
|
|
921
|
+
"jsonc/valid-json-number": "error",
|
|
922
|
+
"jsonc/vue-custom-block/no-parsing-error": "error",
|
|
923
|
+
...overrides.core
|
|
924
|
+
}
|
|
925
|
+
},
|
|
926
|
+
{
|
|
927
|
+
...eslint_plugin_package_json.default.configs.recommended,
|
|
928
|
+
name: `${RULE_PREFIX}/json/shared/package.json`,
|
|
929
|
+
files: [GLOB_PACKAGE_JSON]
|
|
930
|
+
},
|
|
931
|
+
{
|
|
932
|
+
name: `${RULE_PREFIX}/json/customize/package.json`,
|
|
933
|
+
files: [GLOB_PACKAGE_JSON],
|
|
934
|
+
rules: {
|
|
935
|
+
"package-json/order-properties": ["error", { order: [
|
|
936
|
+
"publisher",
|
|
937
|
+
"name",
|
|
938
|
+
"displayName",
|
|
939
|
+
"type",
|
|
940
|
+
"version",
|
|
941
|
+
"private",
|
|
942
|
+
"packageManager",
|
|
943
|
+
"description",
|
|
944
|
+
"author",
|
|
945
|
+
"contributors",
|
|
946
|
+
"license",
|
|
947
|
+
"funding",
|
|
948
|
+
"homepage",
|
|
949
|
+
"repository",
|
|
950
|
+
"bugs",
|
|
951
|
+
"keywords",
|
|
952
|
+
"categories",
|
|
953
|
+
"sideEffects",
|
|
954
|
+
"exports",
|
|
955
|
+
"main",
|
|
956
|
+
"module",
|
|
957
|
+
"unpkg",
|
|
958
|
+
"jsdelivr",
|
|
959
|
+
"types",
|
|
960
|
+
"typesVersions",
|
|
961
|
+
"bin",
|
|
962
|
+
"icon",
|
|
963
|
+
"files",
|
|
964
|
+
"engines",
|
|
965
|
+
"activationEvents",
|
|
966
|
+
"contributes",
|
|
967
|
+
"scripts",
|
|
968
|
+
"release-it",
|
|
969
|
+
"peerDependencies",
|
|
970
|
+
"peerDependenciesMeta",
|
|
971
|
+
"dependencies",
|
|
972
|
+
"optionalDependencies",
|
|
973
|
+
"devDependencies",
|
|
974
|
+
"pnpm",
|
|
975
|
+
"overrides",
|
|
976
|
+
"resolutions",
|
|
977
|
+
"husky",
|
|
978
|
+
"simple-git-hooks",
|
|
979
|
+
"lint-staged",
|
|
980
|
+
"eslintConfig"
|
|
981
|
+
] }],
|
|
982
|
+
"package-json/require-type": packageJsonRequireType ? "error" : "off",
|
|
983
|
+
...overrides.packageJson
|
|
984
|
+
}
|
|
985
|
+
}
|
|
986
|
+
];
|
|
1229
987
|
}
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
var import_eslint_plugin_unicorn = __toESM(require("eslint-plugin-unicorn"), 1);
|
|
988
|
+
//#endregion
|
|
989
|
+
//#region src/configs/unicorn.ts
|
|
1233
990
|
function unicorn(options = {}) {
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
"unicorn/prefer-type-error": "error",
|
|
1269
|
-
"unicorn/throw-new-error": "error",
|
|
1270
|
-
...overrides
|
|
1271
|
-
}
|
|
1272
|
-
}
|
|
1273
|
-
];
|
|
991
|
+
const { overrides = {} } = options;
|
|
992
|
+
return [{
|
|
993
|
+
...eslint_plugin_unicorn.default.configs.recommended,
|
|
994
|
+
name: `${RULE_PREFIX}/unicorn/shared`,
|
|
995
|
+
files: GLOB_SRC
|
|
996
|
+
}, {
|
|
997
|
+
name: `${RULE_PREFIX}/unicorn/customize`,
|
|
998
|
+
files: GLOB_SRC,
|
|
999
|
+
rules: {
|
|
1000
|
+
"unicorn/consistent-destructuring": "off",
|
|
1001
|
+
"unicorn/prevent-abbreviations": "off",
|
|
1002
|
+
"unicorn/prefer-top-level-await": "off",
|
|
1003
|
+
"unicorn/no-unreadable-array-destructuring": "off",
|
|
1004
|
+
"unicorn/no-null": "off",
|
|
1005
|
+
"unicorn/consistent-empty-array-spread": "error",
|
|
1006
|
+
"unicorn/error-message": "error",
|
|
1007
|
+
"unicorn/escape-case": "error",
|
|
1008
|
+
"unicorn/no-hex-escape": "error",
|
|
1009
|
+
"unicorn/new-for-builtins": "error",
|
|
1010
|
+
"unicorn/no-instanceof-builtins": "error",
|
|
1011
|
+
"unicorn/no-new-array": "error",
|
|
1012
|
+
"unicorn/no-new-buffer": "error",
|
|
1013
|
+
"unicorn/number-literal-case": "error",
|
|
1014
|
+
"unicorn/prefer-dom-node-text-content": "error",
|
|
1015
|
+
"unicorn/prefer-includes": "error",
|
|
1016
|
+
"unicorn/prefer-node-protocol": "error",
|
|
1017
|
+
"unicorn/prefer-query-selector": "off",
|
|
1018
|
+
"unicorn/prefer-number-properties": "error",
|
|
1019
|
+
"unicorn/prefer-string-starts-ends-with": "error",
|
|
1020
|
+
"unicorn/prefer-type-error": "error",
|
|
1021
|
+
"unicorn/throw-new-error": "error",
|
|
1022
|
+
...overrides
|
|
1023
|
+
}
|
|
1024
|
+
}];
|
|
1274
1025
|
}
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
var import_eslint_plugin_import_x = __toESM(require("eslint-plugin-import-x"), 1);
|
|
1278
|
-
var import_eslint_plugin_unused_imports = __toESM(require("eslint-plugin-unused-imports"), 1);
|
|
1279
|
-
var import_eslint_plugin_antfu3 = __toESM(require("eslint-plugin-antfu"), 1);
|
|
1280
|
-
var import_eslint_plugin_simple_import_sort = __toESM(require("eslint-plugin-simple-import-sort"), 1);
|
|
1026
|
+
//#endregion
|
|
1027
|
+
//#region src/configs/imports.ts
|
|
1281
1028
|
function imports(options = {}) {
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
vars: "all",
|
|
1323
|
-
varsIgnorePattern: "^_"
|
|
1324
|
-
}
|
|
1325
|
-
],
|
|
1326
|
-
"simple-import-sort/imports": closeOrder ? "off" : "error",
|
|
1327
|
-
"simple-import-sort/exports": closeOrder ? "off" : "error",
|
|
1328
|
-
...overrides
|
|
1329
|
-
}
|
|
1330
|
-
}
|
|
1331
|
-
];
|
|
1029
|
+
const { overrides = {}, closeOrder = true } = options;
|
|
1030
|
+
return [{
|
|
1031
|
+
name: `${RULE_PREFIX}/imports/customize`,
|
|
1032
|
+
files: GLOB_SRC,
|
|
1033
|
+
plugins: {
|
|
1034
|
+
"antfu": eslint_plugin_antfu.default,
|
|
1035
|
+
"import-x": eslint_plugin_import_x.default,
|
|
1036
|
+
"unused-imports": eslint_plugin_unused_imports.default,
|
|
1037
|
+
"simple-import-sort": eslint_plugin_simple_import_sort.default
|
|
1038
|
+
},
|
|
1039
|
+
rules: {
|
|
1040
|
+
"sort-imports": "off",
|
|
1041
|
+
"no-unused-vars": "off",
|
|
1042
|
+
"no-duplicate-imports": "off",
|
|
1043
|
+
"@typescript-eslint/no-unused-vars": "off",
|
|
1044
|
+
"antfu/import-dedupe": "error",
|
|
1045
|
+
"antfu/no-import-dist": "error",
|
|
1046
|
+
"antfu/no-import-node-modules-by-path": "error",
|
|
1047
|
+
"import-x/consistent-type-specifier-style": ["error", "prefer-top-level"],
|
|
1048
|
+
"import-x/first": "error",
|
|
1049
|
+
"import-x/no-duplicates": "error",
|
|
1050
|
+
"import-x/no-mutable-exports": "error",
|
|
1051
|
+
"import-x/no-named-default": "error",
|
|
1052
|
+
"import-x/no-self-import": "error",
|
|
1053
|
+
"import-x/no-webpack-loader-syntax": "error",
|
|
1054
|
+
"import-x/order": "off",
|
|
1055
|
+
"import-x/newline-after-import": ["error", { count: 1 }],
|
|
1056
|
+
"unused-imports/no-unused-imports": "warn",
|
|
1057
|
+
"unused-imports/no-unused-vars": ["error", {
|
|
1058
|
+
args: "after-used",
|
|
1059
|
+
argsIgnorePattern: "^_",
|
|
1060
|
+
ignoreRestSiblings: true,
|
|
1061
|
+
vars: "all",
|
|
1062
|
+
varsIgnorePattern: "^_"
|
|
1063
|
+
}],
|
|
1064
|
+
"simple-import-sort/imports": closeOrder ? "off" : "error",
|
|
1065
|
+
"simple-import-sort/exports": closeOrder ? "off" : "error",
|
|
1066
|
+
...overrides
|
|
1067
|
+
}
|
|
1068
|
+
}];
|
|
1332
1069
|
}
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
plugins: [...overrides.plugins || []]
|
|
1070
|
+
//#endregion
|
|
1071
|
+
//#region src/configs/format.ts
|
|
1072
|
+
const mergePrettierOptions = (options, overrides) => ({
|
|
1073
|
+
...options,
|
|
1074
|
+
...overrides,
|
|
1075
|
+
plugins: [...overrides.plugins || []]
|
|
1340
1076
|
});
|
|
1341
1077
|
function format(options = {}) {
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
mergePrettierOptions(prettierOptions, {
|
|
1430
|
-
parser: "scss"
|
|
1431
|
-
})
|
|
1432
|
-
]
|
|
1433
|
-
}
|
|
1434
|
-
},
|
|
1435
|
-
{
|
|
1436
|
-
name: `${RULE_PREFIX}/format/less`,
|
|
1437
|
-
files: [GLOB_LESS],
|
|
1438
|
-
languageOptions: {
|
|
1439
|
-
parser: parserPlain
|
|
1440
|
-
},
|
|
1441
|
-
rules: {
|
|
1442
|
-
"format/prettier": [
|
|
1443
|
-
"error",
|
|
1444
|
-
mergePrettierOptions(prettierOptions, {
|
|
1445
|
-
parser: "less"
|
|
1446
|
-
})
|
|
1447
|
-
]
|
|
1448
|
-
}
|
|
1449
|
-
}
|
|
1450
|
-
);
|
|
1451
|
-
}
|
|
1452
|
-
if (enable.graphql) {
|
|
1453
|
-
configs2.push({
|
|
1454
|
-
name: `${RULE_PREFIX}/format/graphql`,
|
|
1455
|
-
files: [GLOB_GRAPHQL],
|
|
1456
|
-
languageOptions: {
|
|
1457
|
-
parser: parserPlain
|
|
1458
|
-
},
|
|
1459
|
-
rules: {
|
|
1460
|
-
"format/prettier": [
|
|
1461
|
-
"error",
|
|
1462
|
-
mergePrettierOptions(prettierOptions, {
|
|
1463
|
-
parser: "graphql"
|
|
1464
|
-
})
|
|
1465
|
-
]
|
|
1466
|
-
}
|
|
1467
|
-
});
|
|
1468
|
-
}
|
|
1469
|
-
if (enable.xml) {
|
|
1470
|
-
configs2.push({
|
|
1471
|
-
name: `${RULE_PREFIX}/format/xml`,
|
|
1472
|
-
files: [GLOB_XML],
|
|
1473
|
-
languageOptions: {
|
|
1474
|
-
parser: parserPlain
|
|
1475
|
-
},
|
|
1476
|
-
rules: {
|
|
1477
|
-
"format/prettier": [
|
|
1478
|
-
"error",
|
|
1479
|
-
mergePrettierOptions(
|
|
1480
|
-
{
|
|
1481
|
-
...prettierXmlOptions,
|
|
1482
|
-
...prettierOptions
|
|
1483
|
-
},
|
|
1484
|
-
{
|
|
1485
|
-
parser: "xml",
|
|
1486
|
-
plugins: ["@prettier/plugin-xml"]
|
|
1487
|
-
}
|
|
1488
|
-
)
|
|
1489
|
-
]
|
|
1490
|
-
}
|
|
1491
|
-
});
|
|
1492
|
-
}
|
|
1493
|
-
if (enable.svg) {
|
|
1494
|
-
configs2.push({
|
|
1495
|
-
name: `${RULE_PREFIX}/format/svg`,
|
|
1496
|
-
files: [GLOB_SVG],
|
|
1497
|
-
languageOptions: {
|
|
1498
|
-
parser: parserPlain
|
|
1499
|
-
},
|
|
1500
|
-
rules: {
|
|
1501
|
-
"format/prettier": [
|
|
1502
|
-
"error",
|
|
1503
|
-
mergePrettierOptions(
|
|
1504
|
-
{
|
|
1505
|
-
...prettierXmlOptions,
|
|
1506
|
-
...prettierOptions
|
|
1507
|
-
},
|
|
1508
|
-
{
|
|
1509
|
-
parser: "xml",
|
|
1510
|
-
plugins: ["@prettier/plugin-xml"]
|
|
1511
|
-
}
|
|
1512
|
-
)
|
|
1513
|
-
]
|
|
1514
|
-
}
|
|
1515
|
-
});
|
|
1516
|
-
}
|
|
1517
|
-
return configs2;
|
|
1078
|
+
const { enable = {
|
|
1079
|
+
html: true,
|
|
1080
|
+
css: true,
|
|
1081
|
+
graphql: true,
|
|
1082
|
+
xml: true,
|
|
1083
|
+
svg: true
|
|
1084
|
+
}, customPrettierOptions = {} } = options;
|
|
1085
|
+
const configs = [];
|
|
1086
|
+
if (!enable) return configs;
|
|
1087
|
+
const prettierOptions = Object.assign({
|
|
1088
|
+
printWidth: 120,
|
|
1089
|
+
tabWidth: 2,
|
|
1090
|
+
semi: true,
|
|
1091
|
+
singleQuote: true,
|
|
1092
|
+
quoteProps: "consistent",
|
|
1093
|
+
jsxSingleQuote: false,
|
|
1094
|
+
trailingComma: "all",
|
|
1095
|
+
bracketSpacing: true,
|
|
1096
|
+
bracketSameLine: false,
|
|
1097
|
+
arrowParens: "always",
|
|
1098
|
+
useTabs: false,
|
|
1099
|
+
endOfLine: "lf",
|
|
1100
|
+
singleAttributePerLine: false
|
|
1101
|
+
}, customPrettierOptions);
|
|
1102
|
+
const prettierXmlOptions = {
|
|
1103
|
+
xmlQuoteAttributes: "double",
|
|
1104
|
+
xmlSelfClosingSpace: true,
|
|
1105
|
+
xmlSortAttributesByKey: false,
|
|
1106
|
+
xmlWhitespaceSensitivity: "ignore"
|
|
1107
|
+
};
|
|
1108
|
+
configs.push({
|
|
1109
|
+
name: `${RULE_PREFIX}/format`,
|
|
1110
|
+
plugins: { format: eslint_plugin_format.default }
|
|
1111
|
+
});
|
|
1112
|
+
if (enable.html) configs.push({
|
|
1113
|
+
name: `${RULE_PREFIX}/format/html`,
|
|
1114
|
+
files: [GLOB_HTML],
|
|
1115
|
+
languageOptions: { parser: parserPlain },
|
|
1116
|
+
rules: { "format/prettier": ["error", mergePrettierOptions(prettierOptions, { parser: "html" })] }
|
|
1117
|
+
});
|
|
1118
|
+
if (enable.css) configs.push({
|
|
1119
|
+
name: `${RULE_PREFIX}/format/css`,
|
|
1120
|
+
files: [GLOB_CSS, GLOB_POSTCSS],
|
|
1121
|
+
languageOptions: { parser: parserPlain },
|
|
1122
|
+
rules: { "format/prettier": ["error", mergePrettierOptions(prettierOptions, { parser: "css" })] }
|
|
1123
|
+
}, {
|
|
1124
|
+
name: `${RULE_PREFIX}/format/scss`,
|
|
1125
|
+
files: [GLOB_SCSS],
|
|
1126
|
+
languageOptions: { parser: parserPlain },
|
|
1127
|
+
rules: { "format/prettier": ["error", mergePrettierOptions(prettierOptions, { parser: "scss" })] }
|
|
1128
|
+
}, {
|
|
1129
|
+
name: `${RULE_PREFIX}/format/less`,
|
|
1130
|
+
files: [GLOB_LESS],
|
|
1131
|
+
languageOptions: { parser: parserPlain },
|
|
1132
|
+
rules: { "format/prettier": ["error", mergePrettierOptions(prettierOptions, { parser: "less" })] }
|
|
1133
|
+
});
|
|
1134
|
+
if (enable.graphql) configs.push({
|
|
1135
|
+
name: `${RULE_PREFIX}/format/graphql`,
|
|
1136
|
+
files: [GLOB_GRAPHQL],
|
|
1137
|
+
languageOptions: { parser: parserPlain },
|
|
1138
|
+
rules: { "format/prettier": ["error", mergePrettierOptions(prettierOptions, { parser: "graphql" })] }
|
|
1139
|
+
});
|
|
1140
|
+
if (enable.xml) configs.push({
|
|
1141
|
+
name: `${RULE_PREFIX}/format/xml`,
|
|
1142
|
+
files: [GLOB_XML],
|
|
1143
|
+
languageOptions: { parser: parserPlain },
|
|
1144
|
+
rules: { "format/prettier": ["error", mergePrettierOptions({
|
|
1145
|
+
...prettierXmlOptions,
|
|
1146
|
+
...prettierOptions
|
|
1147
|
+
}, {
|
|
1148
|
+
parser: "xml",
|
|
1149
|
+
plugins: ["@prettier/plugin-xml"]
|
|
1150
|
+
})] }
|
|
1151
|
+
});
|
|
1152
|
+
if (enable.svg) configs.push({
|
|
1153
|
+
name: `${RULE_PREFIX}/format/svg`,
|
|
1154
|
+
files: [GLOB_SVG],
|
|
1155
|
+
languageOptions: { parser: parserPlain },
|
|
1156
|
+
rules: { "format/prettier": ["error", mergePrettierOptions({
|
|
1157
|
+
...prettierXmlOptions,
|
|
1158
|
+
...prettierOptions
|
|
1159
|
+
}, {
|
|
1160
|
+
parser: "xml",
|
|
1161
|
+
plugins: ["@prettier/plugin-xml"]
|
|
1162
|
+
})] }
|
|
1163
|
+
});
|
|
1164
|
+
return configs;
|
|
1518
1165
|
}
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
var import_eslint_plugin_tailwindcss = __toESM(require("eslint-plugin-tailwindcss"), 1);
|
|
1522
|
-
var import_local_pkg2 = require("local-pkg");
|
|
1166
|
+
//#endregion
|
|
1167
|
+
//#region src/configs/tailwindcss.ts
|
|
1523
1168
|
function tailwindcss(options = {}) {
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
}
|
|
1538
|
-
}
|
|
1539
|
-
] : [];
|
|
1169
|
+
const { overrides = {} } = options;
|
|
1170
|
+
return (0, local_pkg.isPackageExists)("tailwindcss") ? [...eslint_plugin_tailwindcss.default.configs["flat/recommended"].map((item) => ({
|
|
1171
|
+
...item,
|
|
1172
|
+
name: `${RULE_PREFIX}/tailwindcss/shared/${item.name?.replace("tailwindcss:", "")}`,
|
|
1173
|
+
files: GLOB_SRC
|
|
1174
|
+
})), {
|
|
1175
|
+
name: `${RULE_PREFIX}/tailwindcss/customize`,
|
|
1176
|
+
files: GLOB_SRC,
|
|
1177
|
+
rules: {
|
|
1178
|
+
"tailwindcss/no-custom-classname": "off",
|
|
1179
|
+
...overrides
|
|
1180
|
+
}
|
|
1181
|
+
}] : [];
|
|
1540
1182
|
}
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
var import_flat = __toESM(require("@unocss/eslint-config/flat"), 1);
|
|
1544
|
-
var import_local_pkg3 = require("local-pkg");
|
|
1183
|
+
//#endregion
|
|
1184
|
+
//#region src/configs/unocss.ts
|
|
1545
1185
|
function unocss(options = {}) {
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
{
|
|
1558
|
-
name: `${RULE_PREFIX}/unocss/customize`,
|
|
1559
|
-
files: GLOB_SRC,
|
|
1560
|
-
rules: overrides
|
|
1561
|
-
}
|
|
1562
|
-
];
|
|
1186
|
+
const { overrides = {} } = options;
|
|
1187
|
+
if (!(0, local_pkg.isPackageExists)("unocss")) return [];
|
|
1188
|
+
return [{
|
|
1189
|
+
..._unocss_eslint_config_flat.default,
|
|
1190
|
+
name: `${RULE_PREFIX}/unocss/shared`,
|
|
1191
|
+
files: GLOB_SRC
|
|
1192
|
+
}, {
|
|
1193
|
+
name: `${RULE_PREFIX}/unocss/customize`,
|
|
1194
|
+
files: GLOB_SRC,
|
|
1195
|
+
rules: overrides
|
|
1196
|
+
}];
|
|
1563
1197
|
}
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
var import_eslint_plugin_yml = __toESM(require("eslint-plugin-yml"), 1);
|
|
1198
|
+
//#endregion
|
|
1199
|
+
//#region src/configs/yml.ts
|
|
1567
1200
|
function yml(options = {}) {
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
},
|
|
1637
|
-
pathPattern: ".*"
|
|
1638
|
-
}
|
|
1639
|
-
]
|
|
1640
|
-
}
|
|
1641
|
-
}
|
|
1642
|
-
];
|
|
1201
|
+
const { overrides = {}, indent = 2, quotes = "single" } = options;
|
|
1202
|
+
return [
|
|
1203
|
+
...eslint_plugin_yml.default.configs.recommended.map((item) => ({
|
|
1204
|
+
...item,
|
|
1205
|
+
name: `${RULE_PREFIX}/yml/shared`,
|
|
1206
|
+
files: [GLOB_YML]
|
|
1207
|
+
})),
|
|
1208
|
+
{
|
|
1209
|
+
name: `${RULE_PREFIX}/yml/customize`,
|
|
1210
|
+
files: [GLOB_YML],
|
|
1211
|
+
rules: {
|
|
1212
|
+
"yml/block-mapping": "error",
|
|
1213
|
+
"yml/block-sequence": "error",
|
|
1214
|
+
"yml/no-empty-key": "error",
|
|
1215
|
+
"yml/no-empty-sequence-entry": "error",
|
|
1216
|
+
"yml/no-irregular-whitespace": "error",
|
|
1217
|
+
"yml/plain-scalar": "error",
|
|
1218
|
+
"yml/block-mapping-question-indicator-newline": "error",
|
|
1219
|
+
"yml/block-sequence-hyphen-indicator-newline": "error",
|
|
1220
|
+
"yml/flow-mapping-curly-newline": "error",
|
|
1221
|
+
"yml/flow-mapping-curly-spacing": "error",
|
|
1222
|
+
"yml/flow-sequence-bracket-newline": "error",
|
|
1223
|
+
"yml/flow-sequence-bracket-spacing": "error",
|
|
1224
|
+
"yml/indent": ["error", indent],
|
|
1225
|
+
"yml/key-spacing": "error",
|
|
1226
|
+
"yml/no-tab-indent": "error",
|
|
1227
|
+
"yml/quotes": ["error", {
|
|
1228
|
+
avoidEscape: true,
|
|
1229
|
+
prefer: quotes
|
|
1230
|
+
}],
|
|
1231
|
+
"yml/spaced-comment": "error",
|
|
1232
|
+
...overrides
|
|
1233
|
+
}
|
|
1234
|
+
},
|
|
1235
|
+
{
|
|
1236
|
+
name: `${RULE_PREFIX}/yml/customize/pnpm-workspace.yaml`,
|
|
1237
|
+
files: ["pnpm-workspace.yaml"],
|
|
1238
|
+
rules: { "yml/sort-keys": [
|
|
1239
|
+
"error",
|
|
1240
|
+
{
|
|
1241
|
+
order: [
|
|
1242
|
+
"packages",
|
|
1243
|
+
"overrides",
|
|
1244
|
+
"patchedDependencies",
|
|
1245
|
+
"hoistPattern",
|
|
1246
|
+
"catalog",
|
|
1247
|
+
"catalogs",
|
|
1248
|
+
"allowedDeprecatedVersions",
|
|
1249
|
+
"allowNonAppliedPatches",
|
|
1250
|
+
"configDependencies",
|
|
1251
|
+
"ignoredBuiltDependencies",
|
|
1252
|
+
"ignoredOptionalDependencies",
|
|
1253
|
+
"neverBuiltDependencies",
|
|
1254
|
+
"onlyBuiltDependencies",
|
|
1255
|
+
"onlyBuiltDependenciesFile",
|
|
1256
|
+
"packageExtensions",
|
|
1257
|
+
"peerDependencyRules",
|
|
1258
|
+
"supportedArchitectures"
|
|
1259
|
+
],
|
|
1260
|
+
pathPattern: "^$"
|
|
1261
|
+
},
|
|
1262
|
+
{
|
|
1263
|
+
order: { type: "asc" },
|
|
1264
|
+
pathPattern: ".*"
|
|
1265
|
+
}
|
|
1266
|
+
] }
|
|
1267
|
+
}
|
|
1268
|
+
];
|
|
1643
1269
|
}
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
var import_eslint_plugin_toml = __toESM(require("eslint-plugin-toml"), 1);
|
|
1647
|
-
var parserToml = __toESM(require("toml-eslint-parser"), 1);
|
|
1270
|
+
//#endregion
|
|
1271
|
+
//#region src/configs/toml.ts
|
|
1648
1272
|
function toml(options = {}) {
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
"toml/table-bracket-spacing": "error",
|
|
1681
|
-
...overrides
|
|
1682
|
-
}
|
|
1683
|
-
}
|
|
1684
|
-
];
|
|
1273
|
+
const { overrides = {}, indent = 2 } = options;
|
|
1274
|
+
return [...eslint_plugin_toml.default.configs.recommended.map((item) => ({
|
|
1275
|
+
...item,
|
|
1276
|
+
name: `${RULE_PREFIX}/toml/shared`,
|
|
1277
|
+
files: [GLOB_TOML]
|
|
1278
|
+
})), {
|
|
1279
|
+
name: `${RULE_PREFIX}/toml/customize`,
|
|
1280
|
+
files: [GLOB_TOML],
|
|
1281
|
+
languageOptions: { parser: toml_eslint_parser },
|
|
1282
|
+
rules: {
|
|
1283
|
+
"toml/comma-style": "error",
|
|
1284
|
+
"toml/keys-order": "error",
|
|
1285
|
+
"toml/no-space-dots": "error",
|
|
1286
|
+
"toml/no-unreadable-number-separator": "error",
|
|
1287
|
+
"toml/precision-of-fractional-seconds": "error",
|
|
1288
|
+
"toml/precision-of-integer": "error",
|
|
1289
|
+
"toml/tables-order": "error",
|
|
1290
|
+
"toml/array-bracket-newline": "error",
|
|
1291
|
+
"toml/array-bracket-spacing": "error",
|
|
1292
|
+
"toml/array-element-newline": "error",
|
|
1293
|
+
"toml/indent": ["error", indent],
|
|
1294
|
+
"toml/inline-table-curly-spacing": "error",
|
|
1295
|
+
"toml/key-spacing": "error",
|
|
1296
|
+
"toml/padding-line-between-pairs": "error",
|
|
1297
|
+
"toml/padding-line-between-tables": "error",
|
|
1298
|
+
"toml/quoted-keys": "error",
|
|
1299
|
+
"toml/spaced-comment": "error",
|
|
1300
|
+
"toml/table-bracket-spacing": "error",
|
|
1301
|
+
...overrides
|
|
1302
|
+
}
|
|
1303
|
+
}];
|
|
1685
1304
|
}
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
var pluginRegexp = __toESM(require("eslint-plugin-regexp"), 1);
|
|
1305
|
+
//#endregion
|
|
1306
|
+
//#region src/configs/regexp.ts
|
|
1689
1307
|
function regexp(options = {}) {
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
rules: overrides
|
|
1701
|
-
}
|
|
1702
|
-
];
|
|
1308
|
+
const { overrides = {} } = options;
|
|
1309
|
+
return [{
|
|
1310
|
+
...eslint_plugin_regexp.configs.recommended,
|
|
1311
|
+
name: `${RULE_PREFIX}/regexp/shared`,
|
|
1312
|
+
files: GLOB_SRC
|
|
1313
|
+
}, {
|
|
1314
|
+
name: `${RULE_PREFIX}/regexp/customize`,
|
|
1315
|
+
files: GLOB_SRC,
|
|
1316
|
+
rules: overrides
|
|
1317
|
+
}];
|
|
1703
1318
|
}
|
|
1704
|
-
|
|
1705
|
-
|
|
1319
|
+
//#endregion
|
|
1320
|
+
//#region src/configs/ignores.ts
|
|
1706
1321
|
function ignores(ignorePatterns) {
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
...GLOB_EXCLUDE,
|
|
1712
|
-
...ignorePatterns
|
|
1713
|
-
]
|
|
1714
|
-
}
|
|
1715
|
-
];
|
|
1322
|
+
return [{
|
|
1323
|
+
name: `${RULE_PREFIX}/ignores`,
|
|
1324
|
+
ignores: [...GLOB_EXCLUDE, ...ignorePatterns]
|
|
1325
|
+
}];
|
|
1716
1326
|
}
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
var import_configs = __toESM(require("@eslint-community/eslint-plugin-eslint-comments/configs"), 1);
|
|
1327
|
+
//#endregion
|
|
1328
|
+
//#region src/configs/eslint-comments.ts
|
|
1720
1329
|
function eslintComments(options = {}) {
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
rules: overrides
|
|
1730
|
-
}
|
|
1731
|
-
];
|
|
1330
|
+
const { overrides = {} } = options;
|
|
1331
|
+
return [{
|
|
1332
|
+
..._eslint_community_eslint_plugin_eslint_comments_configs.default.recommended,
|
|
1333
|
+
name: `${RULE_PREFIX}/eslint-comments/shared`
|
|
1334
|
+
}, {
|
|
1335
|
+
name: `${RULE_PREFIX}/eslint-comments/customize`,
|
|
1336
|
+
rules: overrides
|
|
1337
|
+
}];
|
|
1732
1338
|
}
|
|
1733
|
-
|
|
1734
|
-
|
|
1339
|
+
//#endregion
|
|
1340
|
+
//#region src/configs/disables.ts
|
|
1735
1341
|
function disables(options = {}) {
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
}
|
|
1804
|
-
];
|
|
1342
|
+
const { overrides = {
|
|
1343
|
+
scripts: {},
|
|
1344
|
+
cli: {},
|
|
1345
|
+
bin: {},
|
|
1346
|
+
dts: {},
|
|
1347
|
+
cjs: {},
|
|
1348
|
+
config: {}
|
|
1349
|
+
} } = options;
|
|
1350
|
+
return [
|
|
1351
|
+
{
|
|
1352
|
+
name: `${RULE_PREFIX}/disables/scripts`,
|
|
1353
|
+
files: GLOB_SRC.map((item) => `**/scripts/${item}`),
|
|
1354
|
+
rules: {
|
|
1355
|
+
"antfu/no-top-level-await": "off",
|
|
1356
|
+
"no-console": "off",
|
|
1357
|
+
"@typescript-eslint/explicit-function-return-type": "off",
|
|
1358
|
+
...overrides.scripts
|
|
1359
|
+
}
|
|
1360
|
+
},
|
|
1361
|
+
{
|
|
1362
|
+
name: `${RULE_PREFIX}/disables/cli`,
|
|
1363
|
+
files: [...GLOB_SRC.map((item) => `**/cli/${item}`), ...GLOB_SRC_EXT.map((item) => `**/cli.${item}`)],
|
|
1364
|
+
rules: {
|
|
1365
|
+
"antfu/no-top-level-await": "off",
|
|
1366
|
+
"no-console": "off",
|
|
1367
|
+
...overrides.cli
|
|
1368
|
+
}
|
|
1369
|
+
},
|
|
1370
|
+
{
|
|
1371
|
+
name: `${RULE_PREFIX}/disables/bin`,
|
|
1372
|
+
files: ["**/bin/**/*", ...GLOB_SRC_EXT.map((item) => `**/bin.${item}`)],
|
|
1373
|
+
rules: {
|
|
1374
|
+
"antfu/no-import-dist": "off",
|
|
1375
|
+
"antfu/no-import-node-modules-by-path": "off",
|
|
1376
|
+
...overrides.bin
|
|
1377
|
+
}
|
|
1378
|
+
},
|
|
1379
|
+
{
|
|
1380
|
+
name: `${RULE_PREFIX}/disables/dts`,
|
|
1381
|
+
files: ["**/*.d.?([cm])ts"],
|
|
1382
|
+
rules: {
|
|
1383
|
+
"eslint-comments/no-unlimited-disable": "off",
|
|
1384
|
+
"import/no-duplicates": "off",
|
|
1385
|
+
"no-restricted-syntax": "off",
|
|
1386
|
+
"unused-imports/no-unused-vars": "off",
|
|
1387
|
+
...overrides.dts
|
|
1388
|
+
}
|
|
1389
|
+
},
|
|
1390
|
+
{
|
|
1391
|
+
name: `${RULE_PREFIX}/disables/cjs`,
|
|
1392
|
+
files: ["**/*.js", "**/*.cjs"],
|
|
1393
|
+
rules: {
|
|
1394
|
+
"ts/no-require-imports": "off",
|
|
1395
|
+
...overrides.cjs
|
|
1396
|
+
}
|
|
1397
|
+
},
|
|
1398
|
+
{
|
|
1399
|
+
name: `${RULE_PREFIX}/disables/config`,
|
|
1400
|
+
files: [...GLOB_SRC_EXT.map((item) => `**/*.config.${item}`), ...GLOB_SRC_EXT.map((item) => `**/*.config.*.${item}`)],
|
|
1401
|
+
rules: {
|
|
1402
|
+
"antfu/no-top-level-await": "off",
|
|
1403
|
+
"no-console": "off",
|
|
1404
|
+
"ts/explicit-function-return-type": "off",
|
|
1405
|
+
...overrides.config
|
|
1406
|
+
}
|
|
1407
|
+
}
|
|
1408
|
+
];
|
|
1805
1409
|
}
|
|
1806
|
-
|
|
1807
|
-
|
|
1410
|
+
//#endregion
|
|
1411
|
+
//#region src/configs/language-options.ts
|
|
1808
1412
|
function languageOptions(options = {}) {
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
sourceType
|
|
1816
|
-
}
|
|
1817
|
-
}
|
|
1818
|
-
];
|
|
1413
|
+
const { sourceType = "module" } = options;
|
|
1414
|
+
return [{
|
|
1415
|
+
name: `${RULE_PREFIX}/language-options`,
|
|
1416
|
+
files: GLOB_SRC,
|
|
1417
|
+
languageOptions: { sourceType }
|
|
1418
|
+
}];
|
|
1819
1419
|
}
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
function
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1420
|
+
//#endregion
|
|
1421
|
+
//#region src/index.ts
|
|
1422
|
+
function defineConfig(options = {}) {
|
|
1423
|
+
const { configs = {}, ignorePatterns = [], sourceType = "module" } = options;
|
|
1424
|
+
return [
|
|
1425
|
+
...react(configs.react),
|
|
1426
|
+
...vue(configs.vue),
|
|
1427
|
+
...stylistic(configs.stylistic),
|
|
1428
|
+
...typescript(configs.typescript),
|
|
1429
|
+
...javascript(configs.javascript),
|
|
1430
|
+
...node(configs.node),
|
|
1431
|
+
...json(configs.json),
|
|
1432
|
+
...unicorn(configs.unicorn),
|
|
1433
|
+
...imports(configs.imports),
|
|
1434
|
+
...format(configs.format),
|
|
1435
|
+
...tailwindcss(configs.tailwindcss),
|
|
1436
|
+
...unocss(configs.unocss),
|
|
1437
|
+
...yml(configs.yml),
|
|
1438
|
+
...toml(configs.toml),
|
|
1439
|
+
...regexp(configs.regexp),
|
|
1440
|
+
...ignores(ignorePatterns),
|
|
1441
|
+
...eslintComments(configs.eslintComments),
|
|
1442
|
+
...disables(configs.disables),
|
|
1443
|
+
...languageOptions({ sourceType })
|
|
1444
|
+
];
|
|
1845
1445
|
}
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
defineConfig
|
|
1849
|
-
});
|
|
1446
|
+
//#endregion
|
|
1447
|
+
exports.defineConfig = defineConfig;
|