@kazupon/eslint-config 0.16.0 → 0.18.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.
Files changed (60) hide show
  1. package/README.md +8 -1
  2. package/dist/config.d.cts +1 -1
  3. package/dist/config.d.ts +1 -1
  4. package/dist/configs/comments.d.cts +1 -1
  5. package/dist/configs/comments.d.ts +1 -1
  6. package/dist/configs/imports.d.cts +9 -4
  7. package/dist/configs/imports.d.ts +9 -4
  8. package/dist/configs/index.d.cts +17 -16
  9. package/dist/configs/index.d.ts +17 -16
  10. package/dist/configs/javascript.d.cts +1 -1
  11. package/dist/configs/javascript.d.ts +1 -1
  12. package/dist/configs/jsdoc.d.cts +1 -1
  13. package/dist/configs/jsdoc.d.ts +1 -1
  14. package/dist/configs/jsonc.d.cts +1 -1
  15. package/dist/configs/jsonc.d.ts +1 -1
  16. package/dist/configs/markdown.d.cts +28 -0
  17. package/dist/configs/markdown.d.ts +28 -0
  18. package/dist/configs/prettier.d.cts +1 -1
  19. package/dist/configs/prettier.d.ts +1 -1
  20. package/dist/configs/promise.d.cts +1 -1
  21. package/dist/configs/promise.d.ts +1 -1
  22. package/dist/configs/react.d.cts +2 -2
  23. package/dist/configs/react.d.ts +2 -2
  24. package/dist/configs/regexp.d.cts +1 -1
  25. package/dist/configs/regexp.d.ts +1 -1
  26. package/dist/configs/svelte.d.cts +2 -2
  27. package/dist/configs/svelte.d.ts +2 -2
  28. package/dist/configs/toml.d.cts +1 -1
  29. package/dist/configs/toml.d.ts +1 -1
  30. package/dist/configs/typescript.d.cts +1 -1
  31. package/dist/configs/typescript.d.ts +1 -1
  32. package/dist/configs/unicorn.d.cts +1 -1
  33. package/dist/configs/unicorn.d.ts +1 -1
  34. package/dist/configs/vitest.d.cts +1 -1
  35. package/dist/configs/vitest.d.ts +1 -1
  36. package/dist/configs/vue.d.cts +2 -2
  37. package/dist/configs/vue.d.ts +2 -2
  38. package/dist/configs/yml.d.cts +1 -1
  39. package/dist/configs/yml.d.ts +1 -1
  40. package/dist/globs.d.cts +1 -0
  41. package/dist/globs.d.ts +1 -0
  42. package/dist/index.cjs +399 -259
  43. package/dist/index.d.cts +3 -3
  44. package/dist/index.d.ts +3 -3
  45. package/dist/index.js +388 -260
  46. package/dist/types/gens/eslint.d.cts +2 -1
  47. package/dist/types/gens/eslint.d.ts +2 -1
  48. package/dist/types/gens/imports.d.cts +478 -0
  49. package/dist/types/gens/imports.d.ts +478 -0
  50. package/dist/types/gens/javascript.d.cts +6 -1
  51. package/dist/types/gens/javascript.d.ts +6 -1
  52. package/dist/types/gens/markdown.d.cts +42 -0
  53. package/dist/types/gens/markdown.d.ts +42 -0
  54. package/dist/types/gens/unicorn.d.cts +153 -138
  55. package/dist/types/gens/unicorn.d.ts +153 -138
  56. package/dist/types/index.d.cts +19 -18
  57. package/dist/types/index.d.ts +19 -18
  58. package/dist/types/overrides.d.cts +1 -1
  59. package/dist/types/overrides.d.ts +1 -1
  60. package/package.json +22 -7
package/dist/index.cjs CHANGED
@@ -23,6 +23,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
23
23
 
24
24
  //#endregion
25
25
  const { FlatConfigComposer } = __toESM(require("eslint-flat-config-utils"));
26
+ const { interopDefault } = __toESM(require("@kazupon/jts-utils/module"));
26
27
  const { default: globals } = __toESM(require("globals"));
27
28
 
28
29
  //#region src/config.ts
@@ -44,17 +45,21 @@ const GLOB_YAML = "**/*.y?(a)ml";
44
45
  const GLOB_TOML = "**/*.toml";
