@kazupon/eslint-config 0.29.0 → 0.30.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 +5 -4
- package/dist/index.d.ts +15690 -15991
- package/dist/index.js +232 -14
- package/package.json +39 -33
package/dist/index.js
CHANGED
|
@@ -5,6 +5,11 @@ import globals from "globals";
|
|
|
5
5
|
import { mergeProcessors, processorPassThrough } from "eslint-merge-processors";
|
|
6
6
|
|
|
7
7
|
//#region src/config.ts
|
|
8
|
+
/**
|
|
9
|
+
* define eslint configurations
|
|
10
|
+
* @param {Awaitable<Linter.Config | Linter.Config[]>[]} configs eslint flat configurations
|
|
11
|
+
* @returns {FlatConfigComposer} eslint flat configuration composer
|
|
12
|
+
*/
|
|
8
13
|
function defineConfig(...configs) {
|
|
9
14
|
const baseConfigs = [];
|
|
10
15
|
/**
|
|
@@ -16,6 +21,10 @@ function defineConfig(...configs) {
|
|
|
16
21
|
|
|
17
22
|
//#endregion
|
|
18
23
|
//#region src/globs.ts
|
|
24
|
+
/**
|
|
25
|
+
* @author kazuya kawaguchi (a.k.a. @kazupon)
|
|
26
|
+
* @license MIT
|
|
27
|
+
*/
|
|
19
28
|
const GLOB_JS = "**/*.?([cm])js";
|
|
20
29
|
const GLOB_JSX = "**/*.?([cm])jsx";
|
|
21
30
|
const GLOB_TS = "**/*.?([cm])ts";
|
|
@@ -28,6 +37,7 @@ const GLOB_TOML = "**/*.toml";
|
|
|
28
37
|
const GLOB_VUE = "**/*.vue";
|
|
29
38
|
const GLOB_SVELTE = "**/*.svelte";
|
|
30
39
|
const GLOB_MARKDOWN = "**/*.md";
|
|
40
|
+
const GLOB_HTML = "**/*.html";
|
|
31
41
|
const GLOB_CSS = "**/*.css";
|
|
32
42
|
const GLOB_SRC_EXT = "?([cm])[jt]s?(x)";
|
|
33
43
|
const GLOB_SRC = "**/*.?([cm])[jt]s?(x)";
|
|
@@ -46,6 +56,11 @@ const GLOB_TESTS_TYPE = [`**/*.test-d.${GLOB_SRC_EXT}`, `**/*.spec-d.${GLOB_SRC_
|
|
|
46
56
|
|
|
47
57
|
//#endregion
|
|
48
58
|
//#region src/utils.ts
|
|
59
|
+
/**
|
|
60
|
+
* load eslint plugin
|
|
61
|
+
* @param {string} name plugin name
|
|
62
|
+
* @returns {Promise<T>} loaded plugin
|
|
63
|
+
*/
|
|
49
64
|
async function loadPlugin(name) {
|
|
50
65
|
const mod = await import(name).catch((error) => {
|
|
51
66
|
console.error(error);
|
|
@@ -53,10 +68,20 @@ async function loadPlugin(name) {
|
|
|
53
68
|
});
|
|
54
69
|
return interopDefault(mod);
|
|
55
70
|
}
|
|
71
|
+
/**
|
|
72
|
+
* get TypeScript parser
|
|
73
|
+
* @description get the parser, which is `typescript-eslint` parser
|
|
74
|
+
* @returns {Promise<typeof import('typescript-eslint')['parser']>} TypeScript parser
|
|
75
|
+
*/
|
|
56
76
|
async function getTypeScriptParser() {
|
|
57
77
|
const ts = await loadPlugin("typescript-eslint");
|
|
58
78
|
return ts.parser;
|
|
59
79
|
}
|
|
80
|
+
/**
|
|
81
|
+
* get glob source files
|
|
82
|
+
* @param {boolean} useTypeScript use TypeScript, default `false`
|
|
83
|
+
* @returns {string[]} files
|
|
84
|
+
*/
|
|
60
85
|
function getGlobSourceFiles(useTypeScript = false) {
|
|
61
86
|
return [
|
|
62
87
|
GLOB_JS,
|
|
@@ -67,6 +92,12 @@ function getGlobSourceFiles(useTypeScript = false) {
|
|
|
67
92
|
|
|
68
93
|
//#endregion
|
|
69
94
|
//#region src/configs/comments.ts
|
|
95
|
+
/**
|
|
96
|
+
* configure comments preset for the below plugins
|
|
97
|
+
* - `@eslint-community/eslint-plugin-eslint-comments`
|
|
98
|
+
* @param {CommentsOptions} options {@link CommentsOptions | comments preset options}
|
|
99
|
+
* @returns {Promise<Linter.Config[]>} resolved eslint flat configurations
|
|
100
|
+
*/
|
|
70
101
|
async function comments(options = {}) {
|
|
71
102
|
const comments$1 = await loadPlugin("@eslint-community/eslint-plugin-eslint-comments");
|
|
72
103
|
const kazupon = await loadPlugin("@kazupon/eslint-plugin");
|
|
@@ -92,6 +123,13 @@ async function comments(options = {}) {
|
|
|
92
123
|
|
|
93
124
|
//#endregion
|
|
94
125
|
//#region src/configs/css.ts
|
|
126
|
+
/**
|
|
127
|
+
* `@eslint/css` and overrides configuration options
|
|
128
|
+
* @param {CssOptions & OverridesOptions} options
|
|
129
|
+
* eslint css configuration options
|
|
130
|
+
* @returns {Promise<Linter.Config[]>}
|
|
131
|
+
* eslint flat configurations with `@eslint/css` and overrides
|
|
132
|
+
*/
|
|
95
133
|
async function css(options = {}) {
|
|
96
134
|
const { rules: overrideRules = {} } = options;
|
|
97
135
|
const tolerant = !!options.tolerant;
|
|
@@ -118,6 +156,69 @@ async function css(options = {}) {
|
|
|
118
156
|
}];
|
|
119
157
|
}
|
|
120
158
|
|
|
159
|
+
//#endregion
|
|
160
|
+
//#region src/configs/html.ts
|
|
161
|
+
/**
|
|
162
|
+
* `@html-eslint/eslint-plugin` and overrides configuration options
|
|
163
|
+
* @param {HtmlOptions & OverridesOptions} options eslint configuration options for HTML
|
|
164
|
+
* @returns {Promise<Linter.Config[]>}
|
|
165
|
+
* eslint flat configurations with `@html-eslint/eslint-plugin` and overrides
|
|
166
|
+
*/
|
|
167
|
+
async function html(options = {}) {
|
|
168
|
+
const { rules: overrideRules = {}, prettier: prettier$1 = false, frontmatter = false, templateEngineSyntax } = options;
|
|
169
|
+
const html$1 = await loadPlugin("@html-eslint/eslint-plugin");
|
|
170
|
+
const htmlParser = html$1.configs["flat/recommended"].languageOptions["parser"];
|
|
171
|
+
const configs = [{
|
|
172
|
+
name: "@html-eslint/flat/recommended",
|
|
173
|
+
files: [GLOB_HTML, `${GLOB_MARKDOWN}/**/${GLOB_HTML}`],
|
|
174
|
+
...html$1.configs["flat/recommended"]
|
|
175
|
+
}];
|
|
176
|
+
const customConfig = {
|
|
177
|
+
name: "@kazupon/@html-eslint",
|
|
178
|
+
files: [GLOB_HTML, `${GLOB_MARKDOWN}/**/${GLOB_HTML}`],
|
|
179
|
+
languageOptions: {
|
|
180
|
+
parser: htmlParser,
|
|
181
|
+
parserOptions: { frontmatter }
|
|
182
|
+
},
|
|
183
|
+
rules: { ...overrideRules }
|
|
184
|
+
};
|
|
185
|
+
if (templateEngineSyntax) customConfig.languageOptions.parserOptions.templateEngineSyntax = resolveTemplateEngineSyntax(templateEngineSyntax, htmlParser);
|
|
186
|
+
configs.push(customConfig);
|
|
187
|
+
if (prettier$1) configs.push({
|
|
188
|
+
name: "@html-eslint/prettier",
|
|
189
|
+
files: [GLOB_HTML],
|
|
190
|
+
rules: {
|
|
191
|
+
"@html-eslint/attrs-newline": "off",
|
|
192
|
+
"@html-eslint/element-newline": "off",
|
|
193
|
+
"@html-eslint/id-naming-convention": "off",
|
|
194
|
+
"@html-eslint/indent": "off",
|
|
195
|
+
"@html-eslint/lowercase": "off",
|
|
196
|
+
"@html-eslint/max-element-depth": "off",
|
|
197
|
+
"@html-eslint/no-extra-spacing-attrs": "off",
|
|
198
|
+
"@html-eslint/no-multiple-empty-lines": "off",
|
|
199
|
+
"@html-eslint/no-trailing-spaces": "off",
|
|
200
|
+
"@html-eslint/quotes": "off",
|
|
201
|
+
"@html-eslint/sort-attrs": "off"
|
|
202
|
+
}
|
|
203
|
+
});
|
|
204
|
+
return configs;
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* Resolve template engine syntax for html-eslint parser
|
|
208
|
+
* @param {HtmlOptions['templateEngineSyntax']} syntax - template engine syntax
|
|
209
|
+
* @param {typeof import('@html-eslint/eslint-plugin').configs['flat/recommended']['languageOptions']['parser']} parser - html-eslint parser
|
|
210
|
+
* @returns {{ [syntax: string]: string } | undefined} resolved template engine syntax, or undefined if no syntax is provided
|
|
211
|
+
*/
|
|
212
|
+
function resolveTemplateEngineSyntax(syntax, parser) {
|
|
213
|
+
if (!syntax) return void 0;
|
|
214
|
+
switch (syntax) {
|
|
215
|
+
case "erb": return parser.TEMPLATE_ENGINE_SYNTAX.ERB;
|
|
216
|
+
case "handlebar": return parser.TEMPLATE_ENGINE_SYNTAX.HANDLEBAR;
|
|
217
|
+
case "twig": return parser.TEMPLATE_ENGINE_SYNTAX.TWIG;
|
|
218
|
+
}
|
|
219
|
+
return syntax;
|
|
220
|
+
}
|
|
221
|
+
|
|
121
222
|
//#endregion
|
|
122
223
|
//#region src/configs/imports.ts
|
|
123
224
|
const IMPORTS_FILES = [
|
|
@@ -126,6 +227,14 @@ const IMPORTS_FILES = [
|
|
|
126
227
|
GLOB_TS,
|
|
127
228
|
GLOB_TSX
|
|
128
229
|
];
|
|
230
|
+
/**
|
|
231
|
+
* `eslint-plugin-import-x`, `eslint-plugin-unused-imports` and overrides configuration options
|
|
232
|
+
* @description if you want to use this preset, you need to put after `javascript` and `typescript` presets**
|
|
233
|
+
* @param {ImportsOptions & OverridesOptions} options
|
|
234
|
+
* import configuration options
|
|
235
|
+
* @returns {Promise<Linter.Config[]>}
|
|
236
|
+
* eslint flat configurations with `eslint-plugin-import-x`, `eslint-plugin-unused-imports` and overrides
|
|
237
|
+
*/
|
|
129
238
|
async function imports(options = {}) {
|
|
130
239
|
const { rules: overrideRules = {}, interop = true } = options;
|
|
131
240
|
const unused = await loadPlugin("eslint-plugin-unused-imports");
|
|
@@ -181,6 +290,11 @@ async function imports(options = {}) {
|
|
|
181
290
|
|
|
182
291
|
//#endregion
|
|
183
292
|
//#region src/configs/javascript.ts
|
|
293
|
+
/**
|
|
294
|
+
* `@eslint/js` and overrides configuration options
|
|
295
|
+
* @param {JavaScriptOptions & OverridesOptions} options eslint configuration options for JavaScript
|
|
296
|
+
* @returns {Promise<Linter.Config[]>} eslint flat configurations with `@eslint/js` and overrides
|
|
297
|
+
*/
|
|
184
298
|
async function javascript(options = {}) {
|
|
185
299
|
const { rules: overrideRules = {} } = options;
|
|
186
300
|
const js = await loadPlugin("@eslint/js");
|
|
@@ -214,6 +328,13 @@ async function javascript(options = {}) {
|
|
|
214
328
|
|
|
215
329
|
//#endregion
|
|
216
330
|
//#region src/configs/jsdoc.ts
|
|
331
|
+
/**
|
|
332
|
+
* `eslint-plugin-jsdoc` and overrides configuration options
|
|
333
|
+
* @param {JsDocOptions & OverridesOptions} options
|
|
334
|
+
* eslint configuration options for JavaScript
|
|
335
|
+
* @returns {Promise<Linter.Config[]>}
|
|
336
|
+
* eslint flat configurations with `eslint-plugin-jsdoc` and overrides
|
|
337
|
+
*/
|
|
217
338
|
async function jsdoc(options = {}) {
|
|
218
339
|
const { rules: overrideRules = {}, typescript: typescript$1, error = false } = options;
|
|
219
340
|
const jsdoc$1 = await loadPlugin("eslint-plugin-jsdoc");
|
|
@@ -235,6 +356,13 @@ async function jsdoc(options = {}) {
|
|
|
235
356
|
|
|
236
357
|
//#endregion
|
|
237
358
|
//#region src/configs/jsonc.ts
|
|
359
|
+
/**
|
|
360
|
+
* `eslint-plugin-jsonc` and overrides configuration options
|
|
361
|
+
* @param {JsoncOptions & OverridesOptions} options
|
|
362
|
+
* eslint jsonc configuration options for json, jsonc, json5
|
|
363
|
+
* @returns {Promise<Linter.Config[]>}
|
|
364
|
+
* eslint flat configurations with `eslint-plugin-jsonc` and overrides
|
|
365
|
+
*/
|
|
238
366
|
async function jsonc(options = {}) {
|
|
239
367
|
const { rules: overrideRules = {} } = options;
|
|
240
368
|
const kinds = [
|
|
@@ -355,6 +483,13 @@ function jsoncSort() {
|
|
|
355
483
|
|
|
356
484
|
//#endregion
|
|
357
485
|
//#region src/configs/markdown.ts
|
|
486
|
+
/**
|
|
487
|
+
* `@eslint/markdown` and overrides configuration options
|
|
488
|
+
* @param {MarkdownOptions & OverridesOptions} options
|
|
489
|
+
* eslint unicorn configuration options
|
|
490
|
+
* @returns {Promise<Linter.Config[]>}
|
|
491
|
+
* eslint flat configurations with `@eslint/markdown` and overrides
|
|
492
|
+
*/
|
|
358
493
|
async function markdown(options = {}) {
|
|
359
494
|
const { rules: overrideRules = {}, files = [GLOB_MARKDOWN], blockExtensions = [] } = options;
|
|
360
495
|
const language = options.language || "gfm";
|
|
@@ -398,6 +533,13 @@ const md = markdown;
|
|
|
398
533
|
|
|
399
534
|
//#endregion
|
|
400
535
|
//#region src/configs/prettier.ts
|
|
536
|
+
/**
|
|
537
|
+
* `eslint-config-prettier` and overrides configuration options
|
|
538
|
+
* @param {PrettierOptions & OverridesOptions} options
|
|
539
|
+
* eslint configuration options for Prettier
|
|
540
|
+
* @returns {Promise<Linter.Config[]>}
|
|
541
|
+
* eslint flat configurations with `eslint-config-prettier` and overrides
|
|
542
|
+
*/
|
|
401
543
|
async function prettier(options = {}) {
|
|
402
544
|
const { rules: overrideRules = {} } = options;
|
|
403
545
|
const prettier$1 = await loadPlugin("eslint-config-prettier");
|
|
@@ -412,6 +554,13 @@ async function prettier(options = {}) {
|
|
|
412
554
|
|
|
413
555
|
//#endregion
|
|
414
556
|
//#region src/configs/promise.ts
|
|
557
|
+
/**
|
|
558
|
+
* `eslint-plugin-promise` and overrides configuration options
|
|
559
|
+
* @param {PromiseOptions & OverridesOptions} options
|
|
560
|
+
* eslint promise configuration options
|
|
561
|
+
* @returns {Promise<Linter.Config[]>}
|
|
562
|
+
* eslint flat configurations with `eslint-plugin-promise` and overrides
|
|
563
|
+
*/
|
|
415
564
|
async function promise(options = {}) {
|
|
416
565
|
const { rules: overrideRules = {} } = options;
|
|
417
566
|
const promise$1 = await loadPlugin("eslint-plugin-promise");
|
|
@@ -426,6 +575,13 @@ async function promise(options = {}) {
|
|
|
426
575
|
|
|
427
576
|
//#endregion
|
|
428
577
|
//#region src/configs/react.ts
|
|
578
|
+
/**
|
|
579
|
+
* `eslint-plugin-react` and overrides configuration options
|
|
580
|
+
* @param {ReactOptions & OverridesOptions} options
|
|
581
|
+
* eslint react configuration options for regular expressions
|
|
582
|
+
* @returns {Promise<Linter.Config[]>}
|
|
583
|
+
* eslint flat configurations with `eslint-plugin-react` and overrides
|
|
584
|
+
*/
|
|
429
585
|
async function react(options = {}) {
|
|
430
586
|
const { rules: overrideRules = {}, settings = {} } = options;
|
|
431
587
|
const useTypeScript = !options.typescript;
|
|
@@ -467,6 +623,13 @@ async function react(options = {}) {
|
|
|
467
623
|
|
|
468
624
|
//#endregion
|
|
469
625
|
//#region src/configs/regexp.ts
|
|
626
|
+
/**
|
|
627
|
+
* `eslint-plugin-regexp` and overrides configuration options
|
|
628
|
+
* @param {RegexpOptions & OverridesOptions} options
|
|
629
|
+
* eslint regexp configuration options for regular expressions
|
|
630
|
+
* @returns {Promise<Linter.Config[]>}
|
|
631
|
+
* eslint flat configurations with `eslint-plugin-regexp` and overrides
|
|
632
|
+
*/
|
|
470
633
|
async function regexp(options = {}) {
|
|
471
634
|
const { rules: overrideRules = {} } = options;
|
|
472
635
|
const regexp$1 = await loadPlugin("eslint-plugin-regexp");
|
|
@@ -482,6 +645,13 @@ async function regexp(options = {}) {
|
|
|
482
645
|
|
|
483
646
|
//#endregion
|
|
484
647
|
//#region src/configs/stylistic.ts
|
|
648
|
+
/**
|
|
649
|
+
* `@stylistic/eslint-plugin` and overrides configuration options
|
|
650
|
+
* @param {StylisticOptions & OverridesOptions} options
|
|
651
|
+
* stylistic eslint plugin configuration options
|
|
652
|
+
* @returns {Promise<Linter.Config[]>}
|
|
653
|
+
* eslint flat configurations with `@stylistic/eslint-plugin` and overrides
|
|
654
|
+
*/
|
|
485
655
|
async function stylistic(options = {}) {
|
|
486
656
|
const { rules: overrideRules = {}, customize = {
|
|
487
657
|
commaDangle: "never",
|
|
@@ -520,8 +690,15 @@ async function stylistic(options = {}) {
|
|
|
520
690
|
|
|
521
691
|
//#endregion
|
|
522
692
|
//#region src/configs/svelte.ts
|
|
693
|
+
/**
|
|
694
|
+
* `eslint-plugin-svelte` and overrides configuration options
|
|
695
|
+
* @param {SvelteScriptOptions & TypeScriptOptions & OverridesOptions} options
|
|
696
|
+
* eslint configuration options for Vue
|
|
697
|
+
* @returns {Promise<Linter.Config[]>}
|
|
698
|
+
* eslint flat configurations with `eslint-plugin-svelte` and overrides
|
|
699
|
+
*/
|
|
523
700
|
async function svelte(options = {}) {
|
|
524
|
-
const { rules: overrideRules = {}, parserOptions = {
|
|
701
|
+
const { rules: overrideRules = {}, parserOptions = { projectService: true }, svelteConfig = {} } = options;
|
|
525
702
|
const useTypeScript = !!options.typescript;
|
|
526
703
|
const svelte$1 = await loadPlugin("eslint-plugin-svelte");
|
|
527
704
|
const svelteParser = svelte$1.configs["flat/base"][1]["languageOptions"]?.parser;
|
|
@@ -537,6 +714,7 @@ async function svelte(options = {}) {
|
|
|
537
714
|
parser: await getTypeScriptParser(),
|
|
538
715
|
ecmaFeatures: { jsx: true },
|
|
539
716
|
extraFileExtensions: [".svelte"],
|
|
717
|
+
svelteConfig,
|
|
540
718
|
...parserOptions
|
|
541
719
|
}
|
|
542
720
|
};
|
|
@@ -548,6 +726,13 @@ async function svelte(options = {}) {
|
|
|
548
726
|
|
|
549
727
|
//#endregion
|
|
550
728
|
//#region src/configs/toml.ts
|
|
729
|
+
/**
|
|
730
|
+
* `eslint-plugin-yml` and overrides configuration options
|
|
731
|
+
* @param {YmlOptions & OverridesOptions} options
|
|
732
|
+
* eslint yml configuration options for yml, yaml
|
|
733
|
+
* @returns {Promise<Linter.Config[]>}
|
|
734
|
+
* eslint flat configurations with `eslint-plugin-yml` and overrides
|
|
735
|
+
*/
|
|
551
736
|
async function toml(options = {}) {
|
|
552
737
|
const { rules: overrideRules = {} } = options;
|
|
553
738
|
const toml$1 = await loadPlugin("eslint-plugin-toml");
|
|
@@ -571,6 +756,13 @@ async function toml(options = {}) {
|
|
|
571
756
|
|
|
572
757
|
//#endregion
|
|
573
758
|
//#region src/configs/typescript.ts
|
|
759
|
+
/**
|
|
760
|
+
* `typescript-eslint` and overrides configuration options
|
|
761
|
+
* @param {TypeScriptOptions & OverridesOptions} options
|
|
762
|
+
* eslint configuration options for TypeScript
|
|
763
|
+
* @returns {Promise<Linter.FlatConfig[]>}
|
|
764
|
+
* eslint flat configurations with `typescript-eslint` and overrides
|
|
765
|
+
*/
|
|
574
766
|
async function typescript(options = {}) {
|
|
575
767
|
const { rules: overrideRules = {}, extraFileExtensions = [], parserOptions = { project: true } } = options;
|
|
576
768
|
const ts = await loadPlugin("typescript-eslint");
|
|
@@ -595,6 +787,7 @@ async function typescript(options = {}) {
|
|
|
595
787
|
GLOB_JSON5,
|
|
596
788
|
GLOB_JSONC,
|
|
597
789
|
GLOB_YAML,
|
|
790
|
+
GLOB_HTML,
|
|
598
791
|
GLOB_TOML,
|
|
599
792
|
GLOB_MARKDOWN,
|
|
600
793
|
`${GLOB_MARKDOWN}/**`
|
|
@@ -635,6 +828,13 @@ async function typescript(options = {}) {
|
|
|
635
828
|
|
|
636
829
|
//#endregion
|
|
637
830
|
//#region src/configs/unicorn.ts
|
|
831
|
+
/**
|
|
832
|
+
* `eslint-plugin-unicorn` and overrides configuration options
|
|
833
|
+
* @param {UnicornOptions & OverridesOptions} options
|
|
834
|
+
* eslint unicorn configuration options
|
|
835
|
+
* @returns {Promise<Linter.Config[]>}
|
|
836
|
+
* eslint flat configurations with `eslint-plugin-unicorn` and overrides
|
|
837
|
+
*/
|
|
638
838
|
async function unicorn(options = {}) {
|
|
639
839
|
const { rules: overrideRules = {} } = options;
|
|
640
840
|
const useTypeScript = !options.typescript;
|
|
@@ -651,6 +851,13 @@ async function unicorn(options = {}) {
|
|
|
651
851
|
|
|
652
852
|
//#endregion
|
|
653
853
|
//#region src/configs/vitest.ts
|
|
854
|
+
/**
|
|
855
|
+
* `@vitest/eslint-plugin` and overrides configuration options
|
|
856
|
+
* @param {VitestOptions & OverridesOptions} options
|
|
857
|
+
* eslint vitest configuration options
|
|
858
|
+
* @returns {Promise<Linter.Config[]>}
|
|
859
|
+
* eslint flat configurations with `@vitest/eslint-plugin` and overrides
|
|
860
|
+
*/
|
|
654
861
|
async function vitest(options = {}) {
|
|
655
862
|
const { rules: overrideRules = {}, files: overrideFiles = [] } = options;
|
|
656
863
|
const typeTesting = !!options.typeTesting;
|
|
@@ -678,8 +885,15 @@ async function vitest(options = {}) {
|
|
|
678
885
|
|
|
679
886
|
//#endregion
|
|
680
887
|
//#region src/configs/vue.ts
|
|
888
|
+
/**
|
|
889
|
+
* `eslint-plugin-vue`, `eslint-plugin-vue-composable`, `eslint-plugin-vue-eslint-plugin-vuejs-accessibility` and overrides configuration options
|
|
890
|
+
* @param {VueScriptOptions & TypeScriptOptions & OverridesOptions} options
|
|
891
|
+
* eslint configuration options for Vue
|
|
892
|
+
* @returns {Promise<Linter.Config[]>}
|
|
893
|
+
* eslint flat configurations with `eslint-plugin-vue`, `eslint-plugin-vue-composable`, `eslint-plugin-vue-eslint-plugin-vuejs-accessibility` and overrides
|
|
894
|
+
*/
|
|
681
895
|
async function vue(options = {}) {
|
|
682
|
-
const { rules: overrideRules = {}, parserOptions = {
|
|
896
|
+
const { rules: overrideRules = {}, parserOptions = { projectService: true } } = options;
|
|
683
897
|
const vue$1 = await loadPlugin("eslint-plugin-vue");
|
|
684
898
|
const vueParser = vue$1.configs["flat/base"][1]["languageOptions"]?.parser;
|
|
685
899
|
const configs = [];
|
|
@@ -695,17 +909,14 @@ async function vue(options = {}) {
|
|
|
695
909
|
}
|
|
696
910
|
if (options.scopedCss) {
|
|
697
911
|
const scopedCss = await loadPlugin("eslint-plugin-vue-scoped-css");
|
|
698
|
-
const scopedCssMapped = scopedCss.configs["flat/recommended"].map(
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
return mapped;
|
|
707
|
-
}
|
|
708
|
-
);
|
|
912
|
+
const scopedCssMapped = scopedCss.configs["flat/recommended"].map((config, index) => {
|
|
913
|
+
const mapped = {
|
|
914
|
+
...config,
|
|
915
|
+
ignores: [GLOB_MARKDOWN]
|
|
916
|
+
};
|
|
917
|
+
if (!config.name) mapped.name = `vue/scoped-css/recommended/${index}`;
|
|
918
|
+
return mapped;
|
|
919
|
+
});
|
|
709
920
|
configs.push(scopedCssMapped[0], scopedCssMapped[2]);
|
|
710
921
|
}
|
|
711
922
|
if (options.a11y) {
|
|
@@ -752,6 +963,13 @@ async function vue(options = {}) {
|
|
|
752
963
|
|
|
753
964
|
//#endregion
|
|
754
965
|
//#region src/configs/yml.ts
|
|
966
|
+
/**
|
|
967
|
+
* `eslint-plugin-yml` and overrides configuration options
|
|
968
|
+
* @param {YmlOptions & OverridesOptions} options
|
|
969
|
+
* eslint yml configuration options for yml, yaml
|
|
970
|
+
* @returns {Promise<Linter.Config[]>}
|
|
971
|
+
* eslint flat configurations with `eslint-plugin-yml` and overrides
|
|
972
|
+
*/
|
|
755
973
|
async function yml(options = {}) {
|
|
756
974
|
const { rules: overrideRules = {} } = options;
|
|
757
975
|
const usePrettier = !!options.prettier;
|
|
@@ -780,4 +998,4 @@ async function yml(options = {}) {
|
|
|
780
998
|
const yaml = yml;
|
|
781
999
|
|
|
782
1000
|
//#endregion
|
|
783
|
-
export { comments, css, defineConfig, imports, javascript, jsdoc, jsonc, markdown, md, prettier, promise, react, regexp, stylistic, svelte, toml, typescript, unicorn, vitest, vue, yaml, yml };
|
|
1001
|
+
export { comments, css, defineConfig, html, imports, javascript, jsdoc, jsonc, markdown, md, prettier, promise, react, regexp, stylistic, 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.30.0",
|
|
5
5
|
"author": {
|
|
6
6
|
"email": "kawakazu80@gmail.com",
|
|
7
7
|
"name": "kazuya kawaguchi"
|
|
@@ -49,18 +49,19 @@
|
|
|
49
49
|
}
|
|
50
50
|
},
|
|
51
51
|
"dependencies": {
|
|
52
|
-
"@eslint-community/eslint-plugin-eslint-comments": "^4.
|
|
53
|
-
"@eslint/js": "^9.
|
|
52
|
+
"@eslint-community/eslint-plugin-eslint-comments": "^4.5.0",
|
|
53
|
+
"@eslint/js": "^9.28.0",
|
|
54
54
|
"@kazupon/eslint-plugin": "^0.2.2",
|
|
55
55
|
"@kazupon/jts-utils": "^0.6.0",
|
|
56
|
-
"@stylistic/eslint-plugin": "^4.
|
|
57
|
-
"eslint-flat-config-utils": "^2.0
|
|
56
|
+
"@stylistic/eslint-plugin": "^4.4.1",
|
|
57
|
+
"eslint-flat-config-utils": "^2.1.0",
|
|
58
58
|
"eslint-merge-processors": "^2.0.0",
|
|
59
|
-
"globals": "^16.
|
|
59
|
+
"globals": "^16.2.0"
|
|
60
60
|
},
|
|
61
61
|
"peerDependencies": {
|
|
62
62
|
"@eslint/css": ">=0.5.0",
|
|
63
63
|
"@eslint/markdown": ">=6.1.0",
|
|
64
|
+
"@html-eslint/eslint-plugin": ">=0.41.0",
|
|
64
65
|
"@intlify/eslint-plugin-vue-i18n": ">=4.0.0",
|
|
65
66
|
"@vitest/eslint-plugin": ">=1.0.0",
|
|
66
67
|
"eslint": ">=8.56.0 || >=9.0.0",
|
|
@@ -94,6 +95,9 @@
|
|
|
94
95
|
"@eslint/markdown": {
|
|
95
96
|
"optional": true
|
|
96
97
|
},
|
|
98
|
+
"@html-eslint/eslint-plugin": {
|
|
99
|
+
"optional": true
|
|
100
|
+
},
|
|
97
101
|
"@intlify/eslint-plugin-vue-i18n": {
|
|
98
102
|
"optional": true
|
|
99
103
|
},
|
|
@@ -168,46 +172,48 @@
|
|
|
168
172
|
}
|
|
169
173
|
},
|
|
170
174
|
"devDependencies": {
|
|
171
|
-
"@eslint/
|
|
172
|
-
"@eslint/
|
|
175
|
+
"@eslint/compat": "^1.2.9",
|
|
176
|
+
"@eslint/css": "^0.8.1",
|
|
177
|
+
"@eslint/markdown": "^6.5.0",
|
|
178
|
+
"@html-eslint/eslint-plugin": "^0.41.0",
|
|
173
179
|
"@intlify/eslint-plugin-vue-i18n": "^4.0.1",
|
|
174
180
|
"@kazupon/prettier-config": "^0.1.1",
|
|
175
181
|
"@types/eslint": "^9.6.1",
|
|
176
|
-
"@types/node": "^22.
|
|
177
|
-
"@vitest/eslint-plugin": "^1.1
|
|
178
|
-
"bumpp": "^10.1.
|
|
179
|
-
"eslint": "^9.
|
|
180
|
-
"eslint-config-prettier": "^10.1.
|
|
181
|
-
"eslint-import-resolver-typescript": "^4.
|
|
182
|
+
"@types/node": "^22.15.30",
|
|
183
|
+
"@vitest/eslint-plugin": "^1.2.1",
|
|
184
|
+
"bumpp": "^10.1.1",
|
|
185
|
+
"eslint": "^9.28.0",
|
|
186
|
+
"eslint-config-prettier": "^10.1.5",
|
|
187
|
+
"eslint-import-resolver-typescript": "^4.4.3",
|
|
182
188
|
"eslint-plugin-import": "^2.31.0",
|
|
183
|
-
"eslint-plugin-jsdoc": "^50.
|
|
184
|
-
"eslint-plugin-jsonc": "^2.
|
|
185
|
-
"eslint-plugin-module-interop": "^0.3.
|
|
189
|
+
"eslint-plugin-jsdoc": "^50.7.1",
|
|
190
|
+
"eslint-plugin-jsonc": "^2.20.1",
|
|
191
|
+
"eslint-plugin-module-interop": "^0.3.1",
|
|
186
192
|
"eslint-plugin-promise": "^7.2.1",
|
|
187
|
-
"eslint-plugin-react": "^7.37.
|
|
193
|
+
"eslint-plugin-react": "^7.37.5",
|
|
188
194
|
"eslint-plugin-react-hooks": "^5.2.0",
|
|
189
|
-
"eslint-plugin-react-refresh": "^0.4.
|
|
190
|
-
"eslint-plugin-regexp": "^2.
|
|
195
|
+
"eslint-plugin-react-refresh": "^0.4.20",
|
|
196
|
+
"eslint-plugin-regexp": "^2.8.0",
|
|
191
197
|
"eslint-plugin-svelte": "^2.46.1",
|
|
192
198
|
"eslint-plugin-toml": "^0.12.0",
|
|
193
|
-
"eslint-plugin-unicorn": "^
|
|
199
|
+
"eslint-plugin-unicorn": "^59.0.0",
|
|
194
200
|
"eslint-plugin-unused-imports": "^4.1.4",
|
|
195
|
-
"eslint-plugin-vue": "^10.
|
|
201
|
+
"eslint-plugin-vue": "^10.2.0",
|
|
196
202
|
"eslint-plugin-vue-composable": "^1.0.0",
|
|
197
|
-
"eslint-plugin-vue-scoped-css": "^2.
|
|
203
|
+
"eslint-plugin-vue-scoped-css": "^2.10.0",
|
|
198
204
|
"eslint-plugin-vuejs-accessibility": "^2.4.1",
|
|
199
|
-
"eslint-plugin-yml": "^1.
|
|
200
|
-
"eslint-typegen": "^2.
|
|
205
|
+
"eslint-plugin-yml": "^1.18.0",
|
|
206
|
+
"eslint-typegen": "^2.2.0",
|
|
201
207
|
"gh-changelogen": "^0.2.8",
|
|
202
208
|
"jiti": "^2.4.2",
|
|
203
|
-
"knip": "^5.
|
|
204
|
-
"lint-staged": "^
|
|
209
|
+
"knip": "^5.60.2",
|
|
210
|
+
"lint-staged": "^16.0.0",
|
|
205
211
|
"prettier": "^3.5.3",
|
|
206
|
-
"svelte": "^5.
|
|
207
|
-
"tsdown": "^0.
|
|
208
|
-
"typescript": "^5.8.
|
|
209
|
-
"typescript-eslint": "^8.
|
|
210
|
-
"vitest": "^3.
|
|
212
|
+
"svelte": "^5.33.14",
|
|
213
|
+
"tsdown": "^0.12.7",
|
|
214
|
+
"typescript": "^5.8.3",
|
|
215
|
+
"typescript-eslint": "^8.33.1",
|
|
216
|
+
"vitest": "^3.2.2"
|
|
211
217
|
},
|
|
212
218
|
"prettier": "@kazupon/prettier-config",
|
|
213
219
|
"lint-staged": {
|
|
@@ -215,7 +221,7 @@
|
|
|
215
221
|
"prettier --parser=typescript --write",
|
|
216
222
|
"eslint --fix"
|
|
217
223
|
],
|
|
218
|
-
"*.{js,mjs,cjs}": [
|
|
224
|
+
"*.{js,mjs,cjs,html}": [
|
|
219
225
|
"prettier --write",
|
|
220
226
|
"eslint --fix"
|
|
221
227
|
],
|