@kazupon/eslint-config 0.18.0 → 0.20.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 (87) hide show
  1. package/dist/index.d.ts +14180 -3
  2. package/dist/index.js +71 -90
  3. package/package.json +59 -48
  4. package/dist/config.d.cts +0 -9
  5. package/dist/config.d.ts +0 -9
  6. package/dist/configs/comments.d.cts +0 -15
  7. package/dist/configs/comments.d.ts +0 -15
  8. package/dist/configs/imports.d.cts +0 -21
  9. package/dist/configs/imports.d.ts +0 -21
  10. package/dist/configs/index.d.cts +0 -17
  11. package/dist/configs/index.d.ts +0 -17
  12. package/dist/configs/javascript.d.cts +0 -15
  13. package/dist/configs/javascript.d.ts +0 -15
  14. package/dist/configs/jsdoc.d.cts +0 -27
  15. package/dist/configs/jsdoc.d.ts +0 -27
  16. package/dist/configs/jsonc.d.cts +0 -39
  17. package/dist/configs/jsonc.d.ts +0 -39
  18. package/dist/configs/markdown.d.cts +0 -28
  19. package/dist/configs/markdown.d.ts +0 -28
  20. package/dist/configs/prettier.d.cts +0 -15
  21. package/dist/configs/prettier.d.ts +0 -15
  22. package/dist/configs/promise.d.cts +0 -15
  23. package/dist/configs/promise.d.ts +0 -15
  24. package/dist/configs/react.d.cts +0 -26
  25. package/dist/configs/react.d.ts +0 -26
  26. package/dist/configs/regexp.d.cts +0 -15
  27. package/dist/configs/regexp.d.ts +0 -15
  28. package/dist/configs/svelte.d.cts +0 -21
  29. package/dist/configs/svelte.d.ts +0 -21
  30. package/dist/configs/toml.d.cts +0 -15
  31. package/dist/configs/toml.d.ts +0 -15
  32. package/dist/configs/typescript.d.cts +0 -38
  33. package/dist/configs/typescript.d.ts +0 -38
  34. package/dist/configs/unicorn.d.cts +0 -20
  35. package/dist/configs/unicorn.d.ts +0 -20
  36. package/dist/configs/vitest.d.cts +0 -22
  37. package/dist/configs/vitest.d.ts +0 -22
  38. package/dist/configs/vue.d.cts +0 -36
  39. package/dist/configs/vue.d.ts +0 -36
  40. package/dist/configs/yml.d.cts +0 -22
  41. package/dist/configs/yml.d.ts +0 -22
  42. package/dist/globs.d.cts +0 -14
  43. package/dist/globs.d.ts +0 -14
  44. package/dist/index.cjs +0 -778
  45. package/dist/index.d.cts +0 -3
  46. package/dist/types/gens/comments.d.cts +0 -65
  47. package/dist/types/gens/comments.d.ts +0 -65
  48. package/dist/types/gens/eslint.d.cts +0 -23
  49. package/dist/types/gens/eslint.d.ts +0 -23
  50. package/dist/types/gens/imports.d.cts +0 -520
  51. package/dist/types/gens/imports.d.ts +0 -520
  52. package/dist/types/gens/javascript.d.cts +0 -3163
  53. package/dist/types/gens/javascript.d.ts +0 -3163
  54. package/dist/types/gens/jsdoc.d.cts +0 -796
  55. package/dist/types/gens/jsdoc.d.ts +0 -796
  56. package/dist/types/gens/jsonc.d.cts +0 -513
  57. package/dist/types/gens/jsonc.d.ts +0 -513
  58. package/dist/types/gens/markdown.d.cts +0 -42
  59. package/dist/types/gens/markdown.d.ts +0 -42
  60. package/dist/types/gens/prettier.d.cts +0 -2
  61. package/dist/types/gens/prettier.d.ts +0 -2
  62. package/dist/types/gens/promise.d.cts +0 -113
  63. package/dist/types/gens/promise.d.ts +0 -113
  64. package/dist/types/gens/react.d.cts +0 -1053
  65. package/dist/types/gens/react.d.ts +0 -1053
  66. package/dist/types/gens/regexp.d.cts +0 -553
  67. package/dist/types/gens/regexp.d.ts +0 -553
  68. package/dist/types/gens/svelte.d.cts +0 -491
  69. package/dist/types/gens/svelte.d.ts +0 -491
  70. package/dist/types/gens/toml.d.cts +0 -256
  71. package/dist/types/gens/toml.d.ts +0 -256
  72. package/dist/types/gens/typescript.d.cts +0 -1578
  73. package/dist/types/gens/typescript.d.ts +0 -1578
  74. package/dist/types/gens/unicorn.d.cts +0 -925
  75. package/dist/types/gens/unicorn.d.ts +0 -925
  76. package/dist/types/gens/vitest.d.cts +0 -377
  77. package/dist/types/gens/vitest.d.ts +0 -377
  78. package/dist/types/gens/vue.d.cts +0 -2746
  79. package/dist/types/gens/vue.d.ts +0 -2746
  80. package/dist/types/gens/yml.d.cts +0 -375
  81. package/dist/types/gens/yml.d.ts +0 -375
  82. package/dist/types/index.d.cts +0 -19
  83. package/dist/types/index.d.ts +0 -19
  84. package/dist/types/overrides.d.cts +0 -8
  85. package/dist/types/overrides.d.ts +0 -8
  86. package/dist/utils.d.cts +0 -18
  87. package/dist/utils.d.ts +0 -18
