@kazupon/eslint-config 0.17.0 → 0.19.0
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 +8 -1
- package/dist/index.cjs +267 -257
- package/dist/index.d.cts +14216 -3
- package/dist/index.d.ts +14216 -3
- package/dist/index.js +242 -144
- package/package.json +27 -22
- package/dist/config.d.cts +0 -9
- package/dist/config.d.ts +0 -9
- package/dist/configs/comments.d.cts +0 -15
- package/dist/configs/comments.d.ts +0 -15
- package/dist/configs/imports.d.cts +0 -21
- package/dist/configs/imports.d.ts +0 -21
- package/dist/configs/index.d.cts +0 -16
- package/dist/configs/index.d.ts +0 -16
- package/dist/configs/javascript.d.cts +0 -15
- package/dist/configs/javascript.d.ts +0 -15
- package/dist/configs/jsdoc.d.cts +0 -27
- package/dist/configs/jsdoc.d.ts +0 -27
- package/dist/configs/jsonc.d.cts +0 -39
- package/dist/configs/jsonc.d.ts +0 -39
- package/dist/configs/prettier.d.cts +0 -15
- package/dist/configs/prettier.d.ts +0 -15
- package/dist/configs/promise.d.cts +0 -15
- package/dist/configs/promise.d.ts +0 -15
- package/dist/configs/react.d.cts +0 -26
- package/dist/configs/react.d.ts +0 -26
- package/dist/configs/regexp.d.cts +0 -15
- package/dist/configs/regexp.d.ts +0 -15
- package/dist/configs/svelte.d.cts +0 -21
- package/dist/configs/svelte.d.ts +0 -21
- package/dist/configs/toml.d.cts +0 -15
- package/dist/configs/toml.d.ts +0 -15
- package/dist/configs/typescript.d.cts +0 -38
- package/dist/configs/typescript.d.ts +0 -38
- package/dist/configs/unicorn.d.cts +0 -20
- package/dist/configs/unicorn.d.ts +0 -20
- package/dist/configs/vitest.d.cts +0 -22
- package/dist/configs/vitest.d.ts +0 -22
- package/dist/configs/vue.d.cts +0 -36
- package/dist/configs/vue.d.ts +0 -36
- package/dist/configs/yml.d.cts +0 -22
- package/dist/configs/yml.d.ts +0 -22
- package/dist/globs.d.cts +0 -13
- package/dist/globs.d.ts +0 -13
- package/dist/types/gens/comments.d.cts +0 -65
- package/dist/types/gens/comments.d.ts +0 -65
- package/dist/types/gens/eslint.d.cts +0 -22
- package/dist/types/gens/eslint.d.ts +0 -22
- package/dist/types/gens/imports.d.cts +0 -519
- package/dist/types/gens/imports.d.ts +0 -519
- package/dist/types/gens/javascript.d.cts +0 -3158
- package/dist/types/gens/javascript.d.ts +0 -3158
- package/dist/types/gens/jsdoc.d.cts +0 -796
- package/dist/types/gens/jsdoc.d.ts +0 -796
- package/dist/types/gens/jsonc.d.cts +0 -513
- package/dist/types/gens/jsonc.d.ts +0 -513
- package/dist/types/gens/prettier.d.cts +0 -2
- package/dist/types/gens/prettier.d.ts +0 -2
- package/dist/types/gens/promise.d.cts +0 -113
- package/dist/types/gens/promise.d.ts +0 -113
- package/dist/types/gens/react.d.cts +0 -1053
- package/dist/types/gens/react.d.ts +0 -1053
- package/dist/types/gens/regexp.d.cts +0 -553
- package/dist/types/gens/regexp.d.ts +0 -553
- package/dist/types/gens/svelte.d.cts +0 -491
- package/dist/types/gens/svelte.d.ts +0 -491
- package/dist/types/gens/toml.d.cts +0 -256
- package/dist/types/gens/toml.d.ts +0 -256
- package/dist/types/gens/typescript.d.cts +0 -1578
- package/dist/types/gens/typescript.d.ts +0 -1578
- package/dist/types/gens/unicorn.d.cts +0 -910
- package/dist/types/gens/unicorn.d.ts +0 -910
- package/dist/types/gens/vitest.d.cts +0 -377
- package/dist/types/gens/vitest.d.ts +0 -377
- package/dist/types/gens/vue.d.cts +0 -2746
- package/dist/types/gens/vue.d.ts +0 -2746
- package/dist/types/gens/yml.d.cts +0 -375
- package/dist/types/gens/yml.d.ts +0 -375
- package/dist/types/index.d.cts +0 -18
- package/dist/types/index.d.ts +0 -18
- package/dist/types/overrides.d.cts +0 -8
- package/dist/types/overrides.d.ts +0 -8
- package/dist/utils.d.cts +0 -18
- package/dist/utils.d.ts +0 -18
package/dist/index.cjs
CHANGED
|
@@ -22,20 +22,14 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
22
22
|
}) : target, mod));
|
|
23
23
|
|
|
24
24
|
//#endregion
|
|
25
|
-
const
|
|
26
|
-
const
|
|
25
|
+
const eslint_flat_config_utils = __toESM(require("eslint-flat-config-utils"));
|
|
26
|
+
const __kazupon_jts_utils_module = __toESM(require("@kazupon/jts-utils/module"));
|
|
27
|
+
const globals = __toESM(require("globals"));
|
|
27
28
|
|
|
28
29
|
//#region src/config.ts
|
|
29
30
|
function defineConfig(...configs) {
|
|
30
31
|
const baseConfigs = [];
|
|
31
|
-
return new FlatConfigComposer().append(...baseConfigs, ...configs);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
//#endregion
|
|
35
|
-
//#region node_modules/.pnpm/@kazupon+jts-utils@0.2.0/node_modules/@kazupon/jts-utils/dist/module/index.mjs
|
|
36
|
-
async function interopDefault(mod) {
|
|
37
|
-
const resolved = await mod;
|
|
38
|
-
return resolved.default || resolved;
|
|
32
|
+
return new eslint_flat_config_utils.FlatConfigComposer().append(...baseConfigs, ...configs);
|
|
39
33
|
}
|
|
40
34
|
|
|
41
35
|
//#endregion
|
|
@@ -51,8 +45,19 @@ const GLOB_YAML = "**/*.y?(a)ml";
|
|
|
51
45
|
const GLOB_TOML = "**/*.toml";
|
|
52
46
|
const GLOB_VUE = "**/*.vue";
|
|
53
47
|
const GLOB_SVELTE = "**/*.svelte";
|
|
48
|
+
const GLOB_MARKDOWN = "**/*.md";
|
|
54
49
|
const GLOB_SRC_EXT = "?([cm])[jt]s?(x)";
|
|
55
|
-
const GLOB_TESTS = [
|
|
50
|
+
const GLOB_TESTS = [
|
|
51
|
+
`**/test/**/*.${GLOB_SRC_EXT}`,
|
|
52
|
+
`**/tests/**/*.${GLOB_SRC_EXT}`,
|
|
53
|
+
`**/spec/**/*.${GLOB_SRC_EXT}`,
|
|
54
|
+
`**/specs/**/*.${GLOB_SRC_EXT}`,
|
|
55
|
+
`**/e2e/**/*.${GLOB_SRC_EXT}`,
|
|
56
|
+
`**/__tests__/**/*.${GLOB_SRC_EXT}`,
|
|
57
|
+
`**/__test__/**/*.${GLOB_SRC_EXT}`,
|
|
58
|
+
`**/*.spec.${GLOB_SRC_EXT}`,
|
|
59
|
+
`**/*.test.${GLOB_SRC_EXT}`
|
|
60
|
+
];
|
|
56
61
|
const GLOB_TESTS_TYPE = [`**/*.test-d.${GLOB_SRC_EXT}`, `**/*.spec-d.${GLOB_SRC_EXT}`];
|
|
57
62
|
|
|
58
63
|
//#endregion
|
|
@@ -62,14 +67,18 @@ async function loadPlugin(name) {
|
|
|
62
67
|
console.error(error);
|
|
63
68
|
throw new Error(`Failed to load eslint plugin '${name}'. Please install it!`);
|
|
64
69
|
});
|
|
65
|
-
return interopDefault(mod);
|
|
70
|
+
return (0, __kazupon_jts_utils_module.interopDefault)(mod);
|
|
66
71
|
}
|
|
67
72
|
async function getTypeScriptParser() {
|
|
68
73
|
const ts = await loadPlugin("typescript-eslint");
|
|
69
74
|
return ts.parser;
|
|
70
75
|
}
|
|
71
76
|
function getGlobSourceFiles(useTypeScript = false) {
|
|
72
|
-
return [
|
|
77
|
+
return [
|
|
78
|
+
GLOB_JS,
|
|
79
|
+
GLOB_JSX,
|
|
80
|
+
...useTypeScript ? [GLOB_TS, GLOB_TSX] : []
|
|
81
|
+
];
|
|
73
82
|
}
|
|
74
83
|
|
|
75
84
|
//#endregion
|
|
@@ -89,20 +98,26 @@ async function comments(options = {}) {
|
|
|
89
98
|
|
|
90
99
|
//#endregion
|
|
91
100
|
//#region src/configs/imports.ts
|
|
92
|
-
const IMPORTS_FILES = [
|
|
101
|
+
const IMPORTS_FILES = [
|
|
102
|
+
GLOB_JS,
|
|
103
|
+
GLOB_JSX,
|
|
104
|
+
GLOB_TS,
|
|
105
|
+
GLOB_TSX
|
|
106
|
+
];
|
|
93
107
|
async function imports(options = {}) {
|
|
94
108
|
const { rules: overrideRules = {} } = options;
|
|
95
|
-
const unused = await loadPlugin(
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
109
|
+
const unused = await loadPlugin(
|
|
110
|
+
// eslint-disable-line @typescript-eslint/no-unsafe-assignment
|
|
111
|
+
"eslint-plugin-unused-imports"
|
|
112
|
+
);
|
|
113
|
+
const imports$1 = await loadPlugin("eslint-plugin-import");
|
|
114
|
+
const configs = [imports$1.flatConfigs.recommended];
|
|
115
|
+
if (options.typescript) try {
|
|
116
|
+
await loadPlugin("eslint-import-resolver-typescript");
|
|
117
|
+
imports$1.flatConfigs.typescript.settings["import/resolver"]["typescript"] = true;
|
|
118
|
+
configs.push(imports$1.flatConfigs.typescript);
|
|
119
|
+
} catch (error) {
|
|
120
|
+
throw new Error(`Not found eslint-import-resolver-typescript: ${error.message}`);
|
|
106
121
|
}
|
|
107
122
|
configs.push({
|
|
108
123
|
name: "unused-imports",
|
|
@@ -146,9 +161,9 @@ async function javascript(options = {}) {
|
|
|
146
161
|
languageOptions: {
|
|
147
162
|
ecmaVersion: 2022,
|
|
148
163
|
globals: {
|
|
149
|
-
...globals.browser,
|
|
150
|
-
...globals.node,
|
|
151
|
-
...globals.es2022,
|
|
164
|
+
...globals.default.browser,
|
|
165
|
+
...globals.default.node,
|
|
166
|
+
...globals.default.es2022,
|
|
152
167
|
document: "readonly",
|
|
153
168
|
navigator: "readonly",
|
|
154
169
|
window: "readonly"
|
|
@@ -172,14 +187,9 @@ async function jsdoc(options = {}) {
|
|
|
172
187
|
const jsdoc$1 = await loadPlugin("eslint-plugin-jsdoc");
|
|
173
188
|
function resolvePreset() {
|
|
174
189
|
let preset = "recommended";
|
|
175
|
-
if (typescript$1 === "syntax") {
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
preset = `${preset}-typescript-flavor`;
|
|
179
|
-
}
|
|
180
|
-
if (error) {
|
|
181
|
-
preset = `${preset}-error`;
|
|
182
|
-
}
|
|
190
|
+
if (typescript$1 === "syntax") preset = `${preset}-typescript`;
|
|
191
|
+
else if (typescript$1 === "flavor") preset = `${preset}-typescript-flavor`;
|
|
192
|
+
if (error) preset = `${preset}-error`;
|
|
183
193
|
return preset;
|
|
184
194
|
}
|
|
185
195
|
return [jsdoc$1.configs[`flat/${resolvePreset()}`], {
|
|
@@ -192,36 +202,42 @@ async function jsdoc(options = {}) {
|
|
|
192
202
|
//#region src/configs/jsonc.ts
|
|
193
203
|
async function jsonc(options = {}) {
|
|
194
204
|
const { rules: overrideRules = {} } = options;
|
|
195
|
-
const kinds = [
|
|
205
|
+
const kinds = [
|
|
206
|
+
options.json ? "json" : "",
|
|
207
|
+
options.jsonc ? "jsonc" : "",
|
|
208
|
+
options.json5 ? "json5" : ""
|
|
209
|
+
];
|
|
196
210
|
const usePrettier = !!options.prettier;
|
|
197
211
|
const jsonc$1 = await loadPlugin("eslint-plugin-jsonc");
|
|
198
212
|
const configs = [];
|
|
199
|
-
for (const kind of kinds) {
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
return config.name ? config : {
|
|
212
|
-
name: `jsonc/flat/prettier/${index}`,
|
|
213
|
-
...config
|
|
214
|
-
};
|
|
215
|
-
}));
|
|
216
|
-
}
|
|
213
|
+
for (const kind of kinds) if (kind) configs.push(...jsonc$1.configs[`flat/recommended-with-${kind}`].map((config, index) => {
|
|
214
|
+
return config.name ? config : {
|
|
215
|
+
name: `jsonc/flat/recommended-with-${kind}/${index}`,
|
|
216
|
+
...config
|
|
217
|
+
};
|
|
218
|
+
}));
|
|
219
|
+
if (usePrettier) configs.push(...jsonc$1.configs["flat/prettier"].map((config, index) => {
|
|
220
|
+
return config.name ? config : {
|
|
221
|
+
name: `jsonc/flat/prettier/${index}`,
|
|
222
|
+
...config
|
|
223
|
+
};
|
|
224
|
+
}));
|
|
217
225
|
const overriddenConfig = {
|
|
218
226
|
name: "@kazupon/jsonc",
|
|
219
|
-
files: [
|
|
227
|
+
files: [
|
|
228
|
+
GLOB_JSON,
|
|
229
|
+
GLOB_JSON5,
|
|
230
|
+
GLOB_JSONC
|
|
231
|
+
],
|
|
220
232
|
rules: { ...overrideRules }
|
|
221
233
|
};
|
|
222
234
|
configs.push(...jsoncSort(), overriddenConfig);
|
|
223
235
|
return configs;
|
|
224
236
|
}
|
|
237
|
+
/**
|
|
238
|
+
* jsonc sort configurations
|
|
239
|
+
* @returns {Linter.Config[]} jsonc sort configurations
|
|
240
|
+
*/
|
|
225
241
|
function jsoncSort() {
|
|
226
242
|
return [{
|
|
227
243
|
name: "@kazupon/jsonc/sort/package.json",
|
|
@@ -231,23 +247,94 @@ function jsoncSort() {
|
|
|
231
247
|
order: { type: "asc" },
|
|
232
248
|
pathPattern: "^files$"
|
|
233
249
|
}],
|
|
234
|
-
"jsonc/sort-keys": [
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
250
|
+
"jsonc/sort-keys": [
|
|
251
|
+
"error",
|
|
252
|
+
{
|
|
253
|
+
order: [
|
|
254
|
+
"name",
|
|
255
|
+
"description",
|
|
256
|
+
"private",
|
|
257
|
+
"version",
|
|
258
|
+
"author",
|
|
259
|
+
"contributors",
|
|
260
|
+
"license",
|
|
261
|
+
"funding",
|
|
262
|
+
"bugs",
|
|
263
|
+
"repository",
|
|
264
|
+
"keywords",
|
|
265
|
+
"homepage",
|
|
266
|
+
"publishConfig",
|
|
267
|
+
"packageManager",
|
|
268
|
+
"engines",
|
|
269
|
+
"os",
|
|
270
|
+
"cpu",
|
|
271
|
+
"type",
|
|
272
|
+
"sideEffects",
|
|
273
|
+
"bin",
|
|
274
|
+
"files",
|
|
275
|
+
"main",
|
|
276
|
+
"module",
|
|
277
|
+
"browser",
|
|
278
|
+
"unpkg",
|
|
279
|
+
"jsdelivr",
|
|
280
|
+
"directories",
|
|
281
|
+
"exports",
|
|
282
|
+
"types",
|
|
283
|
+
"typesVersions",
|
|
284
|
+
"scripts",
|
|
285
|
+
"dependencies",
|
|
286
|
+
"peerDependencies",
|
|
287
|
+
"peerDependenciesMeta",
|
|
288
|
+
"optionalDependencies",
|
|
289
|
+
"devDependencies",
|
|
290
|
+
"pnpm",
|
|
291
|
+
"overrides",
|
|
292
|
+
"resolutions",
|
|
293
|
+
"workspaces",
|
|
294
|
+
"prettier",
|
|
295
|
+
"buildOptions",
|
|
296
|
+
"lint-staged"
|
|
297
|
+
],
|
|
298
|
+
pathPattern: "^$"
|
|
299
|
+
},
|
|
300
|
+
{
|
|
301
|
+
order: { type: "asc" },
|
|
302
|
+
pathPattern: "^scripts$"
|
|
303
|
+
},
|
|
304
|
+
{
|
|
305
|
+
order: { type: "asc" },
|
|
306
|
+
pathPattern: "^(?:dev|peer|optional|bundled)?[Dd]ependencies(Meta)?$"
|
|
307
|
+
},
|
|
308
|
+
{
|
|
309
|
+
order: { type: "asc" },
|
|
310
|
+
pathPattern: "^(?:resolutions|overrides|pnpm.overrides)$"
|
|
311
|
+
}
|
|
312
|
+
]
|
|
247
313
|
}
|
|
248
314
|
}];
|
|
249
315
|
}
|
|
250
316
|
|
|
317
|
+
//#endregion
|
|
318
|
+
//#region src/configs/markdown.ts
|
|
319
|
+
async function markdown(options = {}) {
|
|
320
|
+
const { rules: overrideRules = {} } = options;
|
|
321
|
+
const language = options.language || "gfm";
|
|
322
|
+
const fencedCodeBlocks = typeof options.fencedCodeBlocks === "boolean" ? options.fencedCodeBlocks : true;
|
|
323
|
+
const markdown$1 = await loadPlugin("@eslint/markdown");
|
|
324
|
+
const recommended = markdown$1.configs["recommended"][0];
|
|
325
|
+
recommended.language = `markdown/${language}`;
|
|
326
|
+
return [
|
|
327
|
+
recommended,
|
|
328
|
+
...fencedCodeBlocks ? markdown$1.configs["processor"] : [],
|
|
329
|
+
{
|
|
330
|
+
name: "@kazupon/markdown",
|
|
331
|
+
files: [GLOB_MARKDOWN],
|
|
332
|
+
rules: { ...overrideRules }
|
|
333
|
+
}
|
|
334
|
+
];
|
|
335
|
+
}
|
|
336
|
+
const md = markdown;
|
|
337
|
+
|
|
251
338
|
//#endregion
|
|
252
339
|
//#region src/configs/prettier.ts
|
|
253
340
|
async function prettier(options = {}) {
|
|
@@ -279,7 +366,11 @@ async function react(options = {}) {
|
|
|
279
366
|
const { rules: overrideRules = {}, settings = {} } = options;
|
|
280
367
|
const useTypeScript = !options.typescript;
|
|
281
368
|
const enableRefresh = !!options.refresh;
|
|
282
|
-
const [react$1, reactHooks, reactRefresh] = await Promise.all([
|
|
369
|
+
const [react$1, reactHooks, reactRefresh] = await Promise.all([
|
|
370
|
+
loadPlugin("eslint-plugin-react"),
|
|
371
|
+
loadPlugin("eslint-plugin-react-hooks"),
|
|
372
|
+
enableRefresh ? loadPlugin("eslint-plugin-react-refresh") : null
|
|
373
|
+
]);
|
|
283
374
|
const customConfig = {
|
|
284
375
|
name: "@kazupon/react",
|
|
285
376
|
files: getGlobSourceFiles(useTypeScript),
|
|
@@ -295,13 +386,11 @@ async function react(options = {}) {
|
|
|
295
386
|
files: getGlobSourceFiles(useTypeScript),
|
|
296
387
|
plugins: { "react-hooks": reactHooks }
|
|
297
388
|
}];
|
|
298
|
-
if (enableRefresh) {
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
});
|
|
304
|
-
}
|
|
389
|
+
if (enableRefresh) configs.push({
|
|
390
|
+
name: "react-refresh/flat",
|
|
391
|
+
files: getGlobSourceFiles(useTypeScript),
|
|
392
|
+
plugins: { "react-refresh": reactRefresh }
|
|
393
|
+
});
|
|
305
394
|
return [...configs, customConfig];
|
|
306
395
|
}
|
|
307
396
|
|
|
@@ -325,24 +414,22 @@ async function svelte(options = {}) {
|
|
|
325
414
|
const { rules: overrideRules = {}, parserOptions = { project: true } } = options;
|
|
326
415
|
const useTypeScript = !!options.typescript;
|
|
327
416
|
const svelte$1 = await loadPlugin("eslint-plugin-svelte");
|
|
328
|
-
const svelteParser = svelte$1.configs["flat/base"][1]["languageOptions"]
|
|
417
|
+
const svelteParser = svelte$1.configs["flat/base"][1]["languageOptions"]?.parser;
|
|
329
418
|
const customConfig = {
|
|
330
419
|
name: "@kazupon/svelte",
|
|
331
420
|
files: [GLOB_SVELTE],
|
|
332
421
|
rules: { ...overrideRules }
|
|
333
422
|
};
|
|
334
|
-
if (useTypeScript) {
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
};
|
|
345
|
-
}
|
|
423
|
+
if (useTypeScript) customConfig.languageOptions = {
|
|
424
|
+
parser: svelteParser,
|
|
425
|
+
parserOptions: {
|
|
426
|
+
sourceType: "module",
|
|
427
|
+
parser: await getTypeScriptParser(),
|
|
428
|
+
ecmaFeatures: { jsx: true },
|
|
429
|
+
extraFileExtensions: [".svelte"],
|
|
430
|
+
...parserOptions
|
|
431
|
+
}
|
|
432
|
+
};
|
|
346
433
|
return [...svelte$1.configs["flat/recommended"], customConfig];
|
|
347
434
|
}
|
|
348
435
|
|
|
@@ -372,34 +459,50 @@ async function toml(options = {}) {
|
|
|
372
459
|
async function typescript(options = {}) {
|
|
373
460
|
const { rules: overrideRules = {}, extraFileExtensions = [], parserOptions = { project: true } } = options;
|
|
374
461
|
const ts = await loadPlugin("typescript-eslint");
|
|
375
|
-
const files = options.files ?? [
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
...
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
462
|
+
const files = options.files ?? [
|
|
463
|
+
GLOB_TS,
|
|
464
|
+
GLOB_TSX,
|
|
465
|
+
...extraFileExtensions.map((ext) => `**/*${ext}`)
|
|
466
|
+
];
|
|
467
|
+
return [
|
|
468
|
+
...ts.configs.recommendedTypeChecked,
|
|
469
|
+
{
|
|
470
|
+
files: [
|
|
471
|
+
GLOB_JS,
|
|
472
|
+
GLOB_JSX,
|
|
473
|
+
GLOB_JSON,
|
|
474
|
+
GLOB_JSON5,
|
|
475
|
+
GLOB_JSONC,
|
|
476
|
+
GLOB_YAML,
|
|
477
|
+
GLOB_TOML
|
|
478
|
+
],
|
|
479
|
+
...ts.configs.disableTypeChecked
|
|
389
480
|
},
|
|
390
|
-
|
|
391
|
-
"@typescript-eslint
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
481
|
+
{
|
|
482
|
+
name: "@kazupon/typescipt/typescript-eslint",
|
|
483
|
+
files,
|
|
484
|
+
languageOptions: {
|
|
485
|
+
parser: ts.parser,
|
|
486
|
+
parserOptions: {
|
|
487
|
+
extraFileExtensions: extraFileExtensions.map((ext) => `${ext}`),
|
|
488
|
+
sourceType: "module",
|
|
489
|
+
...parserOptions
|
|
490
|
+
}
|
|
491
|
+
},
|
|
492
|
+
rules: {
|
|
493
|
+
"@typescript-eslint/no-unused-vars": ["error", {
|
|
494
|
+
args: "all",
|
|
495
|
+
argsIgnorePattern: "^_",
|
|
496
|
+
caughtErrors: "all",
|
|
497
|
+
caughtErrorsIgnorePattern: "^_",
|
|
498
|
+
destructuredArrayIgnorePattern: "^_",
|
|
499
|
+
varsIgnorePattern: "^_",
|
|
500
|
+
ignoreRestSiblings: true
|
|
501
|
+
}],
|
|
502
|
+
...overrideRules
|
|
503
|
+
}
|
|
401
504
|
}
|
|
402
|
-
|
|
505
|
+
];
|
|
403
506
|
}
|
|
404
507
|
|
|
405
508
|
//#endregion
|
|
@@ -429,9 +532,7 @@ async function vitest(options = {}) {
|
|
|
429
532
|
files: GLOB_TESTS,
|
|
430
533
|
...vitest$1.configs["recommended"]
|
|
431
534
|
};
|
|
432
|
-
if (base.name == undefined)
|
|
433
|
-
base.name = "@vitest/eslint-plugin";
|
|
434
|
-
}
|
|
535
|
+
if (base.name == undefined) base.name = "@vitest/eslint-plugin";
|
|
435
536
|
if (typeTesting) {
|
|
436
537
|
base.files = [...base.files, ...GLOB_TESTS_TYPE];
|
|
437
538
|
base.settings = { vitest: { typecheck: true } };
|
|
@@ -442,9 +543,7 @@ async function vitest(options = {}) {
|
|
|
442
543
|
name: "@kazupon/vitest",
|
|
443
544
|
rules: { ...overrideRules }
|
|
444
545
|
};
|
|
445
|
-
if (overrideFiles.length > 0)
|
|
446
|
-
custom.files = overrideFiles;
|
|
447
|
-
}
|
|
546
|
+
if (overrideFiles.length > 0) custom.files = overrideFiles;
|
|
448
547
|
configs.push(custom);
|
|
449
548
|
return configs;
|
|
450
549
|
}
|
|
@@ -454,7 +553,7 @@ async function vitest(options = {}) {
|
|
|
454
553
|
async function vue(options = {}) {
|
|
455
554
|
const { rules: overrideRules = {}, parserOptions = { project: true } } = options;
|
|
456
555
|
const vue$1 = await loadPlugin("eslint-plugin-vue");
|
|
457
|
-
const vueParser = vue$1.configs["flat/base"][1]["languageOptions"]
|
|
556
|
+
const vueParser = vue$1.configs["flat/base"][1]["languageOptions"]?.parser;
|
|
458
557
|
const configs = [];
|
|
459
558
|
configs.push(...vue$1.configs["flat/recommended"]);
|
|
460
559
|
if (options.composable) {
|
|
@@ -465,12 +564,15 @@ async function vue(options = {}) {
|
|
|
465
564
|
}
|
|
466
565
|
if (options.scopedCss) {
|
|
467
566
|
const scopedCss = await loadPlugin("eslint-plugin-vue-scoped-css");
|
|
468
|
-
const scopedCssMapped = scopedCss.configs["flat/recommended"].map(
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
567
|
+
const scopedCssMapped = scopedCss.configs["flat/recommended"].map(
|
|
568
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
569
|
+
(config, index) => {
|
|
570
|
+
return config.name ? config : {
|
|
571
|
+
name: `vue/scoped-css/recommended/${index}`,
|
|
572
|
+
...config
|
|
573
|
+
};
|
|
574
|
+
}
|
|
575
|
+
);
|
|
474
576
|
configs.push(scopedCssMapped[0], scopedCssMapped[2]);
|
|
475
577
|
}
|
|
476
578
|
if (options.a11y) {
|
|
@@ -491,18 +593,16 @@ async function vue(options = {}) {
|
|
|
491
593
|
files: [GLOB_VUE],
|
|
492
594
|
rules: { ...overrideRules }
|
|
493
595
|
};
|
|
494
|
-
if (options.typescript) {
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
};
|
|
505
|
-
}
|
|
596
|
+
if (options.typescript) customConfig.languageOptions = {
|
|
597
|
+
parser: vueParser,
|
|
598
|
+
parserOptions: {
|
|
599
|
+
sourceType: "module",
|
|
600
|
+
parser: await getTypeScriptParser(),
|
|
601
|
+
ecmaFeatures: { jsx: true },
|
|
602
|
+
extraFileExtensions: [".vue"],
|
|
603
|
+
...parserOptions
|
|
604
|
+
}
|
|
605
|
+
};
|
|
506
606
|
configs.push(customConfig);
|
|
507
607
|
return configs;
|
|
508
608
|
}
|
|
@@ -520,14 +620,12 @@ async function yml(options = {}) {
|
|
|
520
620
|
...config
|
|
521
621
|
};
|
|
522
622
|
}));
|
|
523
|
-
if (usePrettier) {
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
}));
|
|
530
|
-
}
|
|
623
|
+
if (usePrettier) configs.push(...yml$1.configs["flat/prettier"].map((config, index) => {
|
|
624
|
+
return config.name ? config : {
|
|
625
|
+
name: `yml/flat/prettier/${index}`,
|
|
626
|
+
...config
|
|
627
|
+
};
|
|
628
|
+
}));
|
|
531
629
|
const overriddenConfig = {
|
|
532
630
|
name: "@kazupon/yml",
|
|
533
631
|
files: [GLOB_YAML],
|
|
@@ -539,111 +637,23 @@ async function yml(options = {}) {
|
|
|
539
637
|
const yaml = yml;
|
|
540
638
|
|
|
541
639
|
//#endregion
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
get: function () {
|
|
563
|
-
return javascript;
|
|
564
|
-
}
|
|
565
|
-
});
|
|
566
|
-
Object.defineProperty(exports, 'jsdoc', {
|
|
567
|
-
enumerable: true,
|
|
568
|
-
get: function () {
|
|
569
|
-
return jsdoc;
|
|
570
|
-
}
|
|
571
|
-
});
|
|
572
|
-
Object.defineProperty(exports, 'jsonc', {
|
|
573
|
-
enumerable: true,
|
|
574
|
-
get: function () {
|
|
575
|
-
return jsonc;
|
|
576
|
-
}
|
|
577
|
-
});
|
|
578
|
-
Object.defineProperty(exports, 'prettier', {
|
|
579
|
-
enumerable: true,
|
|
580
|
-
get: function () {
|
|
581
|
-
return prettier;
|
|
582
|
-
}
|
|
583
|
-
});
|
|
584
|
-
Object.defineProperty(exports, 'promise', {
|
|
585
|
-
enumerable: true,
|
|
586
|
-
get: function () {
|
|
587
|
-
return promise;
|
|
588
|
-
}
|
|
589
|
-
});
|
|
590
|
-
Object.defineProperty(exports, 'react', {
|
|
591
|
-
enumerable: true,
|
|
592
|
-
get: function () {
|
|
593
|
-
return react;
|
|
594
|
-
}
|
|
595
|
-
});
|
|
596
|
-
Object.defineProperty(exports, 'regexp', {
|
|
597
|
-
enumerable: true,
|
|
598
|
-
get: function () {
|
|
599
|
-
return regexp;
|
|
600
|
-
}
|
|
601
|
-
});
|
|
602
|
-
Object.defineProperty(exports, 'svelte', {
|
|
603
|
-
enumerable: true,
|
|
604
|
-
get: function () {
|
|
605
|
-
return svelte;
|
|
606
|
-
}
|
|
607
|
-
});
|
|
608
|
-
Object.defineProperty(exports, 'toml', {
|
|
609
|
-
enumerable: true,
|
|
610
|
-
get: function () {
|
|
611
|
-
return toml;
|
|
612
|
-
}
|
|
613
|
-
});
|
|
614
|
-
Object.defineProperty(exports, 'typescript', {
|
|
615
|
-
enumerable: true,
|
|
616
|
-
get: function () {
|
|
617
|
-
return typescript;
|
|
618
|
-
}
|
|
619
|
-
});
|
|
620
|
-
Object.defineProperty(exports, 'unicorn', {
|
|
621
|
-
enumerable: true,
|
|
622
|
-
get: function () {
|
|
623
|
-
return unicorn;
|
|
624
|
-
}
|
|
625
|
-
});
|
|
626
|
-
Object.defineProperty(exports, 'vitest', {
|
|
627
|
-
enumerable: true,
|
|
628
|
-
get: function () {
|
|
629
|
-
return vitest;
|
|
630
|
-
}
|
|
631
|
-
});
|
|
632
|
-
Object.defineProperty(exports, 'vue', {
|
|
633
|
-
enumerable: true,
|
|
634
|
-
get: function () {
|
|
635
|
-
return vue;
|
|
636
|
-
}
|
|
637
|
-
});
|
|
638
|
-
Object.defineProperty(exports, 'yaml', {
|
|
639
|
-
enumerable: true,
|
|
640
|
-
get: function () {
|
|
641
|
-
return yaml;
|
|
642
|
-
}
|
|
643
|
-
});
|
|
644
|
-
Object.defineProperty(exports, 'yml', {
|
|
645
|
-
enumerable: true,
|
|
646
|
-
get: function () {
|
|
647
|
-
return yml;
|
|
648
|
-
}
|
|
649
|
-
});
|
|
640
|
+
exports.comments = comments
|
|
641
|
+
exports.defineConfig = defineConfig
|
|
642
|
+
exports.imports = imports
|
|
643
|
+
exports.javascript = javascript
|
|
644
|
+
exports.jsdoc = jsdoc
|
|
645
|
+
exports.jsonc = jsonc
|
|
646
|
+
exports.markdown = markdown
|
|
647
|
+
exports.md = md
|
|
648
|
+
exports.prettier = prettier
|
|
649
|
+
exports.promise = promise
|
|
650
|
+
exports.react = react
|
|
651
|
+
exports.regexp = regexp
|
|
652
|
+
exports.svelte = svelte
|
|
653
|
+
exports.toml = toml
|
|
654
|
+
exports.typescript = typescript
|
|
655
|
+
exports.unicorn = unicorn
|
|
656
|
+
exports.vitest = vitest
|
|
657
|
+
exports.vue = vue
|
|
658
|
+
exports.yaml = yaml
|
|
659
|
+
exports.yml = yml
|