45
46
  const GLOB_VUE = "**/*.vue";
46
47
  const GLOB_SVELTE = "**/*.svelte";
48
+ const GLOB_MARKDOWN = "**/*.md";
47
49
  const GLOB_SRC_EXT = "?([cm])[jt]s?(x)";
48
- const GLOB_TESTS = [`**/test/**/*.${GLOB_SRC_EXT}`, `**/tests/**/*.${GLOB_SRC_EXT}`, `**/spec/**/*.${GLOB_SRC_EXT}`, `**/specs/**/*.${GLOB_SRC_EXT}`, `**/e2e/**/*.${GLOB_SRC_EXT}`, `**/__tests__/**/*.${GLOB_SRC_EXT}`, `**/__test__/**/*.${GLOB_SRC_EXT}`, `**/*.spec.${GLOB_SRC_EXT}`, `**/*.test.${GLOB_SRC_EXT}`];
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
+ ];
49
61
  const GLOB_TESTS_TYPE = [`**/*.test-d.${GLOB_SRC_EXT}`, `**/*.spec-d.${GLOB_SRC_EXT}`];
50
62
 
51
- //#endregion
52
- //#region node_modules/.pnpm/@kazupon+jts-utils@0.2.0/node_modules/@kazupon/jts-utils/dist/module/index.mjs
53
- async function interopDefault(mod) {
54
- const resolved = await mod;
55
- return resolved.default || resolved;
56
- }
57
-
58
63
  //#endregion
59
64
  //#region src/utils.ts
60
65
  async function loadPlugin(name) {
@@ -69,7 +74,77 @@ async function getTypeScriptParser() {
69
74
  return ts.parser;
70
75
  }
71
76
  function getGlobSourceFiles(useTypeScript = false) {
72
- return [GLOB_JS, GLOB_JSX, ...useTypeScript ? [GLOB_TS, GLOB_TSX] : []];
77
+ return [
78
+ GLOB_JS,
79
+ GLOB_JSX,
80
+ ...useTypeScript ? [GLOB_TS, GLOB_TSX] : []
81
+ ];
82
+ }
83
+
84
+ //#endregion
85
+ //#region src/configs/comments.ts
86
+ async function comments(options = {}) {
87
+ const { rules: overrideRules = {} } = options;
88
+ const comments$1 = await loadPlugin("@eslint-community/eslint-plugin-eslint-comments");
89
+ return [{
90
+ name: "@eslint-community/eslint-comments/recommended",
91
+ plugins: { "@eslint-community/eslint-comments": comments$1 },
92
+ rules: { ...comments$1.configs.recommended.rules }
93
+ }, {
94
+ name: "@kazupon/eslint-comments",
95
+ rules: { ...overrideRules }
96
+ }];
97
+ }
98
+
99
+ //#endregion
100
+ //#region src/configs/imports.ts
101
+ const IMPORTS_FILES = [
102
+ GLOB_JS,
103
+ GLOB_JSX,
104
+ GLOB_TS,
105
+ GLOB_TSX
106
+ ];
107
+ async function imports(options = {}) {
108
+ const { rules: overrideRules = {} } = options;
109
+ const unused = await loadPlugin("eslint-plugin-unused-imports");
110
+ const imports$1 = await loadPlugin("eslint-plugin-import");
111
+ const configs = [imports$1.flatConfigs.recommended];
112
+ if (options.typescript) {
113
+ try {
114
+ await loadPlugin("eslint-import-resolver-typescript");
115
+ imports$1.flatConfigs.typescript.settings["import/resolver"]["typescript"] = true;
116
+ configs.push(imports$1.flatConfigs.typescript);
117
+ } catch (error) {
118
+ throw new Error(`Not found eslint-import-resolver-typescript: ${error.message}`);
119
+ }
120
+ }
121
+ configs.push({
122
+ name: "unused-imports",
123
+ plugins: { "unused-imports": unused },
124
+ files: IMPORTS_FILES,
125
+ rules: {
126
+ "no-unused-vars": "off",
127
+ "@typescript-eslint/no-unused-vars": "off",
128
+ "unused-imports/no-unused-imports": "error",
129
+ "unused-imports/no-unused-vars": ["error", {
130
+ args: "all",
131
+ argsIgnorePattern: "^_",
132
+ caughtErrors: "all",
133
+ caughtErrorsIgnorePattern: "^_",
134
+ destructuredArrayIgnorePattern: "^_",
135
+ vars: "all",
136
+ varsIgnorePattern: "^_",
137
+ ignoreRestSiblings: true
138
+ }]
139
+ }
140
+ });
141
+ const overriddenConfig = {
142
+ name: "@kazupon/imports",
143
+ files: IMPORTS_FILES,
144
+ rules: { ...overrideRules }
145
+ };
146
+ configs.push(overriddenConfig);
147
+ return configs;
73
148
  }
74
149
 
75
150
  //#endregion
@@ -104,56 +179,6 @@ async function javascript(options = {}) {
104
179
  }];