package/dist/index.cjs DELETED
@@ -1,778 +0,0 @@
1
- "use strict";
2
- //#region rolldown:runtime
3
- var __create = Object.create;
4
- var __defProp = Object.defineProperty;
5
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
- var __getOwnPropNames = Object.getOwnPropertyNames;
7
- var __getProtoOf = Object.getPrototypeOf;
8
- var __hasOwnProp = Object.prototype.hasOwnProperty;
9
- var __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
11
- key = keys[i];
12
- if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
13
- get: ((k) => from[k]).bind(null, key),
14
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
15
- });
16
- }
17
- return to;
18
- };
19
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
20
- value: mod,
21
- enumerable: true
22
- }) : target, mod));
23
-
24
- //#endregion
25
- const { FlatConfigComposer } = __toESM(require("eslint-flat-config-utils"));
26
- const { interopDefault } = __toESM(require("@kazupon/jts-utils/module"));
27
- const { default: globals } = __toESM(require("globals"));
28
-
29
- //#region src/config.ts
30
- function defineConfig(...configs) {
31
- const baseConfigs = [];
32
- return new FlatConfigComposer().append(...baseConfigs, ...configs);
33
- }
34
-
35
- //#endregion
36
- //#region src/globs.ts
37
- const GLOB_JS = "**/*.?([cm])js";
38
- const GLOB_JSX = "**/*.?([cm])jsx";
39
- const GLOB_TS = "**/*.?([cm])ts";
40
- const GLOB_TSX = "**/*.?([cm])tsx";
41
- const GLOB_JSON = "**/*.json";
42
- const GLOB_JSON5 = "**/*.json5";
43
- const GLOB_JSONC = "**/*.jsonc";
44
- const GLOB_YAML = "**/*.y?(a)ml";
45
- const GLOB_TOML = "**/*.toml";
46
- const GLOB_VUE = "**/*.vue";
47
- const GLOB_SVELTE = "**/*.svelte";
48
- const GLOB_MARKDOWN = "**/*.md";
49
- const GLOB_SRC_EXT = "?([cm])[jt]s?(x)";
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
- ];
61
- const GLOB_TESTS_TYPE = [`**/*.test-d.${GLOB_SRC_EXT}`, `**/*.spec-d.${GLOB_SRC_EXT}`];
62
-
63
- //#endregion
64
- //#region src/utils.ts
65
- async function loadPlugin(name) {
66
- const mod = await import(name).catch((error) => {
67
- console.error(error);
68
- throw new Error(`Failed to load eslint plugin '${name}'. Please install it!`);
69
- });
70
- return interopDefault(mod);
71
- }
72
- async function getTypeScriptParser() {
73
- const ts = await loadPlugin("typescript-eslint");
74
- return ts.parser;
75
- }
76
- function getGlobSourceFiles(useTypeScript = false) {
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;
148
- }
149
-
150
- //#endregion
151
- //#region src/configs/javascript.ts
152
- async function javascript(options = {}) {
153
- const { rules: overrideRules = {} } = options;
154
- const js = await loadPlugin("@eslint/js");
155
- return [{
156
- name: "eslint/defaults/rules",
157
- ...js.configs.recommended
158
- }, {
159
- name: "@kazupon/javascript/@eslint/js",
160
- languageOptions: {
161
- ecmaVersion: 2022,
162
- globals: {
163
- ...globals.browser,
164
- ...globals.node,
165
- ...globals.es2022,
166
- document: "readonly",
167
- navigator: "readonly",
168
- window: "readonly"
169
- },
170
- parserOptions: {
171
- ecmaFeatures: { jsx: true },
172
- ecmaVersion: 2022,
173
- sourceType: "module"
174
- },
175
- sourceType: "module"
176
- },
177
- linterOptions: { reportUnusedDisableDirectives: true },
178
- rules: { ...overrideRules }
179
- }];
180
- }
181
-
182
- //#endregion
183
- //#region src/configs/jsdoc.ts
184
- async function jsdoc(options = {}) {
185
- const { rules: overrideRules = {}, typescript: typescript$1, error = false } = options;
186
- const jsdoc$1 = await loadPlugin("eslint-plugin-jsdoc");
187
- function resolvePreset() {
188
- let preset = "recommended";
189
- if (typescript$1 === "syntax") {
190
- preset = `${preset}-typescript`;
191
- } else if (typescript$1 === "flavor") {
192
- preset = `${preset}-typescript-flavor`;
193
- }
194
- if (error) {
195
- preset = `${preset}-error`;
196
- }
197
- return preset;
198
- }
199
- return [jsdoc$1.configs[`flat/${resolvePreset()}`], {
200
- name: "@kazupon/jsdoc",
201
- rules: { ...overrideRules }
202
- }];
203
- }
204
-
205
- //#endregion
206
- //#region src/configs/jsonc.ts
207
- async function jsonc(options = {}) {
208
- const { rules: overrideRules = {} } = options;
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
- }));
225
- }
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
- }
235
- const overriddenConfig = {
236
- name: "@kazupon/jsonc",
237
- files: [
238
- GLOB_JSON,
239
- GLOB_JSON5,
240
- GLOB_JSONC
241
- ],
242
- rules: { ...overrideRules }
243
- };
244
- configs.push(...jsoncSort(), overriddenConfig);
245
- return configs;
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
- }
358
-
359
- //#endregion
360
- //#region src/configs/promise.ts
361
- async function promise(options = {}) {
362
- const { rules: overrideRules = {} } = options;
363
- const promise$1 = await loadPlugin("eslint-plugin-promise");
364
- return [{
365
- name: "promise/flat/recommended",
366
- ...promise$1.configs["flat/recommended"]
367
- }, {
368
- name: "@kazupon/promise",
369
- rules: { ...overrideRules }
370
- }];
371
- }
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
-
409
- //#endregion
410
- //#region src/configs/regexp.ts
411
- async function regexp(options = {}) {
412
- const { rules: overrideRules = {} } = options;
413
- const regexp$1 = await loadPlugin("eslint-plugin-regexp");
414
- return [{
415
- name: "regexp/flat/recommended",
416
- ...regexp$1.configs["flat/recommended"]
417
- }, {
418
- name: "@kazupon/eslint-regexp",
419
- rules: { ...overrideRules }
420
- }];
421
- }
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
-
450
- //#endregion
451
- //#region src/configs/toml.ts
452
- async function toml(options = {}) {
453
- const { rules: overrideRules = {} } = options;
454
- const toml$1 = await loadPlugin("eslint-plugin-toml");
455
- const configs = [];
456
- configs.push(...toml$1.configs["flat/standard"].map((config, index) => {
457
- return config.name ? config : {
458
- name: `toml/flat/standard/${index}`,
459
- ...config
460
- };
461
- }));
462
- const overriddenConfig = {
463
- name: "@kazupon/toml",
464
- files: [GLOB_TOML],
465
- rules: { ...overrideRules }
466
- };
467
- configs.push(overriddenConfig);
468
- return configs;
469
- }
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
-
522
- //#endregion
523
- //#region src/configs/unicorn.ts
524
- async function unicorn(options = {}) {
525
- const { rules: overrideRules = {} } = options;
526
- const useTypeScript = !options.typescript;
527
- const unicorn$1 = await loadPlugin("eslint-plugin-unicorn");
528
- return [{
529
- files: getGlobSourceFiles(useTypeScript),
530
- ...unicorn$1.configs["flat/recommended"]
531
- }, {
532
- name: "@kazupon/unicorn",
533
- files: getGlobSourceFiles(useTypeScript),
534
- rules: { ...overrideRules }
535
- }];
536
- }
537
-
538
- //#endregion
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");
544
- const configs = [];
545
- const base = {
546
- files: GLOB_TESTS,
547
- ...vitest$1.configs["recommended"]
548
- };
549
- if (base.name == undefined) {
550
- base.name = "@vitest/eslint-plugin";
551
- }
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 } };
556
- }
557
- configs.push(base);
558
- const custom = {
559
- name: "@kazupon/vitest",
560
- rules: { ...overrideRules }
561
- };
562
- if (overrideFiles.length > 0) {
563
- custom.files = overrideFiles;
564
- }
565
- configs.push(custom);
566
- return configs;
567
- }
568
-
569
- //#endregion
570
- //#region src/configs/vue.ts
571
- async function vue(options = {}) {
572
- const { rules: overrideRules = {}, parserOptions = { project: true } } = options;
573
- const vue$1 = await loadPlugin("eslint-plugin-vue");
574
- const vueParser = vue$1.configs["flat/base"][1]["languageOptions"]["parser"];
575
- const configs = [];
576
- configs.push(...vue$1.configs["flat/recommended"]);
577
- if (options.composable) {
578
- const composable = await loadPlugin("eslint-plugin-vue-composable");
579
- const composableBase = { ...composable.configs["flat/recommended"][0] };
580
- delete composableBase.languageOptions;
581
- configs.push(composableBase, composable.configs["flat/recommended"][1]);
582
- }
583
- if (options.scopedCss) {
584
- const scopedCss = await loadPlugin("eslint-plugin-vue-scoped-css");
585
- const scopedCssMapped = scopedCss.configs["flat/recommended"].map((config, index) => {
586
- return config.name ? config : {
587
- name: `vue/scoped-css/recommended/${index}`,
588
- ...config
589
- };
590
- });
591
- configs.push(scopedCssMapped[0], scopedCssMapped[2]);
592
- }
593
- if (options.a11y) {
594
- const a11y = await loadPlugin("eslint-plugin-vuejs-accessibility");
595
- const a11yBase = { ...a11y.configs["flat/recommended"][0] };
596
- delete a11yBase.languageOptions;
597
- configs.push(a11yBase);
598
- const a11yRules = {
599
- ...a11y.configs["flat/recommended"][1],
600
- name: "vuejs-accessibility:rules"
601
- };
602
- delete a11yRules.languageOptions;
603
- delete a11yRules.plugins;
604
- configs.push(a11yRules);
605
- }
606
- const customConfig = {
607
- name: "@kazupon/vue",
608
- files: [GLOB_VUE],
609
- rules: { ...overrideRules }
610
- };
611
- if (options.typescript) {
612
- customConfig.languageOptions = {
613
- parser: vueParser,
614
- parserOptions: {
615
- sourceType: "module",
616
- parser: await getTypeScriptParser(),
617
- ecmaFeatures: { jsx: true },
618
- extraFileExtensions: [".vue"],
619
- ...parserOptions
620
- }
621
- };
622
- }
623
- configs.push(customConfig);
624
- return configs;
625
- }
626
-
627
- //#endregion
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");
633
- const configs = [];
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
- }));
647
- }
648
- const overriddenConfig = {
649
- name: "@kazupon/yml",
650
- files: [GLOB_YAML],
651
- rules: { ...overrideRules }
652
- };
653
- configs.push(overriddenConfig);
654
- return configs;
655
- }
656
- const yaml = yml;
657
-
658
- //#endregion
659
- Object.defineProperty(exports, 'comments', {
660
- enumerable: true,
661
- get: function () {
662
- return comments;
663
- }
664
- });
665
- Object.defineProperty(exports, 'defineConfig', {
666
- enumerable: true,
667
- get: function () {
668
- return defineConfig;
669
- }
670
- });
671
- Object.defineProperty(exports, 'imports', {
672
- enumerable: true,
673
- get: function () {
674
- return imports;
675
- }
676
- });
677
- Object.defineProperty(exports, 'javascript', {
678
- enumerable: true,
679
- get: function () {
680
- return javascript;
681
- }
682
- });
683
- Object.defineProperty(exports, 'jsdoc', {
684
- enumerable: true,
685
- get: function () {
686
- return jsdoc;
687
- }
688
- });
689
- Object.defineProperty(exports, 'jsonc', {
690
- enumerable: true,
691
- get: function () {
692
- return jsonc;
693
- }
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
- });
707
- Object.defineProperty(exports, 'prettier', {
708
- enumerable: true,
709
- get: function () {
710
- return prettier;
711
- }
712
- });
713
- Object.defineProperty(exports, 'promise', {
714
- enumerable: true,
715
- get: function () {
716
- return promise;
717
- }
718
- });
719
- Object.defineProperty(exports, 'react', {
720
- enumerable: true,
721
- get: function () {
722
- return react;
723
- }
724
- });
725
- Object.defineProperty(exports, 'regexp', {
726
- enumerable: true,
727
- get: function () {
728
- return regexp;
729
- }
730
- });
731
- Object.defineProperty(exports, 'svelte', {
732
- enumerable: true,
733
- get: function () {
734
- return svelte;
735
- }
736
- });
737
- Object.defineProperty(exports, 'toml', {
738
- enumerable: true,
739
- get: function () {
740
- return toml;
741
- }
742
- });
743
- Object.defineProperty(exports, 'typescript', {
744
- enumerable: true,
745
- get: function () {
746
- return typescript;
747
- }
748
- });
749
- Object.defineProperty(exports, 'unicorn', {
750
- enumerable: true,
751
- get: function () {
752
- return unicorn;
753
- }
754
- });
755
- Object.defineProperty(exports, 'vitest', {
756
- enumerable: true,
757
- get: function () {
758
- return vitest;
759
- }
760
- });
761
- Object.defineProperty(exports, 'vue', {
762
- enumerable: true,
763
- get: function () {
764
- return vue;
765
- }
766
- });
767
- Object.defineProperty(exports, 'yaml', {
768
- enumerable: true,
769
- get: function () {
770
- return yaml;
771
- }
772
- });
773
- Object.defineProperty(exports, 'yml', {
774
- enumerable: true,
775
- get: function () {
776
- return yml;
777
- }
778
- });