@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.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { FlatConfigComposer } from "eslint-flat-config-utils";
|
|
2
|
-
import {
|
|
2
|
+
import { interopDefault } from "@kazupon/jts-utils/module";
|
|
3
|
+
import globals from "globals";
|
|
3
4
|
|
|
4
5
|
//#region src/config.ts
|
|
5
6
|
function defineConfig(...configs) {
|
|
@@ -7,13 +8,6 @@ function defineConfig(...configs) {
|
|
|
7
8
|
return new FlatConfigComposer().append(...baseConfigs, ...configs);
|
|
8
9
|
}
|
|
9
10
|
|
|
10
|
-
//#endregion
|
|
11
|
-
//#region node_modules/.pnpm/@kazupon+jts-utils@0.2.0/node_modules/@kazupon/jts-utils/dist/module/index.mjs
|
|
12
|
-
async function interopDefault(mod) {
|
|
13
|
-
const resolved = await mod;
|
|
14
|
-
return resolved.default || resolved;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
11
|
//#endregion
|
|
18
12
|
//#region src/globs.ts
|
|
19
13
|
const GLOB_JS = "**/*.?([cm])js";
|
|
@@ -27,8 +21,19 @@ const GLOB_YAML = "**/*.y?(a)ml";
|
|
|
27
21
|
const GLOB_TOML = "**/*.toml";
|
|
28
22
|
const GLOB_VUE = "**/*.vue";
|
|
29
23
|
const GLOB_SVELTE = "**/*.svelte";
|
|
24
|
+
const GLOB_MARKDOWN = "**/*.md";
|
|
30
25
|
const GLOB_SRC_EXT = "?([cm])[jt]s?(x)";
|
|
31
|
-
const GLOB_TESTS = [
|
|
26
|
+
const GLOB_TESTS = [
|
|
27
|
+
`**/test/**/*.${GLOB_SRC_EXT}`,
|
|
28
|
+
`**/tests/**/*.${GLOB_SRC_EXT}`,
|
|
29
|
+
`**/spec/**/*.${GLOB_SRC_EXT}`,
|
|
30
|
+
`**/specs/**/*.${GLOB_SRC_EXT}`,
|
|
31
|
+
`**/e2e/**/*.${GLOB_SRC_EXT}`,
|
|
32
|
+
`**/__tests__/**/*.${GLOB_SRC_EXT}`,
|
|
33
|
+
`**/__test__/**/*.${GLOB_SRC_EXT}`,
|
|
34
|
+
`**/*.spec.${GLOB_SRC_EXT}`,
|
|
35
|
+
`**/*.test.${GLOB_SRC_EXT}`
|
|
36
|
+
];
|
|
32
37
|
const GLOB_TESTS_TYPE = [`**/*.test-d.${GLOB_SRC_EXT}`, `**/*.spec-d.${GLOB_SRC_EXT}`];
|
|
33
38
|
|
|
34
39
|
//#endregion
|
|
@@ -45,7 +50,11 @@ async function getTypeScriptParser() {
|
|
|
45
50
|
return ts.parser;
|
|
46
51
|
}
|
|
47
52
|
function getGlobSourceFiles(useTypeScript = false) {
|
|
48
|
-
return [
|
|
53
|
+
return [
|
|
54
|
+
GLOB_JS,
|
|
55
|
+
GLOB_JSX,
|
|
56
|
+
...useTypeScript ? [GLOB_TS, GLOB_TSX] : []
|
|
57
|
+
];
|
|
49
58
|
}
|
|
50
59
|
|
|
51
60
|
//#endregion
|
|
@@ -65,20 +74,26 @@ async function comments(options = {}) {
|
|
|
65
74
|
|
|
66
75
|
//#endregion
|
|
67
76
|
//#region src/configs/imports.ts
|
|
68
|
-
const IMPORTS_FILES = [
|
|
77
|
+
const IMPORTS_FILES = [
|
|
78
|
+
GLOB_JS,
|
|
79
|
+
GLOB_JSX,
|
|
80
|
+
GLOB_TS,
|
|
81
|
+
GLOB_TSX
|
|
82
|
+
];
|
|
69
83
|
async function imports(options = {}) {
|
|
70
84
|
const { rules: overrideRules = {} } = options;
|
|
71
|
-
const unused = await loadPlugin(
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
85
|
+
const unused = await loadPlugin(
|
|
86
|
+
// eslint-disable-line @typescript-eslint/no-unsafe-assignment
|
|
87
|
+
"eslint-plugin-unused-imports"
|
|
88
|
+
);
|
|
89
|
+
const imports$1 = await loadPlugin("eslint-plugin-import");
|
|
90
|
+
const configs = [imports$1.flatConfigs.recommended];
|
|
91
|
+
if (options.typescript) try {
|
|
92
|
+
await loadPlugin("eslint-import-resolver-typescript");
|
|
93
|
+
imports$1.flatConfigs.typescript.settings["import/resolver"]["typescript"] = true;
|
|
94
|
+
configs.push(imports$1.flatConfigs.typescript);
|
|
95
|
+
} catch (error) {
|
|
96
|
+
throw new Error(`Not found eslint-import-resolver-typescript: ${error.message}`);
|
|
82
97
|
}
|
|
83
98
|
configs.push({
|
|
84
99
|
name: "unused-imports",
|
|
@@ -148,14 +163,9 @@ async function jsdoc(options = {}) {
|
|
|
148
163
|
const jsdoc$1 = await loadPlugin("eslint-plugin-jsdoc");
|
|
149
164
|
function resolvePreset() {
|
|
150
165
|
let preset = "recommended";
|
|
151
|
-
if (typescript$1 === "syntax") {
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
preset = `${preset}-typescript-flavor`;
|
|
155
|
-
}
|
|
156
|
-
if (error) {
|
|
157
|
-
preset = `${preset}-error`;
|
|
158
|
-
}
|
|
166
|
+
if (typescript$1 === "syntax") preset = `${preset}-typescript`;
|
|
167
|
+
else if (typescript$1 === "flavor") preset = `${preset}-typescript-flavor`;
|
|
168
|
+
if (error) preset = `${preset}-error`;
|
|
159
169
|
return preset;
|
|
160
170
|
}
|
|
161
171
|
return [jsdoc$1.configs[`flat/${resolvePreset()}`], {
|
|
@@ -168,36 +178,42 @@ async function jsdoc(options = {}) {
|
|
|
168
178
|
//#region src/configs/jsonc.ts
|
|
169
179
|
async function jsonc(options = {}) {
|
|
170
180
|
const { rules: overrideRules = {} } = options;
|
|
171
|
-
const kinds = [
|
|
181
|
+
const kinds = [
|
|
182
|
+
options.json ? "json" : "",
|
|
183
|
+
options.jsonc ? "jsonc" : "",
|
|
184
|
+
options.json5 ? "json5" : ""
|
|
185
|
+
];
|
|
172
186
|
const usePrettier = !!options.prettier;
|
|
173
187
|
const jsonc$1 = await loadPlugin("eslint-plugin-jsonc");
|
|
174
188
|
const configs = [];
|
|
175
|
-
for (const kind of kinds) {
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
return config.name ? config : {
|
|
188
|
-
name: `jsonc/flat/prettier/${index}`,
|
|
189
|
-
...config
|
|
190
|
-
};
|
|
191
|
-
}));
|
|
192
|
-
}
|
|
189
|
+
for (const kind of kinds) if (kind) configs.push(...jsonc$1.configs[`flat/recommended-with-${kind}`].map((config, index) => {
|
|
190
|
+
return config.name ? config : {
|
|
191
|
+
name: `jsonc/flat/recommended-with-${kind}/${index}`,
|
|
192
|
+
...config
|
|
193
|
+
};
|
|
194
|
+
}));
|
|
195
|
+
if (usePrettier) configs.push(...jsonc$1.configs["flat/prettier"].map((config, index) => {
|
|
196
|
+
return config.name ? config : {
|
|
197
|
+
name: `jsonc/flat/prettier/${index}`,
|
|
198
|
+
...config
|
|
199
|
+
};
|
|
200
|
+
}));
|
|
193
201
|
const overriddenConfig = {
|
|
194
202
|
name: "@kazupon/jsonc",
|
|
195
|
-
files: [
|
|
203
|
+
files: [
|
|
204
|
+
GLOB_JSON,
|
|
205
|
+
GLOB_JSON5,
|
|
206
|
+
GLOB_JSONC
|
|
207
|
+
],
|
|
196
208
|
rules: { ...overrideRules }
|
|
197
209
|
};
|
|
198
210
|
configs.push(...jsoncSort(), overriddenConfig);
|
|
199
211
|
return configs;
|
|
200
212
|
}
|
|
213
|
+
/**
|
|
214
|
+
* jsonc sort configurations
|
|
215
|
+
* @returns {Linter.Config[]} jsonc sort configurations
|
|
216
|
+
*/
|
|
201
217
|
function jsoncSort() {
|
|
202
218
|
return [{
|
|
203
219
|
name: "@kazupon/jsonc/sort/package.json",
|
|
@@ -207,23 +223,94 @@ function jsoncSort() {
|
|
|
207
223
|
order: { type: "asc" },
|
|
208
224
|
pathPattern: "^files$"
|
|
209
225
|
}],
|
|
210
|
-
"jsonc/sort-keys": [
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
226
|
+
"jsonc/sort-keys": [
|
|
227
|
+
"error",
|
|
228
|
+
{
|
|
229
|
+
order: [
|
|
230
|
+
"name",
|
|
231
|
+
"description",
|
|
232
|
+
"private",
|
|
233
|
+
"version",
|
|
234
|
+
"author",
|
|
235
|
+
"contributors",
|
|
236
|
+
"license",
|
|
237
|
+
"funding",
|
|
238
|
+
"bugs",
|
|
239
|
+
"repository",
|
|
240
|
+
"keywords",
|
|
241
|
+
"homepage",
|
|
242
|
+
"publishConfig",
|
|
243
|
+
"packageManager",
|
|
244
|
+
"engines",
|
|
245
|
+
"os",
|
|
246
|
+
"cpu",
|
|
247
|
+
"type",
|
|
248
|
+
"sideEffects",
|
|
249
|
+
"bin",
|
|
250
|
+
"files",
|
|
251
|
+
"main",
|
|
252
|
+
"module",
|
|
253
|
+
"browser",
|
|
254
|
+
"unpkg",
|
|
255
|
+
"jsdelivr",
|
|
256
|
+
"directories",
|
|
257
|
+
"exports",
|
|
258
|
+
"types",
|
|
259
|
+
"typesVersions",
|
|
260
|
+
"scripts",
|
|
261
|
+
"dependencies",
|
|
262
|
+
"peerDependencies",
|
|
263
|
+
"peerDependenciesMeta",
|
|
264
|
+
"optionalDependencies",
|
|
265
|
+
"devDependencies",
|
|
266
|
+
"pnpm",
|
|
267
|
+
"overrides",
|
|
268
|
+
"resolutions",
|
|
269
|
+
"workspaces",
|
|
270
|
+
"prettier",
|
|
271
|
+
"buildOptions",
|
|
272
|
+
"lint-staged"
|
|
273
|
+
],
|
|
274
|
+
pathPattern: "^$"
|
|
275
|
+
},
|
|
276
|
+
{
|
|
277
|
+
order: { type: "asc" },
|
|
278
|
+
pathPattern: "^scripts$"
|
|
279
|
+
},
|
|
280
|
+
{
|
|
281
|
+
order: { type: "asc" },
|
|
282
|
+
pathPattern: "^(?:dev|peer|optional|bundled)?[Dd]ependencies(Meta)?$"
|
|
283
|
+
},
|
|
284
|
+
{
|
|
285
|
+
order: { type: "asc" },
|
|
286
|
+
pathPattern: "^(?:resolutions|overrides|pnpm.overrides)$"
|
|
287
|
+
}
|
|
288
|
+
]
|
|
223
289
|
}
|
|
224
290
|
}];
|
|
225
291
|
}
|
|
226
292
|
|
|
293
|
+
//#endregion
|
|
294
|
+
//#region src/configs/markdown.ts
|
|
295
|
+
async function markdown(options = {}) {
|
|
296
|
+
const { rules: overrideRules = {} } = options;
|
|
297
|
+
const language = options.language || "gfm";
|
|
298
|
+
const fencedCodeBlocks = typeof options.fencedCodeBlocks === "boolean" ? options.fencedCodeBlocks : true;
|
|
299
|
+
const markdown$1 = await loadPlugin("@eslint/markdown");
|
|
300
|
+
const recommended = markdown$1.configs["recommended"][0];
|
|
301
|
+
recommended.language = `markdown/${language}`;
|
|
302
|
+
return [
|
|
303
|
+
recommended,
|
|
304
|
+
...fencedCodeBlocks ? markdown$1.configs["processor"] : [],
|
|
305
|
+
{
|
|
306
|
+
name: "@kazupon/markdown",
|
|
307
|
+
files: [GLOB_MARKDOWN],
|
|
308
|
+
rules: { ...overrideRules }
|
|
309
|
+
}
|
|
310
|
+
];
|
|
311
|
+
}
|
|
312
|
+
const md = markdown;
|
|
313
|
+
|
|
227
314
|
//#endregion
|
|
228
315
|
//#region src/configs/prettier.ts
|
|
229
316
|
async function prettier(options = {}) {
|
|
@@ -255,7 +342,11 @@ async function react(options = {}) {
|
|
|
255
342
|
const { rules: overrideRules = {}, settings = {} } = options;
|
|
256
343
|
const useTypeScript = !options.typescript;
|
|
257
344
|
const enableRefresh = !!options.refresh;
|
|
258
|
-
const [react$1, reactHooks, reactRefresh] = await Promise.all([
|
|
345
|
+
const [react$1, reactHooks, reactRefresh] = await Promise.all([
|
|
346
|
+
loadPlugin("eslint-plugin-react"),
|
|
347
|
+
loadPlugin("eslint-plugin-react-hooks"),
|
|
348
|
+
enableRefresh ? loadPlugin("eslint-plugin-react-refresh") : null
|
|
349
|
+
]);
|
|
259
350
|
const customConfig = {
|
|
260
351
|
name: "@kazupon/react",
|
|
261
352
|
files: getGlobSourceFiles(useTypeScript),
|
|
@@ -271,13 +362,11 @@ async function react(options = {}) {
|
|
|
271
362
|
files: getGlobSourceFiles(useTypeScript),
|
|
272
363
|
plugins: { "react-hooks": reactHooks }
|
|
273
364
|
}];
|
|
274
|
-
if (enableRefresh) {
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
});
|
|
280
|
-
}
|
|
365
|
+
if (enableRefresh) configs.push({
|
|
366
|
+
name: "react-refresh/flat",
|
|
367
|
+
files: getGlobSourceFiles(useTypeScript),
|
|
368
|
+
plugins: { "react-refresh": reactRefresh }
|
|
369
|
+
});
|
|
281
370
|
return [...configs, customConfig];
|
|
282
371
|
}
|
|
283
372
|
|
|
@@ -301,24 +390,22 @@ async function svelte(options = {}) {
|
|
|
301
390
|
const { rules: overrideRules = {}, parserOptions = { project: true } } = options;
|
|
302
391
|
const useTypeScript = !!options.typescript;
|
|
303
392
|
const svelte$1 = await loadPlugin("eslint-plugin-svelte");
|
|
304
|
-
const svelteParser = svelte$1.configs["flat/base"][1]["languageOptions"]
|
|
393
|
+
const svelteParser = svelte$1.configs["flat/base"][1]["languageOptions"]?.parser;
|
|
305
394
|
const customConfig = {
|
|
306
395
|
name: "@kazupon/svelte",
|
|
307
396
|
files: [GLOB_SVELTE],
|
|
308
397
|
rules: { ...overrideRules }
|
|
309
398
|
};
|
|
310
|
-
if (useTypeScript) {
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
};
|
|
321
|
-
}
|
|
399
|
+
if (useTypeScript) customConfig.languageOptions = {
|
|
400
|
+
parser: svelteParser,
|
|
401
|
+
parserOptions: {
|
|
402
|
+
sourceType: "module",
|
|
403
|
+
parser: await getTypeScriptParser(),
|
|
404
|
+
ecmaFeatures: { jsx: true },
|
|
405
|
+
extraFileExtensions: [".svelte"],
|
|
406
|
+
...parserOptions
|
|
407
|
+
}
|
|
408
|
+
};
|
|
322
409
|
return [...svelte$1.configs["flat/recommended"], customConfig];
|
|
323
410
|
}
|
|
324
411
|
|
|
@@ -348,34 +435,50 @@ async function toml(options = {}) {
|
|
|
348
435
|
async function typescript(options = {}) {
|
|
349
436
|
const { rules: overrideRules = {}, extraFileExtensions = [], parserOptions = { project: true } } = options;
|
|
350
437
|
const ts = await loadPlugin("typescript-eslint");
|
|
351
|
-
const files = options.files ?? [
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
...
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
438
|
+
const files = options.files ?? [
|
|
439
|
+
GLOB_TS,
|
|
440
|
+
GLOB_TSX,
|
|
441
|
+
...extraFileExtensions.map((ext) => `**/*${ext}`)
|
|
442
|
+
];
|
|
443
|
+
return [
|
|
444
|
+
...ts.configs.recommendedTypeChecked,
|
|
445
|
+
{
|
|
446
|
+
files: [
|
|
447
|
+
GLOB_JS,
|
|
448
|
+
GLOB_JSX,
|
|
449
|
+
GLOB_JSON,
|
|
450
|
+
GLOB_JSON5,
|
|
451
|
+
GLOB_JSONC,
|
|
452
|
+
GLOB_YAML,
|
|
453
|
+
GLOB_TOML
|
|
454
|
+
],
|
|
455
|
+
...ts.configs.disableTypeChecked
|
|
365
456
|
},
|
|
366
|
-
|
|
367
|
-
"@typescript-eslint
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
457
|
+
{
|
|
458
|
+
name: "@kazupon/typescipt/typescript-eslint",
|
|
459
|
+
files,
|
|
460
|
+
languageOptions: {
|
|
461
|
+
parser: ts.parser,
|
|
462
|
+
parserOptions: {
|
|
463
|
+
extraFileExtensions: extraFileExtensions.map((ext) => `${ext}`),
|
|
464
|
+
sourceType: "module",
|
|
465
|
+
...parserOptions
|
|
466
|
+
}
|
|
467
|
+
},
|
|
468
|
+
rules: {
|
|
469
|
+
"@typescript-eslint/no-unused-vars": ["error", {
|
|
470
|
+
args: "all",
|
|
471
|
+
argsIgnorePattern: "^_",
|
|
472
|
+
caughtErrors: "all",
|
|
473
|
+
caughtErrorsIgnorePattern: "^_",
|
|
474
|
+
destructuredArrayIgnorePattern: "^_",
|
|
475
|
+
varsIgnorePattern: "^_",
|
|
476
|
+
ignoreRestSiblings: true
|
|
477
|
+
}],
|
|
478
|
+
...overrideRules
|
|
479
|
+
}
|
|
377
480
|
}
|
|
378
|
-
|
|
481
|
+
];
|
|
379
482
|
}
|
|
380
483
|
|
|
381
484
|
//#endregion
|
|
@@ -405,9 +508,7 @@ async function vitest(options = {}) {
|
|
|
405
508
|
files: GLOB_TESTS,
|
|
406
509
|
...vitest$1.configs["recommended"]
|
|
407
510
|
};
|
|
408
|
-
if (base.name == undefined)
|
|
409
|
-
base.name = "@vitest/eslint-plugin";
|
|
410
|
-
}
|
|
511
|
+
if (base.name == undefined) base.name = "@vitest/eslint-plugin";
|
|
411
512
|
if (typeTesting) {
|
|
412
513
|
base.files = [...base.files, ...GLOB_TESTS_TYPE];
|
|
413
514
|
base.settings = { vitest: { typecheck: true } };
|
|
@@ -418,9 +519,7 @@ async function vitest(options = {}) {
|
|
|
418
519
|
name: "@kazupon/vitest",
|
|
419
520
|
rules: { ...overrideRules }
|
|
420
521
|
};
|
|
421
|
-
if (overrideFiles.length > 0)
|
|
422
|
-
custom.files = overrideFiles;
|
|
423
|
-
}
|
|
522
|
+
if (overrideFiles.length > 0) custom.files = overrideFiles;
|
|
424
523
|
configs.push(custom);
|
|
425
524
|
return configs;
|
|
426
525
|
}
|
|
@@ -430,7 +529,7 @@ async function vitest(options = {}) {
|
|
|
430
529
|
async function vue(options = {}) {
|
|
431
530
|
const { rules: overrideRules = {}, parserOptions = { project: true } } = options;
|
|
432
531
|
const vue$1 = await loadPlugin("eslint-plugin-vue");
|
|
433
|
-
const vueParser = vue$1.configs["flat/base"][1]["languageOptions"]
|
|
532
|
+
const vueParser = vue$1.configs["flat/base"][1]["languageOptions"]?.parser;
|
|
434
533
|
const configs = [];
|
|
435
534
|
configs.push(...vue$1.configs["flat/recommended"]);
|
|
436
535
|
if (options.composable) {
|
|
@@ -441,12 +540,15 @@ async function vue(options = {}) {
|
|
|
441
540
|
}
|
|
442
541
|
if (options.scopedCss) {
|
|
443
542
|
const scopedCss = await loadPlugin("eslint-plugin-vue-scoped-css");
|
|
444
|
-
const scopedCssMapped = scopedCss.configs["flat/recommended"].map(
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
543
|
+
const scopedCssMapped = scopedCss.configs["flat/recommended"].map(
|
|
544
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
545
|
+
(config, index) => {
|
|
546
|
+
return config.name ? config : {
|
|
547
|
+
name: `vue/scoped-css/recommended/${index}`,
|
|
548
|
+
...config
|
|
549
|
+
};
|
|
550
|
+
}
|
|
551
|
+
);
|
|
450
552
|
configs.push(scopedCssMapped[0], scopedCssMapped[2]);
|
|
451
553
|
}
|
|
452
554
|
if (options.a11y) {
|
|
@@ -467,18 +569,16 @@ async function vue(options = {}) {
|
|
|
467
569
|
files: [GLOB_VUE],
|
|
468
570
|
rules: { ...overrideRules }
|
|
469
571
|
};
|
|
470
|
-
if (options.typescript) {
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
};
|
|
481
|
-
}
|
|
572
|
+
if (options.typescript) customConfig.languageOptions = {
|
|
573
|
+
parser: vueParser,
|
|
574
|
+
parserOptions: {
|
|
575
|
+
sourceType: "module",
|
|
576
|
+
parser: await getTypeScriptParser(),
|
|
577
|
+
ecmaFeatures: { jsx: true },
|
|
578
|
+
extraFileExtensions: [".vue"],
|
|
579
|
+
...parserOptions
|
|
580
|
+
}
|
|
581
|
+
};
|
|
482
582
|
configs.push(customConfig);
|
|
483
583
|
return configs;
|
|
484
584
|
}
|
|
@@ -496,14 +596,12 @@ async function yml(options = {}) {
|
|
|
496
596
|
...config
|
|
497
597
|
};
|
|
498
598
|
}));
|
|
499
|
-
if (usePrettier) {
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
}));
|
|
506
|
-
}
|
|
599
|
+
if (usePrettier) configs.push(...yml$1.configs["flat/prettier"].map((config, index) => {
|
|
600
|
+
return config.name ? config : {
|
|
601
|
+
name: `yml/flat/prettier/${index}`,
|
|
602
|
+
...config
|
|
603
|
+
};
|
|
604
|
+
}));
|
|
507
605
|
const overriddenConfig = {
|
|
508
606
|
name: "@kazupon/yml",
|
|
509
607
|
files: [GLOB_YAML],
|
|
@@ -515,4 +613,4 @@ async function yml(options = {}) {
|
|
|
515
613
|
const yaml = yml;
|
|
516
614
|
|
|
517
615
|
//#endregion
|
|
518
|
-
export { comments, defineConfig, imports, javascript, jsdoc, jsonc, prettier, promise, react, regexp, svelte, toml, typescript, unicorn, vitest, vue, yaml, yml };
|
|
616
|
+
export { comments, defineConfig, imports, javascript, jsdoc, jsonc, markdown, md, prettier, promise, react, regexp, svelte, toml, typescript, unicorn, vitest, vue, yaml, yml };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kazupon/eslint-config",
|
|
3
3
|
"description": "ESLint config for @kazupon",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.19.0",
|
|
5
5
|
"author": {
|
|
6
6
|
"email": "kawakazu80@gmail.com",
|
|
7
7
|
"name": "kazuya kawaguchi"
|
|
@@ -42,16 +42,17 @@
|
|
|
42
42
|
"dependencies": {
|
|
43
43
|
"@eslint-community/eslint-plugin-eslint-comments": "^4.3.0",
|
|
44
44
|
"@eslint/js": "^9.0.0",
|
|
45
|
-
"@kazupon/jts-utils": "^0.2
|
|
46
|
-
"eslint-flat-config-utils": "^0.
|
|
45
|
+
"@kazupon/jts-utils": "^0.3.2",
|
|
46
|
+
"eslint-flat-config-utils": "^2.0.0",
|
|
47
47
|
"globals": "^15.8.0"
|
|
48
48
|
},
|
|
49
49
|
"peerDependencies": {
|
|
50
|
+
"@eslint/markdown": ">=6.1.0",
|
|
50
51
|
"@vitest/eslint-plugin": ">=1.0.0",
|
|
51
52
|
"eslint": ">=8.56.0 || >=9.0.0",
|
|
52
53
|
"eslint-config-prettier": ">=9.1.0",
|
|
53
54
|
"eslint-import-resolver-typescript": ">=3.6.0",
|
|
54
|
-
"eslint-plugin-import
|
|
55
|
+
"eslint-plugin-import": ">=2.31.0",
|
|
55
56
|
"eslint-plugin-jsdoc": ">=48.5.0",
|
|
56
57
|
"eslint-plugin-jsonc": ">=2.16.0",
|
|
57
58
|
"eslint-plugin-promise": ">=6.4.0",
|
|
@@ -72,6 +73,9 @@
|
|
|
72
73
|
"typescript-eslint": ">=7.0.0"
|
|
73
74
|
},
|
|
74
75
|
"peerDependenciesMeta": {
|
|
76
|
+
"@eslint/markdown": {
|
|
77
|
+
"optional": true
|
|
78
|
+
},
|
|
75
79
|
"@vitest/eslint-plugin": {
|
|
76
80
|
"optional": true
|
|
77
81
|
},
|
|
@@ -81,7 +85,7 @@
|
|
|
81
85
|
"eslint-import-resolver-typescript": {
|
|
82
86
|
"optional": true
|
|
83
87
|
},
|
|
84
|
-
"eslint-plugin-import
|
|
88
|
+
"eslint-plugin-import": {
|
|
85
89
|
"optional": true
|
|
86
90
|
},
|
|
87
91
|
"eslint-plugin-jsdoc": {
|
|
@@ -140,52 +144,53 @@
|
|
|
140
144
|
}
|
|
141
145
|
},
|
|
142
146
|
"devDependencies": {
|
|
147
|
+
"@eslint/markdown": "^6.1.1",
|
|
143
148
|
"@kazupon/prettier-config": "^0.1.1",
|
|
144
|
-
"@types/eslint": "^9.6.
|
|
149
|
+
"@types/eslint": "^9.6.1",
|
|
145
150
|
"@types/node": "^22.5.0",
|
|
146
151
|
"@vitest/eslint-plugin": "^1.0.3",
|
|
147
|
-
"bumpp": "^
|
|
148
|
-
"eslint": "^9.
|
|
149
|
-
"eslint-config-prettier": "^
|
|
152
|
+
"bumpp": "^10.0.1",
|
|
153
|
+
"eslint": "^9.11.0",
|
|
154
|
+
"eslint-config-prettier": "^10.0.1",
|
|
150
155
|
"eslint-import-resolver-typescript": "^3.6.3",
|
|
151
|
-
"eslint-plugin-import
|
|
156
|
+
"eslint-plugin-import": "^2.31.0",
|
|
152
157
|
"eslint-plugin-jsdoc": "^50.0.0",
|
|
153
158
|
"eslint-plugin-jsonc": "^2.16.0",
|
|
154
159
|
"eslint-plugin-promise": "^7.0.0",
|
|
155
160
|
"eslint-plugin-react": "^7.35.0",
|
|
156
|
-
"eslint-plugin-react-hooks": "^
|
|
161
|
+
"eslint-plugin-react-hooks": "^5.1.0",
|
|
157
162
|
"eslint-plugin-react-refresh": "^0.4.9",
|
|
158
163
|
"eslint-plugin-regexp": "^2.6.0",
|
|
159
164
|
"eslint-plugin-svelte": "^2.43.0",
|
|
160
|
-
"eslint-plugin-toml": "^0.
|
|
161
|
-
"eslint-plugin-unicorn": "^
|
|
165
|
+
"eslint-plugin-toml": "^0.12.0",
|
|
166
|
+
"eslint-plugin-unicorn": "^56.0.0",
|
|
162
167
|
"eslint-plugin-unused-imports": "^4.1.3",
|
|
163
168
|
"eslint-plugin-vue": "^9.27.0",
|
|
164
169
|
"eslint-plugin-vue-composable": "^1.0.0",
|
|
165
170
|
"eslint-plugin-vue-scoped-css": "^2.8.1",
|
|
166
171
|
"eslint-plugin-vuejs-accessibility": "^2.4.1",
|
|
167
172
|
"eslint-plugin-yml": "^1.14.0",
|
|
168
|
-
"eslint-typegen": "^0.
|
|
173
|
+
"eslint-typegen": "^1.0.0",
|
|
169
174
|
"gh-changelogen": "^0.2.8",
|
|
170
|
-
"jiti": "^
|
|
175
|
+
"jiti": "^2.0.0",
|
|
171
176
|
"lint-staged": "^15.2.7",
|
|
172
|
-
"npm-run-all2": "^
|
|
177
|
+
"npm-run-all2": "^7.0.2",
|
|
173
178
|
"prettier": "^3.3.2",
|
|
174
179
|
"svelte": "^4.2.18",
|
|
175
|
-
"tsdown": "^0.
|
|
180
|
+
"tsdown": "^0.5.6",
|
|
176
181
|
"typescript": "^5.5.3",
|
|
177
182
|
"typescript-eslint": "^8.1.0",
|
|
178
|
-
"vitest": "^
|
|
183
|
+
"vitest": "^3.0.4"
|
|
179
184
|
},
|
|
180
185
|
"prettier": "@kazupon/prettier-config",
|
|
181
186
|
"lint-staged": {
|
|
182
187
|
"*.ts?(x)": [
|
|
183
188
|
"prettier --parser=typescript --write",
|
|
184
|
-
"eslint --
|
|
189
|
+
"eslint --fix"
|
|
185
190
|
],
|
|
186
191
|
"*.{js,mjs,cjs}": [
|
|
187
192
|
"prettier --write",
|
|
188
|
-
"eslint --
|
|
193
|
+
"eslint --fix"
|
|
189
194
|
],
|
|
190
195
|
"*.{json,jsonc,json5,md,yml,yaml}": [
|
|
191
196
|
"prettier --write"
|
|
@@ -197,10 +202,10 @@
|
|
|
197
202
|
"changelog": "gh-changelogen --repo=kazupon/eslint-config",
|
|
198
203
|
"dev": "pnpx @eslint/config-inspector --config eslint.config.ts",
|
|
199
204
|
"fix": "run-p \"fix:* {@}\" --",
|
|
200
|
-
"fix:eslint": "eslint
|
|
205
|
+
"fix:eslint": "eslint . --fix",
|
|
201
206
|
"fix:prettier": "prettier . --write",
|
|
202
207
|
"lint": "run-p \"lint:* {@}\" --",
|
|
203
|
-
"lint:eslint": "eslint
|
|
208
|
+
"lint:eslint": "eslint .",
|
|
204
209
|
"lint:prettier": "prettier . --check",
|
|
205
210
|
"release": "bumpp --commit \"release: v%s\" --all --push --tag",
|
|
206
211
|
"test": "vitest --typecheck",
|
package/dist/config.d.cts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { FlatConfigComposer } from 'eslint-flat-config-utils';
|
|
2
|
-
import type { Linter } from 'eslint';
|
|
3
|
-
import type { Awaitable } from '@kazupon/jts-utils/types';
|
|
4
|
-
/**
|
|
5
|
-
* define eslint configurations
|
|
6
|
-
* @param {Awaitable<Linter.Config | Linter.Config[]>[]} configs eslint flat configurations
|
|
7
|
-
* @returns {FlatConfigComposer} eslint flat configuration composer
|
|
8
|
-
*/
|
|
9
|
-
export declare function defineConfig(...configs: Awaitable<Linter.Config | Linter.Config[]>[]): FlatConfigComposer;
|