@kazupon/eslint-config 0.23.0 → 0.25.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 +2 -2
- package/dist/index.d.ts +49 -4
- package/dist/index.js +100 -38
- package/package.json +28 -22
package/README.md
CHANGED
|
@@ -63,7 +63,7 @@ export default defineConfig(
|
|
|
63
63
|
)
|
|
64
64
|
```
|
|
65
65
|
|
|
66
|
-
> [!IMPORTANT]
|
|
66
|
+
> [!IMPORTANT] <!-- eslint-disable-line markdown/no-missing-label-refs -->
|
|
67
67
|
> Support flat configuration only, **not supported Legacy style (`.eslintrc`)**
|
|
68
68
|
|
|
69
69
|
### Lint with npm scripts `package.json`
|
|
@@ -125,7 +125,7 @@ The following built-in preset configurations are supported:
|
|
|
125
125
|
| `javascript` | [`@eslint/js`](https://www.npmjs.com/package/@eslint/js) | no (built-in) |
|
|
126
126
|
| `comments` | [`@eslint-community/eslint-plugin-eslint-comments`](https://www.npmjs.com/package/@eslint-community/eslint-plugin-eslint-comments) | no (built-in) |
|
|
127
127
|
| `typescript` | [`typescript-eslint`](https://www.npmjs.com/package/typescript-eslint) | yes |
|
|
128
|
-
| `imports` | [`eslint-plugin-import`](https://www.npmjs.com/package/eslint-plugin-import), [`eslint-plugin-unused-imports`](https://www.npmjs.com/package/eslint-plugin-unused-imports)
|
|
128
|
+
| `imports` | [`eslint-plugin-import`](https://www.npmjs.com/package/eslint-plugin-import), [`eslint-plugin-unused-imports`](https://www.npmjs.com/package/eslint-plugin-unused-imports), [`eslint-plugin-module-interop`](https://www.npmjs.com/package/eslint-plugin-module-interop) | yes |
|
|
129
129
|
| `jsdoc` | [`eslint-plugin-jsdoc`](https://www.npmjs.com/package/eslint-plugin-jsdoc) | yes |
|
|
130
130
|
| `regexp` | [`eslint-plugin-regexp`](https://www.npmjs.com/package/eslint-plugin-regexp) | yes |
|
|
131
131
|
| `promise` | [`eslint-plugin-promise`](https://www.npmjs.com/package/eslint-plugin-promise) | yes |
|
package/dist/index.d.ts
CHANGED
|
@@ -362,6 +362,21 @@ interface ImportsRules {
|
|
|
362
362
|
* @see https://github.com/import-js/eslint-plugin-import/blob/v2.31.0/docs/rules/unambiguous.md
|
|
363
363
|
*/
|
|
364
364
|
'import/unambiguous'?: Linter.RuleEntry<[]>;
|
|
365
|
+
/**
|
|
366
|
+
* disallow importing CommonJS modules
|
|
367
|
+
* @see https://ota-meshi.github.io/eslint-plugin-module-interop/rules/no-import-cjs.html
|
|
368
|
+
*/
|
|
369
|
+
'module-interop/no-import-cjs'?: Linter.RuleEntry<[]>;
|
|
370
|
+
/**
|
|
371
|
+
* disallow `require(esm)`
|
|
372
|
+
* @see https://ota-meshi.github.io/eslint-plugin-module-interop/rules/no-require-esm.html
|
|
373
|
+
*/
|
|
374
|
+
'module-interop/no-require-esm'?: Linter.RuleEntry<[]>;
|
|
375
|
+
/**
|
|
376
|
+
* enforce json imports to have the `{type: "json"}` attribute.
|
|
377
|
+
* @see https://ota-meshi.github.io/eslint-plugin-module-interop/rules/prefer-json-modules.html
|
|
378
|
+
*/
|
|
379
|
+
'module-interop/prefer-json-modules'?: Linter.RuleEntry<[]>;
|
|
365
380
|
/**
|
|
366
381
|
* Disallow unused variables
|
|
367
382
|
* @see https://github.com/sweepline/eslint-plugin-unused-imports/blob/master/docs/rules/no-unused-imports.md
|
|
@@ -8458,6 +8473,7 @@ type TypescriptEslintExplicitModuleBoundaryTypes = [] | [
|
|
|
8458
8473
|
allowDirectConstAssertionInArrowFunctions?: boolean;
|
|
8459
8474
|
allowedNames?: string[];
|
|
8460
8475
|
allowHigherOrderFunctions?: boolean;
|
|
8476
|
+
allowOverloadFunctions?: boolean;
|
|
8461
8477
|
allowTypedFunctionExpressions?: boolean;
|
|
8462
8478
|
}
|
|
8463
8479
|
];
|
|
@@ -9358,6 +9374,7 @@ type TypescriptEslintUnboundMethod = [] | [
|
|
|
9358
9374
|
type TypescriptEslintUnifiedSignatures = [] | [
|
|
9359
9375
|
{
|
|
9360
9376
|
ignoreDifferentlyNamedParameters?: boolean;
|
|
9377
|
+
ignoreOverloadsWithDifferentJSDoc?: boolean;
|
|
9361
9378
|
}
|
|
9362
9379
|
];
|
|
9363
9380
|
|
|
@@ -10919,7 +10936,7 @@ interface VueRules {
|
|
|
10919
10936
|
*/
|
|
10920
10937
|
'vue/html-closing-bracket-spacing'?: Linter.RuleEntry<VueHtmlClosingBracketSpacing>;
|
|
10921
10938
|
/**
|
|
10922
|
-
* enforce unified line
|
|
10939
|
+
* enforce unified line break in HTML comments
|
|
10923
10940
|
* @see https://eslint.vuejs.org/rules/html-comment-content-newline.html
|
|
10924
10941
|
*/
|
|
10925
10942
|
'vue/html-comment-content-newline'?: Linter.RuleEntry<VueHtmlCommentContentNewline>;
|
|
@@ -11228,6 +11245,11 @@ interface VueRules {
|
|
|
11228
11245
|
* @see https://eslint.vuejs.org/rules/no-extra-parens.html
|
|
11229
11246
|
*/
|
|
11230
11247
|
'vue/no-extra-parens'?: Linter.RuleEntry<VueNoExtraParens>;
|
|
11248
|
+
/**
|
|
11249
|
+
* Disallow shorthand type conversions in `<template>`
|
|
11250
|
+
* @see https://eslint.vuejs.org/rules/no-implicit-coercion.html
|
|
11251
|
+
*/
|
|
11252
|
+
'vue/no-implicit-coercion'?: Linter.RuleEntry<VueNoImplicitCoercion>;
|
|
11231
11253
|
/**
|
|
11232
11254
|
* require valid keys in model option
|
|
11233
11255
|
* @see https://eslint.vuejs.org/rules/no-invalid-model-keys.html
|
|
@@ -11260,12 +11282,12 @@ interface VueRules {
|
|
|
11260
11282
|
*/
|
|
11261
11283
|
'vue/no-multi-spaces'?: Linter.RuleEntry<VueNoMultiSpaces>;
|
|
11262
11284
|
/**
|
|
11263
|
-
* disallow
|
|
11285
|
+
* disallow passing multiple objects in an array to class
|
|
11264
11286
|
* @see https://eslint.vuejs.org/rules/no-multiple-objects-in-class.html
|
|
11265
11287
|
*/
|
|
11266
11288
|
'vue/no-multiple-objects-in-class'?: Linter.RuleEntry<[]>;
|
|
11267
11289
|
/**
|
|
11268
|
-
* disallow
|
|
11290
|
+
* disallow passing multiple arguments to scoped slots
|
|
11269
11291
|
* @see https://eslint.vuejs.org/rules/no-multiple-slot-args.html
|
|
11270
11292
|
*/
|
|
11271
11293
|
'vue/no-multiple-slot-args'?: Linter.RuleEntry<[]>;
|
|
@@ -12932,6 +12954,15 @@ type VueNoExtraParens = ([] | ["functions"] | [] | ["all"] | [
|
|
|
12932
12954
|
allowParensAfterCommentPattern?: string;
|
|
12933
12955
|
}
|
|
12934
12956
|
]);
|
|
12957
|
+
type VueNoImplicitCoercion = [] | [
|
|
12958
|
+
{
|
|
12959
|
+
boolean?: boolean;
|
|
12960
|
+
number?: boolean;
|
|
12961
|
+
string?: boolean;
|
|
12962
|
+
disallowTemplateShorthand?: boolean;
|
|
12963
|
+
allow?: ("~" | "!!" | "+" | "- -" | "-" | "*")[];
|
|
12964
|
+
}
|
|
12965
|
+
];
|
|
12935
12966
|
type VueNoIrregularWhitespace = [] | [
|
|
12936
12967
|
{
|
|
12937
12968
|
skipComments?: boolean;
|
|
@@ -13244,7 +13275,12 @@ type VuePaddingLinesInComponentDefinition = [] | [
|
|
|
13244
13275
|
})
|
|
13245
13276
|
];
|
|
13246
13277
|
type VuePreferTrueAttributeShorthand = [] | [("always" | "never")];
|
|
13247
|
-
type VuePropNameCasing = [] | [("camelCase" | "snake_case")]
|
|
13278
|
+
type VuePropNameCasing = [] | [("camelCase" | "snake_case")] | [
|
|
13279
|
+
("camelCase" | "snake_case"),
|
|
13280
|
+
{
|
|
13281
|
+
ignoreProps?: string[];
|
|
13282
|
+
}
|
|
13283
|
+
];
|
|
13248
13284
|
type VueQuoteProps = ([] | [("always" | "as-needed" | "consistent" | "consistent-as-needed")] | [] | [("always" | "as-needed" | "consistent" | "consistent-as-needed")] | [
|
|
13249
13285
|
("always" | "as-needed" | "consistent" | "consistent-as-needed"),
|
|
13250
13286
|
{
|
|
@@ -13911,6 +13947,11 @@ interface ImportsOptions {
|
|
|
13911
13947
|
* @default false
|
|
13912
13948
|
*/
|
|
13913
13949
|
typescript?: boolean;
|
|
13950
|
+
/**
|
|
13951
|
+
* use `eslint-plugin-module-interop`
|
|
13952
|
+
* @default true
|
|
13953
|
+
*/
|
|
13954
|
+
interop?: boolean;
|
|
13914
13955
|
}
|
|
13915
13956
|
/**
|
|
13916
13957
|
* `eslint-plugin-import-x`, `eslint-plugin-unused-imports` and overrides configuration options
|
|
@@ -14016,6 +14057,10 @@ interface MarkdownOptions {
|
|
|
14016
14057
|
* @default true
|
|
14017
14058
|
*/
|
|
14018
14059
|
fencedCodeBlocks?: boolean;
|
|
14060
|
+
/**
|
|
14061
|
+
* enable block extensions
|
|
14062
|
+
*/
|
|
14063
|
+
blockExtensions?: string[];
|
|
14019
14064
|
}
|
|
14020
14065
|
/**
|
|
14021
14066
|
* `@eslint/markdown` and overrides configuration options
|
package/dist/index.js
CHANGED
|
@@ -2,6 +2,7 @@ import { FlatConfigComposer } from "eslint-flat-config-utils";
|
|
|
2
2
|
import { interopDefault } from "@kazupon/jts-utils/module";
|
|
3
3
|
import { isObject } from "@kazupon/jts-utils/object";
|
|
4
4
|
import globals from "globals";
|
|
5
|
+
import { mergeProcessors, processorPassThrough } from "eslint-merge-processors";
|
|
5
6
|
|
|
6
7
|
//#region src/config.ts
|
|
7
8
|
function defineConfig(...configs) {
|
|
@@ -25,6 +26,7 @@ const GLOB_SVELTE = "**/*.svelte";
|
|
|
25
26
|
const GLOB_MARKDOWN = "**/*.md";
|
|
26
27
|
const GLOB_CSS = "**/*.css";
|
|
27
28
|
const GLOB_SRC_EXT = "?([cm])[jt]s?(x)";
|
|
29
|
+
const GLOB_SRC = "**/*.?([cm])[jt]s?(x)";
|
|
28
30
|
const GLOB_TESTS = [
|
|
29
31
|
`**/test/**/*.${GLOB_SRC_EXT}`,
|
|
30
32
|
`**/tests/**/*.${GLOB_SRC_EXT}`,
|
|
@@ -66,6 +68,7 @@ async function comments(options = {}) {
|
|
|
66
68
|
const comments$1 = await loadPlugin("@eslint-community/eslint-plugin-eslint-comments");
|
|
67
69
|
return [{
|
|
68
70
|
name: "@eslint-community/eslint-comments/recommended",
|
|
71
|
+
ignores: [GLOB_MARKDOWN],
|
|
69
72
|
plugins: { "@eslint-community/eslint-comments": comments$1 },
|
|
70
73
|
rules: { ...comments$1.configs.recommended.rules }
|
|
71
74
|
}, {
|
|
@@ -82,6 +85,7 @@ async function css(options = {}) {
|
|
|
82
85
|
const customSyntax = !!options.customSyntax;
|
|
83
86
|
const css$1 = await loadPlugin("@eslint/css");
|
|
84
87
|
const core = {
|
|
88
|
+
name: "@eslint/css/recommended",
|
|
85
89
|
files: [GLOB_CSS],
|
|
86
90
|
language: "css/css",
|
|
87
91
|
...css$1.configs["recommended"]
|
|
@@ -110,20 +114,29 @@ const IMPORTS_FILES = [
|
|
|
110
114
|
GLOB_TSX
|
|
111
115
|
];
|
|
112
116
|
async function imports(options = {}) {
|
|
113
|
-
const { rules: overrideRules = {} } = options;
|
|
114
|
-
const unused = await loadPlugin(
|
|
115
|
-
// eslint-disable-line @typescript-eslint/no-unsafe-assignment
|
|
116
|
-
"eslint-plugin-unused-imports"
|
|
117
|
-
);
|
|
117
|
+
const { rules: overrideRules = {}, interop = true } = options;
|
|
118
|
+
const unused = await loadPlugin("eslint-plugin-unused-imports");
|
|
118
119
|
const imports$1 = await loadPlugin("eslint-plugin-import");
|
|
119
120
|
const configs = [imports$1.flatConfigs.recommended];
|
|
120
121
|
if (options.typescript) try {
|
|
121
122
|
await loadPlugin("eslint-import-resolver-typescript");
|
|
122
123
|
imports$1.flatConfigs.typescript.settings["import/resolver"]["typescript"] = true;
|
|
123
|
-
configs.push(
|
|
124
|
+
configs.push({
|
|
125
|
+
name: "import/typescript",
|
|
126
|
+
...imports$1.flatConfigs.typescript
|
|
127
|
+
});
|
|
124
128
|
} catch (error) {
|
|
125
129
|
throw new Error(`Not found eslint-import-resolver-typescript: ${error.message}`);
|
|
126
130
|
}
|
|
131
|
+
if (interop) try {
|
|
132
|
+
const modInterop = await loadPlugin("eslint-plugin-module-interop");
|
|
133
|
+
configs.push({
|
|
134
|
+
name: "module-interop",
|
|
135
|
+
...modInterop.configs.recommended
|
|
136
|
+
});
|
|
137
|
+
} catch (error) {
|
|
138
|
+
throw new Error(`Not found eslint-plugin-module-interop: ${error.message}`);
|
|
139
|
+
}
|
|
127
140
|
configs.push({
|
|
128
141
|
name: "unused-imports",
|
|
129
142
|
plugins: { "unused-imports": unused },
|
|
@@ -159,10 +172,11 @@ async function javascript(options = {}) {
|
|
|
159
172
|
const { rules: overrideRules = {} } = options;
|
|
160
173
|
const js = await loadPlugin("@eslint/js");
|
|
161
174
|
return [{
|
|
162
|
-
name: "
|
|
175
|
+
name: "@kazupon/javascript/markdown-block",
|
|
176
|
+
files: ["**/*.md/*.{js,cjs,mjs}"],
|
|
163
177
|
...js.configs.recommended
|
|
164
178
|
}, {
|
|
165
|
-
name: "@kazupon/javascript
|
|
179
|
+
name: "@kazupon/javascript/overrides",
|
|
166
180
|
languageOptions: {
|
|
167
181
|
ecmaVersion: 2022,
|
|
168
182
|
globals: {
|
|
@@ -197,7 +211,10 @@ async function jsdoc(options = {}) {
|
|
|
197
211
|
if (error) preset = `${preset}-error`;
|
|
198
212
|
return preset;
|
|
199
213
|
}
|
|
200
|
-
return [
|
|
214
|
+
return [{
|
|
215
|
+
ignores: [GLOB_MARKDOWN],
|
|
216
|
+
...jsdoc$1.configs[`flat/${resolvePreset()}`]
|
|
217
|
+
}, {
|
|
201
218
|
name: "@kazupon/jsdoc",
|
|
202
219
|
rules: { ...overrideRules }
|
|
203
220
|
}];
|
|
@@ -216,16 +233,20 @@ async function jsonc(options = {}) {
|
|
|
216
233
|
const jsonc$1 = await loadPlugin("eslint-plugin-jsonc");
|
|
217
234
|
const configs = [];
|
|
218
235
|
for (const kind of kinds) if (kind) configs.push(...jsonc$1.configs[`flat/recommended-with-${kind}`].map((config, index) => {
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
236
|
+
const mapped = {
|
|
237
|
+
...config,
|
|
238
|
+
ignores: [GLOB_MARKDOWN]
|
|
222
239
|
};
|
|
240
|
+
if (!config.name) mapped.name = `jsonc/flat/recommended-with-${kind}/${index}`;
|
|
241
|
+
return mapped;
|
|
223
242
|
}));
|
|
224
243
|
if (usePrettier) configs.push(...jsonc$1.configs["flat/prettier"].map((config, index) => {
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
244
|
+
const mapped = {
|
|
245
|
+
...config,
|
|
246
|
+
ignores: [GLOB_MARKDOWN]
|
|
228
247
|
};
|
|
248
|
+
if (!config.name) mapped.name = `jsonc/flat/prettier/${index}`;
|
|
249
|
+
return mapped;
|
|
229
250
|
}));
|
|
230
251
|
const overriddenConfig = {
|
|
231
252
|
name: "@kazupon/jsonc",
|
|
@@ -322,19 +343,36 @@ function jsoncSort() {
|
|
|
322
343
|
//#endregion
|
|
323
344
|
//#region src/configs/markdown.ts
|
|
324
345
|
async function markdown(options = {}) {
|
|
325
|
-
const { rules: overrideRules = {} } = options;
|
|
346
|
+
const { rules: overrideRules = {}, files = [GLOB_MARKDOWN], blockExtensions = [] } = options;
|
|
326
347
|
const language = options.language || "gfm";
|
|
327
|
-
const fencedCodeBlocks = typeof options.fencedCodeBlocks === "boolean" ? options.fencedCodeBlocks : true;
|
|
328
348
|
const markdown$1 = await loadPlugin("@eslint/markdown");
|
|
329
|
-
const recommended = markdown$1.configs["recommended"][0];
|
|
349
|
+
const recommended = { ...markdown$1.configs["recommended"][0] };
|
|
350
|
+
const codeblocks = markdown$1.configs.processor[2];
|
|
330
351
|
recommended.language = `markdown/${language}`;
|
|
331
352
|
return [
|
|
332
353
|
recommended,
|
|
333
|
-
|
|
354
|
+
{
|
|
355
|
+
name: "markdown/makedown-in-markdown",
|
|
356
|
+
files,
|
|
357
|
+
ignores: [`${GLOB_MARKDOWN}/**`],
|
|
358
|
+
processor: mergeProcessors([markdown$1.processors.markdown, processorPassThrough])
|
|
359
|
+
},
|
|
360
|
+
{
|
|
361
|
+
name: "makrdown/ignore-lint-blocks-in-typescript",
|
|
362
|
+
files: ["**/*.md/**"],
|
|
363
|
+
languageOptions: { parserOptions: {} }
|
|
364
|
+
},
|
|
334
365
|
{
|
|
335
366
|
name: "@kazupon/markdown",
|
|
336
|
-
files: [GLOB_MARKDOWN],
|
|
337
|
-
|
|
367
|
+
files: [`${GLOB_MARKDOWN}/${GLOB_SRC}`, ...blockExtensions.map((ext) => `${GLOB_MARKDOWN}/**/*.${ext}`)],
|
|
368
|
+
languageOptions: { parserOptions: { ecmaFeatures: { impliedStrict: true } } },
|
|
369
|
+
rules: {
|
|
370
|
+
...codeblocks.rules,
|
|
371
|
+
"import/no-unresolved": "off",
|
|
372
|
+
"unused-imports/no-unused-vars": "off",
|
|
373
|
+
"@typescript-eslint/no-unused-vars": "off",
|
|
374
|
+
...overrideRules
|
|
375
|
+
}
|
|
338
376
|
}
|
|
339
377
|
];
|
|
340
378
|
}
|
|
@@ -345,7 +383,10 @@ const md = markdown;
|
|
|
345
383
|
async function prettier(options = {}) {
|
|
346
384
|
const { rules: overrideRules = {} } = options;
|
|
347
385
|
const prettier$1 = await loadPlugin("eslint-config-prettier");
|
|
348
|
-
return [
|
|
386
|
+
return [{
|
|
387
|
+
name: "config-prettier",
|
|
388
|
+
...prettier$1
|
|
389
|
+
}, {
|
|
349
390
|
name: "@kazupon/prettier",
|
|
350
391
|
rules: { ...overrideRules }
|
|
351
392
|
}];
|
|
@@ -387,14 +428,13 @@ async function react(options = {}) {
|
|
|
387
428
|
settings,
|
|
388
429
|
...react$1.configs.flat.recommended
|
|
389
430
|
}, {
|
|
390
|
-
name: "react-hooks/flat",
|
|
391
431
|
files: getGlobSourceFiles(useTypeScript),
|
|
392
|
-
|
|
432
|
+
...reactHooks.configs["recommended-latest"]
|
|
393
433
|
}];
|
|
394
434
|
if (enableRefresh) configs.push({
|
|
395
435
|
name: "react-refresh/flat",
|
|
396
436
|
files: getGlobSourceFiles(useTypeScript),
|
|
397
|
-
|
|
437
|
+
...reactRefresh?.configs.recommended
|
|
398
438
|
});
|
|
399
439
|
return [...configs, customConfig];
|
|
400
440
|
}
|
|
@@ -406,6 +446,7 @@ async function regexp(options = {}) {
|
|
|
406
446
|
const regexp$1 = await loadPlugin("eslint-plugin-regexp");
|
|
407
447
|
return [{
|
|
408
448
|
name: "regexp/flat/recommended",
|
|
449
|
+
ignores: [GLOB_MARKDOWN],
|
|
409
450
|
...regexp$1.configs["flat/recommended"]
|
|
410
451
|
}, {
|
|
411
452
|
name: "@kazupon/eslint-regexp",
|
|
@@ -435,7 +476,10 @@ async function svelte(options = {}) {
|
|
|
435
476
|
...parserOptions
|
|
436
477
|
}
|
|
437
478
|
};
|
|
438
|
-
return [...svelte$1.configs["flat/recommended"]
|
|
479
|
+
return [...svelte$1.configs["flat/recommended"].map((config) => ({
|
|
480
|
+
...config,
|
|
481
|
+
ignores: [GLOB_MARKDOWN]
|
|
482
|
+
})), customConfig];
|
|
439
483
|
}
|
|
440
484
|
|
|
441
485
|
//#endregion
|
|
@@ -445,10 +489,12 @@ async function toml(options = {}) {
|
|
|
445
489
|
const toml$1 = await loadPlugin("eslint-plugin-toml");
|
|
446
490
|
const configs = [];
|
|
447
491
|
configs.push(...toml$1.configs["flat/standard"].map((config, index) => {
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
492
|
+
const mapped = {
|
|
493
|
+
...config,
|
|
494
|
+
ignores: [GLOB_MARKDOWN]
|
|
451
495
|
};
|
|
496
|
+
if (!config.name) mapped.name = `toml/flat/standard/${index}`;
|
|
497
|
+
return mapped;
|
|
452
498
|
}));
|
|
453
499
|
const overriddenConfig = {
|
|
454
500
|
name: "@kazupon/toml",
|
|
@@ -467,11 +513,16 @@ async function typescript(options = {}) {
|
|
|
467
513
|
const baseFiles = [
|
|
468
514
|
GLOB_TS,
|
|
469
515
|
GLOB_TSX,
|
|
470
|
-
...extraFileExtensions.map((ext) =>
|
|
516
|
+
...extraFileExtensions.map((ext) => `**/*.${ext}`)
|
|
471
517
|
];
|
|
472
518
|
const files = [...options.files ?? [], ...baseFiles];
|
|
519
|
+
const extendedPreset = ts.configs.recommendedTypeChecked.map((config) => {
|
|
520
|
+
const mapped = { ...config };
|
|
521
|
+
if (config.files) mapped.files = [...config.files, `${GLOB_MARKDOWN}/**/${GLOB_TS}`];
|
|
522
|
+
return mapped;
|
|
523
|
+
});
|
|
473
524
|
return [
|
|
474
|
-
...
|
|
525
|
+
...extendedPreset,
|
|
475
526
|
{
|
|
476
527
|
files: [
|
|
477
528
|
GLOB_JS,
|
|
@@ -480,17 +531,23 @@ async function typescript(options = {}) {
|
|
|
480
531
|
GLOB_JSON5,
|
|
481
532
|
GLOB_JSONC,
|
|
482
533
|
GLOB_YAML,
|
|
483
|
-
GLOB_TOML
|
|
534
|
+
GLOB_TOML,
|
|
535
|
+
GLOB_MARKDOWN,
|
|
536
|
+
`${GLOB_MARKDOWN}/**`
|
|
484
537
|
],
|
|
485
538
|
...ts.configs.disableTypeChecked
|
|
486
539
|
},
|
|
540
|
+
{
|
|
541
|
+
name: "@kazupon/typescipt/typescript-eslint/overrides-for-disable-type-checked",
|
|
542
|
+
rules: { ...ts.configs.disableTypeChecked.rules }
|
|
543
|
+
},
|
|
487
544
|
{
|
|
488
545
|
name: "@kazupon/typescipt/typescript-eslint",
|
|
489
546
|
files,
|
|
490
547
|
languageOptions: {
|
|
491
548
|
parser: ts.parser,
|
|
492
549
|
parserOptions: {
|
|
493
|
-
extraFileExtensions: extraFileExtensions.map((ext) =>
|
|
550
|
+
extraFileExtensions: extraFileExtensions.map((ext) => `.${ext}`),
|
|
494
551
|
sourceType: "module",
|
|
495
552
|
...parserOptions
|
|
496
553
|
}
|
|
@@ -538,7 +595,7 @@ async function vitest(options = {}) {
|
|
|
538
595
|
files: GLOB_TESTS,
|
|
539
596
|
...vitest$1.configs["recommended"]
|
|
540
597
|
};
|
|
541
|
-
if (base.name ==
|
|
598
|
+
if (base.name == void 0) base.name = "@vitest/eslint-plugin";
|
|
542
599
|
if (typeTesting) {
|
|
543
600
|
base.files = [...base.files, ...GLOB_TESTS_TYPE];
|
|
544
601
|
base.settings = { vitest: { typecheck: true } };
|
|
@@ -561,7 +618,10 @@ async function vue(options = {}) {
|
|
|
561
618
|
const vue$1 = await loadPlugin("eslint-plugin-vue");
|
|
562
619
|
const vueParser = vue$1.configs["flat/base"][1]["languageOptions"]?.parser;
|
|
563
620
|
const configs = [];
|
|
564
|
-
configs.push(...vue$1.configs["flat/recommended"])
|
|
621
|
+
configs.push(...vue$1.configs["flat/recommended"].map((config) => ({
|
|
622
|
+
...config,
|
|
623
|
+
ignores: [GLOB_MARKDOWN]
|
|
624
|
+
})));
|
|
565
625
|
if (options.composable) {
|
|
566
626
|
const composable = await loadPlugin("eslint-plugin-vue-composable");
|
|
567
627
|
const composableBase = { ...composable.configs["flat/recommended"][0] };
|
|
@@ -573,10 +633,12 @@ async function vue(options = {}) {
|
|
|
573
633
|
const scopedCssMapped = scopedCss.configs["flat/recommended"].map(
|
|
574
634
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
575
635
|
(config, index) => {
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
636
|
+
const mapped = {
|
|
637
|
+
...config,
|
|
638
|
+
ignores: [GLOB_MARKDOWN]
|
|
579
639
|
};
|
|
640
|
+
if (!config.name) mapped.name = `vue/scoped-css/recommended/${index}`;
|
|
641
|
+
return mapped;
|
|
580
642
|
}
|
|
581
643
|
);
|
|
582
644
|
configs.push(scopedCssMapped[0], scopedCssMapped[2]);
|
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.25.0",
|
|
5
5
|
"author": {
|
|
6
6
|
"email": "kawakazu80@gmail.com",
|
|
7
7
|
"name": "kazuya kawaguchi"
|
|
@@ -50,9 +50,10 @@
|
|
|
50
50
|
},
|
|
51
51
|
"dependencies": {
|
|
52
52
|
"@eslint-community/eslint-plugin-eslint-comments": "^4.4.1",
|
|
53
|
-
"@eslint/js": "^9.
|
|
53
|
+
"@eslint/js": "^9.22.0",
|
|
54
54
|
"@kazupon/jts-utils": "^0.6.0",
|
|
55
55
|
"eslint-flat-config-utils": "^2.0.1",
|
|
56
|
+
"eslint-merge-processors": "^2.0.0",
|
|
56
57
|
"globals": "^16.0.0"
|
|
57
58
|
},
|
|
58
59
|
"peerDependencies": {
|
|
@@ -65,10 +66,11 @@
|
|
|
65
66
|
"eslint-plugin-import": ">=2.31.0",
|
|
66
67
|
"eslint-plugin-jsdoc": ">=48.5.0",
|
|
67
68
|
"eslint-plugin-jsonc": ">=2.16.0",
|
|
69
|
+
"eslint-plugin-module-interop": ">=0.3.0",
|
|
68
70
|
"eslint-plugin-promise": ">=6.4.0",
|
|
69
71
|
"eslint-plugin-react": ">=7.35.0",
|
|
70
|
-
"eslint-plugin-react-hooks": ">=
|
|
71
|
-
"eslint-plugin-react-refresh": ">=0.4.
|
|
72
|
+
"eslint-plugin-react-hooks": ">=5.2.0",
|
|
73
|
+
"eslint-plugin-react-refresh": ">=0.4.19",
|
|
72
74
|
"eslint-plugin-regexp": ">=2.6.0",
|
|
73
75
|
"eslint-plugin-svelte": ">=2.43.0",
|
|
74
76
|
"eslint-plugin-toml": ">=0.11.0",
|
|
@@ -107,6 +109,9 @@
|
|
|
107
109
|
"eslint-plugin-jsonc": {
|
|
108
110
|
"optional": true
|
|
109
111
|
},
|
|
112
|
+
"eslint-plugin-module-interop": {
|
|
113
|
+
"optional": true
|
|
114
|
+
},
|
|
110
115
|
"eslint-plugin-promise": {
|
|
111
116
|
"optional": true
|
|
112
117
|
},
|
|
@@ -158,43 +163,44 @@
|
|
|
158
163
|
},
|
|
159
164
|
"devDependencies": {
|
|
160
165
|
"@eslint/css": "^0.5.0",
|
|
161
|
-
"@eslint/markdown": "^6.
|
|
166
|
+
"@eslint/markdown": "^6.3.0",
|
|
162
167
|
"@kazupon/prettier-config": "^0.1.1",
|
|
163
168
|
"@types/eslint": "^9.6.1",
|
|
164
|
-
"@types/node": "^22.13.
|
|
165
|
-
"@vitest/eslint-plugin": "^1.1.
|
|
166
|
-
"bumpp": "^10.0
|
|
167
|
-
"eslint": "^9.
|
|
168
|
-
"eslint-config-prettier": "^10.
|
|
169
|
-
"eslint-import-resolver-typescript": "^3.
|
|
169
|
+
"@types/node": "^22.13.11",
|
|
170
|
+
"@vitest/eslint-plugin": "^1.1.38",
|
|
171
|
+
"bumpp": "^10.1.0",
|
|
172
|
+
"eslint": "^9.22.0",
|
|
173
|
+
"eslint-config-prettier": "^10.1.1",
|
|
174
|
+
"eslint-import-resolver-typescript": "^3.9.1",
|
|
170
175
|
"eslint-plugin-import": "^2.31.0",
|
|
171
|
-
"eslint-plugin-jsdoc": "^50.6.
|
|
176
|
+
"eslint-plugin-jsdoc": "^50.6.8",
|
|
172
177
|
"eslint-plugin-jsonc": "^2.19.1",
|
|
178
|
+
"eslint-plugin-module-interop": "^0.3.0",
|
|
173
179
|
"eslint-plugin-promise": "^7.2.1",
|
|
174
180
|
"eslint-plugin-react": "^7.37.4",
|
|
175
|
-
"eslint-plugin-react-hooks": "^5.
|
|
181
|
+
"eslint-plugin-react-hooks": "^5.2.0",
|
|
176
182
|
"eslint-plugin-react-refresh": "^0.4.19",
|
|
177
183
|
"eslint-plugin-regexp": "^2.7.0",
|
|
178
184
|
"eslint-plugin-svelte": "^2.46.1",
|
|
179
185
|
"eslint-plugin-toml": "^0.12.0",
|
|
180
186
|
"eslint-plugin-unicorn": "^57.0.0",
|
|
181
187
|
"eslint-plugin-unused-imports": "^4.1.4",
|
|
182
|
-
"eslint-plugin-vue": "^9.
|
|
188
|
+
"eslint-plugin-vue": "^9.33.0",
|
|
183
189
|
"eslint-plugin-vue-composable": "^1.0.0",
|
|
184
190
|
"eslint-plugin-vue-scoped-css": "^2.9.0",
|
|
185
191
|
"eslint-plugin-vuejs-accessibility": "^2.4.1",
|
|
186
192
|
"eslint-plugin-yml": "^1.17.0",
|
|
187
|
-
"eslint-typegen": "^2.
|
|
193
|
+
"eslint-typegen": "^2.1.0",
|
|
188
194
|
"gh-changelogen": "^0.2.8",
|
|
189
195
|
"jiti": "^2.4.2",
|
|
190
|
-
"knip": "^5.
|
|
191
|
-
"lint-staged": "^15.
|
|
192
|
-
"prettier": "^3.5.
|
|
196
|
+
"knip": "^5.46.0",
|
|
197
|
+
"lint-staged": "^15.5.0",
|
|
198
|
+
"prettier": "^3.5.3",
|
|
193
199
|
"svelte": "^4.2.19",
|
|
194
|
-
"tsdown": "^0.6.
|
|
195
|
-
"typescript": "^5.
|
|
196
|
-
"typescript-eslint": "^8.
|
|
197
|
-
"vitest": "^3.0.
|
|
200
|
+
"tsdown": "^0.6.9",
|
|
201
|
+
"typescript": "^5.8.2",
|
|
202
|
+
"typescript-eslint": "^8.27.0",
|
|
203
|
+
"vitest": "^3.0.9"
|
|
198
204
|
},
|
|
199
205
|
"prettier": "@kazupon/prettier-config",
|
|
200
206
|
"lint-staged": {
|