@kazupon/eslint-config 0.28.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 +6 -5
- package/dist/index.d.ts +15688 -15877
- package/dist/index.js +251 -26
- package/package.json +40 -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,22 +92,44 @@ 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
|
-
const { rules: overrideRules = {} } = options;
|
|
72
102
|
const comments$1 = await loadPlugin("@eslint-community/eslint-plugin-eslint-comments");
|
|
103
|
+
const kazupon = await loadPlugin("@kazupon/eslint-plugin");
|
|
104
|
+
const directives = options.directives ?? {};
|
|
105
|
+
const kazuponOptions = options.kazupon ?? {};
|
|
73
106
|
return [{
|
|
74
|
-
name: "@eslint-community/eslint-comments
|
|
75
|
-
ignores: [GLOB_MARKDOWN],
|
|
107
|
+
name: "@eslint-community/eslint-comments",
|
|
108
|
+
ignores: directives.ignores ? [GLOB_MARKDOWN, ...directives.ignores] : [GLOB_MARKDOWN],
|
|
76
109
|
plugins: { "@eslint-community/eslint-comments": comments$1 },
|
|
77
|
-
rules: {
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
}
|
|
110
|
+
rules: {
|
|
111
|
+
...comments$1.configs.recommended.rules,
|
|
112
|
+
...directives.rules
|
|
113
|
+
}
|
|
114
|
+
}, ...kazupon.configs.comment.map((config) => ({
|
|
115
|
+
...config,
|
|
116
|
+
ignores: [...config.ignores, ...kazuponOptions.ignores || []],
|
|
117
|
+
rules: {
|
|
118
|
+
...config.rules,
|
|
119
|
+
...kazuponOptions.rules
|
|
120
|
+
}
|
|
121
|
+
}))];
|
|
82
122
|
}
|
|
83
123
|
|
|
84
124
|
//#endregion
|
|
85
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
|
+
*/
|
|
86
133
|
async function css(options = {}) {
|
|
87
134
|
const { rules: overrideRules = {} } = options;
|
|
88
135
|
const tolerant = !!options.tolerant;
|
|
@@ -109,6 +156,69 @@ async function css(options = {}) {
|
|
|
109
156
|
}];
|
|
110
157
|
}
|
|
111
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
|
+
|
|
112
222
|
//#endregion
|
|
113
223
|
//#region src/configs/imports.ts
|
|
114
224
|
const IMPORTS_FILES = [
|
|
@@ -117,6 +227,14 @@ const IMPORTS_FILES = [
|
|
|
117
227
|
GLOB_TS,
|
|
118
228
|
GLOB_TSX
|
|
119
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
|
+
*/
|
|
120
238
|
async function imports(options = {}) {
|
|
121
239
|
const { rules: overrideRules = {}, interop = true } = options;
|
|
122
240
|
const unused = await loadPlugin("eslint-plugin-unused-imports");
|
|
@@ -172,6 +290,11 @@ async function imports(options = {}) {
|
|
|
172
290
|
|
|
173
291
|
//#endregion
|
|
174
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
|
+
*/
|
|
175
298
|
async function javascript(options = {}) {
|
|
176
299
|
const { rules: overrideRules = {} } = options;
|
|
177
300
|
const js = await loadPlugin("@eslint/js");
|
|
@@ -205,6 +328,13 @@ async function javascript(options = {}) {
|
|
|
205
328
|
|
|
206
329
|
//#endregion
|
|
207
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
|
+
*/
|
|
208
338
|
async function jsdoc(options = {}) {
|
|
209
339
|
const { rules: overrideRules = {}, typescript: typescript$1, error = false } = options;
|
|
210
340
|
const jsdoc$1 = await loadPlugin("eslint-plugin-jsdoc");
|
|
@@ -226,6 +356,13 @@ async function jsdoc(options = {}) {
|
|
|
226
356
|
|
|
227
357
|
//#endregion
|
|
228
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
|
+
*/
|
|
229
366
|
async function jsonc(options = {}) {
|
|
230
367
|
const { rules: overrideRules = {} } = options;
|
|
231
368
|
const kinds = [
|
|
@@ -346,6 +483,13 @@ function jsoncSort() {
|
|
|
346
483
|
|
|
347
484
|
//#endregion
|
|
348
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
|
+
*/
|
|
349
493
|
async function markdown(options = {}) {
|
|
350
494
|
const { rules: overrideRules = {}, files = [GLOB_MARKDOWN], blockExtensions = [] } = options;
|
|
351
495
|
const language = options.language || "gfm";
|
|
@@ -389,6 +533,13 @@ const md = markdown;
|
|
|
389
533
|
|
|
390
534
|
//#endregion
|
|
391
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
|
+
*/
|
|
392
543
|
async function prettier(options = {}) {
|
|
393
544
|
const { rules: overrideRules = {} } = options;
|
|
394
545
|
const prettier$1 = await loadPlugin("eslint-config-prettier");
|
|
@@ -403,6 +554,13 @@ async function prettier(options = {}) {
|
|
|
403
554
|
|
|
404
555
|
//#endregion
|
|
405
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
|
+
*/
|
|
406
564
|
async function promise(options = {}) {
|
|
407
565
|
const { rules: overrideRules = {} } = options;
|
|
408
566
|
const promise$1 = await loadPlugin("eslint-plugin-promise");
|
|
@@ -417,6 +575,13 @@ async function promise(options = {}) {
|
|
|
417
575
|
|
|
418
576
|
//#endregion
|
|
419
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
|
+
*/
|
|
420
585
|
async function react(options = {}) {
|
|
421
586
|
const { rules: overrideRules = {}, settings = {} } = options;
|
|
422
587
|
const useTypeScript = !options.typescript;
|
|
@@ -458,6 +623,13 @@ async function react(options = {}) {
|
|
|
458
623
|
|
|
459
624
|
//#endregion
|
|
460
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
|
+
*/
|
|
461
633
|
async function regexp(options = {}) {
|
|
462
634
|
const { rules: overrideRules = {} } = options;
|
|
463
635
|
const regexp$1 = await loadPlugin("eslint-plugin-regexp");
|
|
@@ -473,6 +645,13 @@ async function regexp(options = {}) {
|
|
|
473
645
|
|
|
474
646
|
//#endregion
|
|
475
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
|
+
*/
|
|
476
655
|
async function stylistic(options = {}) {
|
|
477
656
|
const { rules: overrideRules = {}, customize = {
|
|
478
657
|
commaDangle: "never",
|
|
@@ -503,18 +682,23 @@ async function stylistic(options = {}) {
|
|
|
503
682
|
allowTypeStart: true
|
|
504
683
|
}],
|
|
505
684
|
"@stylistic/spaced-comment": ["error"],
|
|
506
|
-
"@stylistic/multiline-comment-style": ["error", "separate-lines"]
|
|
685
|
+
"@stylistic/multiline-comment-style": ["error", "separate-lines"],
|
|
686
|
+
...overrideRules
|
|
507
687
|
}
|
|
508
|
-
}, {
|
|
509
|
-
name: "@kazupon/@stylistic/overrides",
|
|
510
|
-
rules: { ...overrideRules }
|
|
511
688
|
}];
|
|
512
689
|
}
|
|
513
690
|
|
|
514
691
|
//#endregion
|
|
515
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
|
+
*/
|
|
516
700
|
async function svelte(options = {}) {
|
|
517
|
-
const { rules: overrideRules = {}, parserOptions = {
|
|
701
|
+
const { rules: overrideRules = {}, parserOptions = { projectService: true }, svelteConfig = {} } = options;
|
|
518
702
|
const useTypeScript = !!options.typescript;
|
|
519
703
|
const svelte$1 = await loadPlugin("eslint-plugin-svelte");
|
|
520
704
|
const svelteParser = svelte$1.configs["flat/base"][1]["languageOptions"]?.parser;
|
|
@@ -530,6 +714,7 @@ async function svelte(options = {}) {
|
|
|
530
714
|
parser: await getTypeScriptParser(),
|
|
531
715
|
ecmaFeatures: { jsx: true },
|
|
532
716
|
extraFileExtensions: [".svelte"],
|
|
717
|
+
svelteConfig,
|
|
533
718
|
...parserOptions
|
|
534
719
|
}
|
|
535
720
|
};
|
|
@@ -541,6 +726,13 @@ async function svelte(options = {}) {
|
|
|
541
726
|
|
|
542
727
|
//#endregion
|
|
543
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
|
+
*/
|
|
544
736
|
async function toml(options = {}) {
|
|
545
737
|
const { rules: overrideRules = {} } = options;
|
|
546
738
|
const toml$1 = await loadPlugin("eslint-plugin-toml");
|
|
@@ -564,6 +756,13 @@ async function toml(options = {}) {
|
|
|
564
756
|
|
|
565
757
|
//#endregion
|
|
566
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
|
+
*/
|
|
567
766
|
async function typescript(options = {}) {
|
|
568
767
|
const { rules: overrideRules = {}, extraFileExtensions = [], parserOptions = { project: true } } = options;
|
|
569
768
|
const ts = await loadPlugin("typescript-eslint");
|
|
@@ -588,6 +787,7 @@ async function typescript(options = {}) {
|
|
|
588
787
|
GLOB_JSON5,
|
|
589
788
|
GLOB_JSONC,
|
|
590
789
|
GLOB_YAML,
|
|
790
|
+
GLOB_HTML,
|
|
591
791
|
GLOB_TOML,
|
|
592
792
|
GLOB_MARKDOWN,
|
|
593
793
|
`${GLOB_MARKDOWN}/**`
|
|
@@ -628,6 +828,13 @@ async function typescript(options = {}) {
|
|
|
628
828
|
|
|
629
829
|
//#endregion
|
|
630
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
|
+
*/
|
|
631
838
|
async function unicorn(options = {}) {
|
|
632
839
|
const { rules: overrideRules = {} } = options;
|
|
633
840
|
const useTypeScript = !options.typescript;
|
|
@@ -644,6 +851,13 @@ async function unicorn(options = {}) {
|
|
|
644
851
|
|
|
645
852
|
//#endregion
|
|
646
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
|
+
*/
|
|
647
861
|
async function vitest(options = {}) {
|
|
648
862
|
const { rules: overrideRules = {}, files: overrideFiles = [] } = options;
|
|
649
863
|
const typeTesting = !!options.typeTesting;
|
|
@@ -671,8 +885,15 @@ async function vitest(options = {}) {
|
|
|
671
885
|
|
|
672
886
|
//#endregion
|
|
673
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
|
+
*/
|
|
674
895
|
async function vue(options = {}) {
|
|
675
|
-
const { rules: overrideRules = {}, parserOptions = {
|
|
896
|
+
const { rules: overrideRules = {}, parserOptions = { projectService: true } } = options;
|
|
676
897
|
const vue$1 = await loadPlugin("eslint-plugin-vue");
|
|
677
898
|
const vueParser = vue$1.configs["flat/base"][1]["languageOptions"]?.parser;
|
|
678
899
|
const configs = [];
|
|
@@ -688,17 +909,14 @@ async function vue(options = {}) {
|
|
|
688
909
|
}
|
|
689
910
|
if (options.scopedCss) {
|
|
690
911
|
const scopedCss = await loadPlugin("eslint-plugin-vue-scoped-css");
|
|
691
|
-
const scopedCssMapped = scopedCss.configs["flat/recommended"].map(
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
return mapped;
|
|
700
|
-
}
|
|
701
|
-
);
|
|
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
|
+
});
|
|
702
920
|
configs.push(scopedCssMapped[0], scopedCssMapped[2]);
|
|
703
921
|
}
|
|
704
922
|
if (options.a11y) {
|
|
@@ -745,6 +963,13 @@ async function vue(options = {}) {
|
|
|
745
963
|
|
|
746
964
|
//#endregion
|
|
747
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
|
+
*/
|
|
748
973
|
async function yml(options = {}) {
|
|
749
974
|
const { rules: overrideRules = {} } = options;
|
|
750
975
|
const usePrettier = !!options.prettier;
|
|
@@ -773,4 +998,4 @@ async function yml(options = {}) {
|
|
|
773
998
|
const yaml = yml;
|
|
774
999
|
|
|
775
1000
|
//#endregion
|
|
776
|
-
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,17 +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
|
+
"@kazupon/eslint-plugin": "^0.2.2",
|
|
54
55
|
"@kazupon/jts-utils": "^0.6.0",
|
|
55
|
-
"@stylistic/eslint-plugin": "^4.
|
|
56
|
-
"eslint-flat-config-utils": "^2.0
|
|
56
|
+
"@stylistic/eslint-plugin": "^4.4.1",
|
|
57
|
+
"eslint-flat-config-utils": "^2.1.0",
|
|
57
58
|
"eslint-merge-processors": "^2.0.0",
|
|
58
|
-
"globals": "^16.
|
|
59
|
+
"globals": "^16.2.0"
|
|
59
60
|
},
|
|
60
61
|
"peerDependencies": {
|
|
61
62
|
"@eslint/css": ">=0.5.0",
|
|
62
63
|
"@eslint/markdown": ">=6.1.0",
|
|
64
|
+
"@html-eslint/eslint-plugin": ">=0.41.0",
|
|
63
65
|
"@intlify/eslint-plugin-vue-i18n": ">=4.0.0",
|
|
64
66
|
"@vitest/eslint-plugin": ">=1.0.0",
|
|
65
67
|
"eslint": ">=8.56.0 || >=9.0.0",
|
|
@@ -93,6 +95,9 @@
|
|
|
93
95
|
"@eslint/markdown": {
|
|
94
96
|
"optional": true
|
|
95
97
|
},
|
|
98
|
+
"@html-eslint/eslint-plugin": {
|
|
99
|
+
"optional": true
|
|
100
|
+
},
|
|
96
101
|
"@intlify/eslint-plugin-vue-i18n": {
|
|
97
102
|
"optional": true
|
|
98
103
|
},
|
|
@@ -167,46 +172,48 @@
|
|
|
167
172
|
}
|
|
168
173
|
},
|
|
169
174
|
"devDependencies": {
|
|
170
|
-
"@eslint/
|
|
171
|
-
"@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",
|
|
172
179
|
"@intlify/eslint-plugin-vue-i18n": "^4.0.1",
|
|
173
180
|
"@kazupon/prettier-config": "^0.1.1",
|
|
174
181
|
"@types/eslint": "^9.6.1",
|
|
175
|
-
"@types/node": "^22.
|
|
176
|
-
"@vitest/eslint-plugin": "^1.1
|
|
177
|
-
"bumpp": "^10.1.
|
|
178
|
-
"eslint": "^9.
|
|
179
|
-
"eslint-config-prettier": "^10.1.
|
|
180
|
-
"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",
|
|
181
188
|
"eslint-plugin-import": "^2.31.0",
|
|
182
|
-
"eslint-plugin-jsdoc": "^50.
|
|
183
|
-
"eslint-plugin-jsonc": "^2.
|
|
184
|
-
"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",
|
|
185
192
|
"eslint-plugin-promise": "^7.2.1",
|
|
186
|
-
"eslint-plugin-react": "^7.37.
|
|
193
|
+
"eslint-plugin-react": "^7.37.5",
|
|
187
194
|
"eslint-plugin-react-hooks": "^5.2.0",
|
|
188
|
-
"eslint-plugin-react-refresh": "^0.4.
|
|
189
|
-
"eslint-plugin-regexp": "^2.
|
|
195
|
+
"eslint-plugin-react-refresh": "^0.4.20",
|
|
196
|
+
"eslint-plugin-regexp": "^2.8.0",
|
|
190
197
|
"eslint-plugin-svelte": "^2.46.1",
|
|
191
198
|
"eslint-plugin-toml": "^0.12.0",
|
|
192
|
-
"eslint-plugin-unicorn": "^
|
|
199
|
+
"eslint-plugin-unicorn": "^59.0.0",
|
|
193
200
|
"eslint-plugin-unused-imports": "^4.1.4",
|
|
194
|
-
"eslint-plugin-vue": "^10.
|
|
201
|
+
"eslint-plugin-vue": "^10.2.0",
|
|
195
202
|
"eslint-plugin-vue-composable": "^1.0.0",
|
|
196
|
-
"eslint-plugin-vue-scoped-css": "^2.
|
|
203
|
+
"eslint-plugin-vue-scoped-css": "^2.10.0",
|
|
197
204
|
"eslint-plugin-vuejs-accessibility": "^2.4.1",
|
|
198
|
-
"eslint-plugin-yml": "^1.
|
|
199
|
-
"eslint-typegen": "^2.
|
|
205
|
+
"eslint-plugin-yml": "^1.18.0",
|
|
206
|
+
"eslint-typegen": "^2.2.0",
|
|
200
207
|
"gh-changelogen": "^0.2.8",
|
|
201
208
|
"jiti": "^2.4.2",
|
|
202
|
-
"knip": "^5.
|
|
203
|
-
"lint-staged": "^
|
|
209
|
+
"knip": "^5.60.2",
|
|
210
|
+
"lint-staged": "^16.0.0",
|
|
204
211
|
"prettier": "^3.5.3",
|
|
205
|
-
"svelte": "^5.
|
|
206
|
-
"tsdown": "^0.
|
|
207
|
-
"typescript": "^5.8.
|
|
208
|
-
"typescript-eslint": "^8.
|
|
209
|
-
"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"
|
|
210
217
|
},
|
|
211
218
|
"prettier": "@kazupon/prettier-config",
|
|
212
219
|
"lint-staged": {
|
|
@@ -214,7 +221,7 @@
|
|
|
214
221
|
"prettier --parser=typescript --write",
|
|
215
222
|
"eslint --fix"
|
|
216
223
|
],
|
|
217
|
-
"*.{js,mjs,cjs}": [
|
|
224
|
+
"*.{js,mjs,cjs,html}": [
|
|
218
225
|
"prettier --write",
|
|
219
226
|
"eslint --fix"
|
|
220
227
|
],
|