105
180
  }
106
181
 
107
- //#endregion
108
- //#region src/configs/comments.ts
109
- async function comments(options = {}) {
110
- const { rules: overrideRules = {} } = options;
111
- const comments$1 = await loadPlugin("@eslint-community/eslint-plugin-eslint-comments");
112
- return [{
113
- name: "@eslint-community/eslint-comments/recommended",
114
- plugins: { "@eslint-community/eslint-comments": comments$1 },
115
- rules: { ...comments$1.configs.recommended.rules }
116
- }, {
117
- name: "@kazupon/eslint-comments",
118
- rules: { ...overrideRules }
119
- }];
120
- }
121
-
122
- //#endregion
123
- //#region src/configs/typescript.ts
124
- async function typescript(options = {}) {
125
- const { rules: overrideRules = {}, extraFileExtensions = [], parserOptions = { project: true } } = options;
126
- const ts = await loadPlugin("typescript-eslint");
127
- const files = options.files ?? [GLOB_TS, GLOB_TSX, ...extraFileExtensions.map((ext) => `**/*${ext}`)];
128
- return [...ts.configs.recommendedTypeChecked, {
129
- files: [GLOB_JS, GLOB_JSX, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_YAML, GLOB_TOML],
130
- ...ts.configs.disableTypeChecked
131
- }, {
132
- name: "@kazupon/typescipt/typescript-eslint",
133
- files,
134
- languageOptions: {
135
- parser: ts.parser,
136
- parserOptions: {
137
- extraFileExtensions: extraFileExtensions.map((ext) => `${ext}`),
138
- sourceType: "module",
139
- ...parserOptions
140
- }
141
- },
142
- rules: {
143
- "@typescript-eslint/no-unused-vars": ["error", {
144
- args: "all",
145
- argsIgnorePattern: "^_",
146
- caughtErrors: "all",
147
- caughtErrorsIgnorePattern: "^_",
148
- destructuredArrayIgnorePattern: "^_",
149
- varsIgnorePattern: "^_",
150
- ignoreRestSiblings: true
151
- }],
152
- ...overrideRules
153
- }
154
- }];
155
- }
156
-
157
182
  //#endregion
158
183
  //#region src/configs/jsdoc.ts
159
184
  async function jsdoc(options = {}) {
@@ -178,39 +203,158 @@ async function jsdoc(options = {}) {
178
203
  }
179
204
 
180
205
  //#endregion
181
- //#region src/configs/imports.ts
182
- const IMPORTS_FILES = [GLOB_JS, GLOB_JSX, GLOB_TS, GLOB_TSX];
183
- async function imports(options = {}) {
206
+ //#region src/configs/jsonc.ts
207
+ async function jsonc(options = {}) {
184
208
  const { rules: overrideRules = {} } = options;
185
- const unused = await loadPlugin("eslint-plugin-unused-imports");
186
- const configs = [{
187
- name: "unused-imports",
188
- plugins: { "unused-imports": unused },
189
- files: IMPORTS_FILES,
190
- rules: {
191
- "no-unused-vars": "off",
192
- "@typescript-eslint/no-unused-vars": "off",
193
- "unused-imports/no-unused-imports": "error",
194
- "unused-imports/no-unused-vars": ["error", {
195
- args: "all",
196
- argsIgnorePattern: "^_",
197
- caughtErrors: "all",
198
- caughtErrorsIgnorePattern: "^_",
199
- destructuredArrayIgnorePattern: "^_",
200
- vars: "all",
201
- varsIgnorePattern: "^_",
202
- ignoreRestSiblings: true
203
- }]
209
+ const kinds = [
210
+ options.json ? "json" : "",
211
+ options.jsonc ? "jsonc" : "",
212
+ options.json5 ? "json5" : ""
213
+ ];
214
+ const usePrettier = !!options.prettier;
215
+ const jsonc$1 = await loadPlugin("eslint-plugin-jsonc");
216
+ const configs = [];
217
+ for (const kind of kinds) {
218
+ if (kind) {
219
+ configs.push(...jsonc$1.configs[`flat/recommended-with-${kind}`].map((config, index) => {
220
+ return config.name ? config : {
221
+ name: `jsonc/flat/recommended-with-${kind}/${index}`,
222
+ ...config
223
+ };
224
+ }));
204
225
  }
205
- }];
226
+ }
227
+ if (usePrettier) {
228
+ configs.push(...jsonc$1.configs["flat/prettier"].map((config, index) => {
229
+ return config.name ? config : {
230
+ name: `jsonc/flat/prettier/${index}`,
231
+ ...config
232
+ };
233
+ }));
234
+ }
206
235
  const overriddenConfig = {
207
- name: "@kazupon/imports",
208
- files: IMPORTS_FILES,
236
+ name: "@kazupon/jsonc",
237
+ files: [
238
+ GLOB_JSON,
239
+ GLOB_JSON5,
240
+ GLOB_JSONC
241
+ ],
209
242
  rules: { ...overrideRules }
210
243
  };
211
- configs.push(overriddenConfig);
244
+ configs.push(...jsoncSort(), overriddenConfig);
212
245
  return configs;
213
246
  }
247
+ /**
248
+ * jsonc sort configurations
249
+ * @returns {Linter.Config[]} jsonc sort configurations
250
+ */
251
+ function jsoncSort() {
252
+ return [{
253
+ name: "@kazupon/jsonc/sort/package.json",
254
+ files: ["**/package.json"],
255
+ rules: {
256
+ "jsonc/sort-array-values": ["error", {
257
+ order: { type: "asc" },
258
+ pathPattern: "^files$"
259
+ }],
260
+ "jsonc/sort-keys": [
261
+ "error",
262
+ {
263
+ order: [
264
+ "name",
265
+ "description",
266
+ "private",
267
+ "version",
268
+ "author",
269
+ "contributors",
270
+ "license",
271
+ "funding",
272
+ "bugs",
273
+ "repository",
274
+ "keywords",
275
+ "homepage",
276
+ "publishConfig",
277
+ "packageManager",
278
+ "engines",
279
+ "os",
280
+ "cpu",
281
+ "type",
282
+ "sideEffects",
283
+ "bin",
284
+ "files",
285
+ "main",
286
+ "module",
287
+ "browser",
288
+ "unpkg",
289
+ "jsdelivr",
290
+ "directories",
291
+ "exports",
292
+ "types",
293
+ "typesVersions",
294
+ "scripts",
295
+ "dependencies",
296
+ "peerDependencies",
297
+ "peerDependenciesMeta",
298
+ "optionalDependencies",
299
+ "devDependencies",
300
+ "pnpm",
301
+ "overrides",
302
+ "resolutions",
303
+ "workspaces",
304
+ "prettier",
305
+ "buildOptions",
306
+ "lint-staged"
307
+ ],
308
+ pathPattern: "^$"
309
+ },
310
+ {
311
+ order: { type: "asc" },
312
+ pathPattern: "^scripts$"
313
+ },
314
+ {
315
+ order: { type: "asc" },
316
+ pathPattern: "^(?:dev|peer|optional|bundled)?[Dd]ependencies(Meta)?$"
317
+ },
318
+ {
319
+ order: { type: "asc" },
320
+ pathPattern: "^(?:resolutions|overrides|pnpm.overrides)$"
321
+ }
322
+ ]
323
+ }
324
+ }];
325
+ }
326
+
327
+ //#endregion
328
+ //#region src/configs/markdown.ts
329
+ async function markdown(options = {}) {
330
+ const { rules: overrideRules = {} } = options;
331
+ const language = options.language || "gfm";
332
+ const fencedCodeBlocks = typeof options.fencedCodeBlocks === "boolean" ? options.fencedCodeBlocks : true;
333
+ const markdown$1 = await loadPlugin("@eslint/markdown");
334
+ const recommended = markdown$1.configs["recommended"][0];
335
+ recommended.language = `markdown/${language}`;
336
+ return [
337
+ recommended,
338
+ ...fencedCodeBlocks ? markdown$1.configs["processor"] : [],
339
+ {
340
+ name: "@kazupon/markdown",
341
+ files: [GLOB_MARKDOWN],
342
+ rules: { ...overrideRules }
343
+ }
344
+ ];
345
+ }
346
+ const md = markdown;
347
+
348
+ //#endregion
349
+ //#region src/configs/prettier.ts
350
+ async function prettier(options = {}) {
351
+ const { rules: overrideRules = {} } = options;
352
+ const prettier$1 = await loadPlugin("eslint-config-prettier");
353
+ return [prettier$1, {
354
+ name: "@kazupon/prettier",
355
+ rules: { ...overrideRules }
356
+ }];
357
+ }
214
358
 
215
359
  //#endregion
216
360
  //#region src/configs/promise.ts
@@ -226,6 +370,42 @@ async function promise(options = {}) {
226
370
  }];
227
371
  }
228
372
 
373
+ //#endregion
374
+ //#region src/configs/react.ts
375
+ async function react(options = {}) {
376
+ const { rules: overrideRules = {}, settings = {} } = options;
377
+ const useTypeScript = !options.typescript;
378
+ const enableRefresh = !!options.refresh;
379
+ const [react$1, reactHooks, reactRefresh] = await Promise.all([
380
+ loadPlugin("eslint-plugin-react"),
381
+ loadPlugin("eslint-plugin-react-hooks"),
382
+ enableRefresh ? loadPlugin("eslint-plugin-react-refresh") : null
383
+ ]);
384
+ const customConfig = {
385
+ name: "@kazupon/react",
386
+ files: getGlobSourceFiles(useTypeScript),
387
+ rules: { ...overrideRules }
388
+ };
389
+ const configs = [{
390
+ name: "react/flat/recommended",
391
+ files: getGlobSourceFiles(useTypeScript),
392
+ settings,
393
+ ...react$1.configs.flat.recommended
394
+ }, {
395
+ name: "react-hooks/flat",
396
+ files: getGlobSourceFiles(useTypeScript),
397
+ plugins: { "react-hooks": reactHooks }
398
+ }];
399
+ if (enableRefresh) {
400
+ configs.push({
401
+ name: "react-refresh/flat",
402
+ files: getGlobSourceFiles(useTypeScript),
403
+ plugins: { "react-refresh": reactRefresh }
404
+ });
405
+ }
406
+ return [...configs, customConfig];
407
+ }
408
+
229
409
  //#endregion
230
410
  //#region src/configs/regexp.ts
231
411
  async function regexp(options = {}) {
@@ -240,6 +420,33 @@ async function regexp(options = {}) {
240
420
  }];
241
421
  }
242
422
 
423
+ //#endregion
424
+ //#region src/configs/svelte.ts
425
+ async function svelte(options = {}) {
426
+ const { rules: overrideRules = {}, parserOptions = { project: true } } = options;
427
+ const useTypeScript = !!options.typescript;
428
+ const svelte$1 = await loadPlugin("eslint-plugin-svelte");
429
+ const svelteParser = svelte$1.configs["flat/base"][1]["languageOptions"]["parser"];
430
+ const customConfig = {
431
+ name: "@kazupon/svelte",
432
+ files: [GLOB_SVELTE],
433
+ rules: { ...overrideRules }
434
+ };
435
+ if (useTypeScript) {
436
+ customConfig.languageOptions = {
437
+ parser: svelteParser,
438
+ parserOptions: {
439
+ sourceType: "module",
440
+ parser: await getTypeScriptParser(),
441
+ ecmaFeatures: { jsx: true },
442
+ extraFileExtensions: [".svelte"],
443
+ ...parserOptions
444
+ }
445
+ };
446
+ }
447
+ return [...svelte$1.configs["flat/recommended"], customConfig];
448
+ }
449
+
243
450
  //#endregion
244
451
  //#region src/configs/toml.ts
245
452
  async function toml(options = {}) {
@@ -261,6 +468,57 @@ async function toml(options = {}) {
261
468
  return configs;
262
469
  }
263
470
 
471
+ //#endregion
472
+ //#region src/configs/typescript.ts
473
+ async function typescript(options = {}) {
474
+ const { rules: overrideRules = {}, extraFileExtensions = [], parserOptions = { project: true } } = options;
475
+ const ts = await loadPlugin("typescript-eslint");
476
+ const files = options.files ?? [
477
+ GLOB_TS,
478
+ GLOB_TSX,
479
+ ...extraFileExtensions.map((ext) => `**/*${ext}`)
480
+ ];
481
+ return [
482
+ ...ts.configs.recommendedTypeChecked,
483
+ {
484
+ files: [
485
+ GLOB_JS,
486
+ GLOB_JSX,
487
+ GLOB_JSON,
488
+ GLOB_JSON5,
489
+ GLOB_JSONC,
490
+ GLOB_YAML,
491
+ GLOB_TOML
492
+ ],
493
+ ...ts.configs.disableTypeChecked
494
+ },
495
+ {
496
+ name: "@kazupon/typescipt/typescript-eslint",
497
+ files,
498
+ languageOptions: {
499
+ parser: ts.parser,
500
+ parserOptions: {
501
+ extraFileExtensions: extraFileExtensions.map((ext) => `${ext}`),
502
+ sourceType: "module",
503
+ ...parserOptions
504
+ }
505
+ },
506
+ rules: {
507
+ "@typescript-eslint/no-unused-vars": ["error", {
508
+ args: "all",
509
+ argsIgnorePattern: "^_",
510
+ caughtErrors: "all",
511
+ caughtErrorsIgnorePattern: "^_",
512
+ destructuredArrayIgnorePattern: "^_",
513
+ varsIgnorePattern: "^_",
514
+ ignoreRestSiblings: true
515
+ }],
516
+ ...overrideRules
517
+ }
518
+ }
519
+ ];
520
+ }
521
+
264
522
  //#endregion
265
523
  //#region src/configs/unicorn.ts
266
524
  async function unicorn(options = {}) {
@@ -278,106 +536,35 @@ async function unicorn(options = {}) {
278
536
  }
279
537
 
280
538
  //#endregion
281
- //#region src/configs/prettier.ts
282
- async function prettier(options = {}) {
283
- const { rules: overrideRules = {} } = options;
284
- const prettier$1 = await loadPlugin("eslint-config-prettier");
285
- return [prettier$1, {
286
- name: "@kazupon/prettier",
287
- rules: { ...overrideRules }
288
- }];
289
- }
290
-
291
- //#endregion
292
- //#region src/configs/jsonc.ts
293
- async function jsonc(options = {}) {
294
- const { rules: overrideRules = {} } = options;
295
- const kinds = [options.json ? "json" : "", options.jsonc ? "jsonc" : "", options.json5 ? "json5" : ""];
296
- const usePrettier = !!options.prettier;
297
- const jsonc$1 = await loadPlugin("eslint-plugin-jsonc");
539
+ //#region src/configs/vitest.ts
540
+ async function vitest(options = {}) {
541
+ const { rules: overrideRules = {}, files: overrideFiles = [] } = options;
542
+ const typeTesting = !!options.typeTesting;
543
+ const vitest$1 = await loadPlugin("@vitest/eslint-plugin");
298
544
  const configs = [];
299
- for (const kind of kinds) {
300
- if (kind) {
301
- configs.push(...jsonc$1.configs[`flat/recommended-with-${kind}`].map((config, index) => {
302
- return config.name ? config : {
303
- name: `jsonc/flat/recommended-with-${kind}/${index}`,
304
- ...config
305
- };
306
- }));
307
- }
545
+ const base = {
546
+ files: GLOB_TESTS,
547
+ ...vitest$1.configs["recommended"]
548
+ };
549
+ if (base.name == undefined) {
550
+ base.name = "@vitest/eslint-plugin";
308
551
  }
309
- if (usePrettier) {
310
- configs.push(...jsonc$1.configs["flat/prettier"].map((config, index) => {
311
- return config.name ? config : {
312
- name: `jsonc/flat/prettier/${index}`,
313
- ...config
314
- };
315
- }));
552
+ if (typeTesting) {
553
+ base.files = [...base.files, ...GLOB_TESTS_TYPE];
554
+ base.settings = { vitest: { typecheck: true } };
555
+ base.languageOptions = { globals: { ...vitest$1.environments.env.globals } };
316
556
  }
317
- const overriddenConfig = {
318
- name: "@kazupon/jsonc",
319
- files: [GLOB_JSON, GLOB_JSON5, GLOB_JSONC],
557
+ configs.push(base);
558
+ const custom = {
559
+ name: "@kazupon/vitest",
320
560
  rules: { ...overrideRules }
321
561
  };
322
- configs.push(...jsoncSort(), overriddenConfig);
323
- return configs;
324
- }
325
- function jsoncSort() {
326
- return [{
327
- name: "@kazupon/jsonc/sort/package.json",
328
- files: ["**/package.json"],
329
- rules: {
330
- "jsonc/sort-array-values": ["error", {
331
- order: { type: "asc" },
332
- pathPattern: "^files$"
333
- }],
334
- "jsonc/sort-keys": ["error", {
335
- order: ["name", "description", "private", "version", "author", "contributors", "license", "funding", "bugs", "repository", "keywords", "homepage", "publishConfig", "packageManager", "engines", "os", "cpu", "type", "sideEffects", "bin", "files", "main", "module", "browser", "unpkg", "jsdelivr", "directories", "exports", "types", "typesVersions", "scripts", "dependencies", "peerDependencies", "peerDependenciesMeta", "optionalDependencies", "devDependencies", "pnpm", "overrides", "resolutions", "workspaces", "prettier", "buildOptions", "lint-staged"],
336
- pathPattern: "^$"
337
- }, {
338
- order: { type: "asc" },
339
- pathPattern: "^scripts$"
340
- }, {
341
- order: { type: "asc" },
342
- pathPattern: "^(?:dev|peer|optional|bundled)?[Dd]ependencies(Meta)?$"
343
- }, {
344
- order: { type: "asc" },
345
- pathPattern: "^(?:resolutions|overrides|pnpm.overrides)$"
346
- }]
347
- }
348
- }];
349
- }
350
-
351
- //#endregion
352
- //#region src/configs/yml.ts
353
- async function yml(options = {}) {
354
- const { rules: overrideRules = {} } = options;
355
- const usePrettier = !!options.prettier;
356
- const yml$1 = await loadPlugin("eslint-plugin-yml");
357
- const configs = [];
358
- configs.push(...yml$1.configs["flat/standard"].map((config, index) => {
359
- return config.name ? config : {
360
- name: `yml/flat/standard/${index}`,
361
- ...config
362
- };
363
- }));
364
- if (usePrettier) {
365
- configs.push(...yml$1.configs["flat/prettier"].map((config, index) => {
366
- return config.name ? config : {
367
- name: `yml/flat/prettier/${index}`,
368
- ...config
369
- };
370
- }));
562
+ if (overrideFiles.length > 0) {
563
+ custom.files = overrideFiles;
371
564
  }
372
- const overriddenConfig = {
373
- name: "@kazupon/yml",
374
- files: [GLOB_YAML],
375
- rules: { ...overrideRules }
376
- };
377
- configs.push(overriddenConfig);
565
+ configs.push(custom);
378
566
  return configs;
379
567
  }
380
- const yaml = yml;
381
568
 
382
569
  //#endregion
383
570
  //#region src/configs/vue.ts
@@ -438,94 +625,35 @@ async function vue(options = {}) {
438
625
  }
439
626
 
440
627
  //#endregion
441
- //#region src/configs/react.ts
442
- async function react(options = {}) {
443
- const { rules: overrideRules = {}, settings = {} } = options;
444
- const useTypeScript = !options.typescript;
445
- const enableRefresh = !!options.refresh;
446
- const [react$1, reactHooks, reactRefresh] = await Promise.all([loadPlugin("eslint-plugin-react"), loadPlugin("eslint-plugin-react-hooks"), enableRefresh ? loadPlugin("eslint-plugin-react-refresh") : null]);
447
- const customConfig = {
448
- name: "@kazupon/react",
449
- files: getGlobSourceFiles(useTypeScript),
450
- rules: { ...overrideRules }
451
- };
452
- const configs = [{
453
- name: "react/flat/recommended",
454
- files: getGlobSourceFiles(useTypeScript),
455
- settings,
456
- ...react$1.configs.flat.recommended
457
- }, {
458
- name: "react-hooks/flat",
459
- files: getGlobSourceFiles(useTypeScript),
460
- plugins: { "react-hooks": reactHooks }
461
- }];
462
- if (enableRefresh) {
463
- configs.push({
464
- name: "react-refresh/flat",
465
- files: getGlobSourceFiles(useTypeScript),
466
- plugins: { "react-refresh": reactRefresh }
467
- });
468
- }
469
- return [...configs, customConfig];
470
- }
471
-
472
- //#endregion
473
- //#region src/configs/svelte.ts
474
- async function svelte(options = {}) {
475
- const { rules: overrideRules = {}, parserOptions = { project: true } } = options;
476
- const useTypeScript = !!options.typescript;
477
- const svelte$1 = await loadPlugin("eslint-plugin-svelte");
478
- const svelteParser = svelte$1.configs["flat/base"][1]["languageOptions"]["parser"];
479
- const customConfig = {
480
- name: "@kazupon/svelte",
481
- files: [GLOB_SVELTE],
482
- rules: { ...overrideRules }
483
- };
484
- if (useTypeScript) {
485
- customConfig.languageOptions = {
486
- parser: svelteParser,
487
- parserOptions: {
488
- sourceType: "module",
489
- parser: await getTypeScriptParser(),
490
- ecmaFeatures: { jsx: true },
491
- extraFileExtensions: [".svelte"],
492
- ...parserOptions
493
- }
494
- };
495
- }
496
- return [...svelte$1.configs["flat/recommended"], customConfig];
497
- }
498
-
499
- //#endregion
500
- //#region src/configs/vitest.ts
501
- async function vitest(options = {}) {
502
- const { rules: overrideRules = {}, files: overrideFiles = [] } = options;
503
- const typeTesting = !!options.typeTesting;
504
- const vitest$1 = await loadPlugin("@vitest/eslint-plugin");
628
+ //#region src/configs/yml.ts
629
+ async function yml(options = {}) {
630
+ const { rules: overrideRules = {} } = options;
631
+ const usePrettier = !!options.prettier;
632
+ const yml$1 = await loadPlugin("eslint-plugin-yml");
505
633
  const configs = [];
506
- const base = {
507
- files: GLOB_TESTS,
508
- ...vitest$1.configs["recommended"]
509
- };
510
- if (base.name == undefined) {
511
- base.name = "@vitest/eslint-plugin";
512
- }
513
- if (typeTesting) {
514
- base.files = [...base.files, ...GLOB_TESTS_TYPE];
515
- base.settings = { vitest: { typecheck: true } };
516
- base.languageOptions = { globals: { ...vitest$1.environments.env.globals } };
634
+ configs.push(...yml$1.configs["flat/standard"].map((config, index) => {
635
+ return config.name ? config : {
636
+ name: `yml/flat/standard/${index}`,
637
+ ...config
638
+ };
639
+ }));
640
+ if (usePrettier) {
641
+ configs.push(...yml$1.configs["flat/prettier"].map((config, index) => {
642
+ return config.name ? config : {
643
+ name: `yml/flat/prettier/${index}`,
644
+ ...config
645
+ };
646
+ }));
517
647
  }
518
- configs.push(base);
519
- const custom = {
520
- name: "@kazupon/vitest",
648
+ const overriddenConfig = {
649
+ name: "@kazupon/yml",
650
+ files: [GLOB_YAML],
521
651
  rules: { ...overrideRules }
522
652
  };
523
- if (overrideFiles.length > 0) {
524
- custom.files = overrideFiles;
525
- }
526
- configs.push(custom);
653
+ configs.push(overriddenConfig);
527
654
  return configs;
528
655
  }
656
+ const yaml = yml;
529
657
 
530
658
  //#endregion
531
659
  Object.defineProperty(exports, 'comments', {
@@ -564,6 +692,18 @@ Object.defineProperty(exports, 'jsonc', {
564
692
  return jsonc;
565
693
  }
566
694
  });
695
+ Object.defineProperty(exports, 'markdown', {
696
+ enumerable: true,
697
+ get: function () {
698
+ return markdown;
699
+ }
700
+ });
701
+ Object.defineProperty(exports, 'md', {
702
+ enumerable: true,
703
+ get: function () {
704
+ return md;
705
+ }
706
+ });
567
707
  Object.defineProperty(exports, 'prettier', {
568
708
  enumerable: true,
569
709
  get: function () {