@kazupon/eslint-config 0.16.0 → 0.17.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 +1 -1
- package/dist/configs/comments.d.cts +1 -1
- package/dist/configs/comments.d.ts +1 -1
- package/dist/configs/imports.d.cts +9 -4
- package/dist/configs/imports.d.ts +9 -4
- package/dist/configs/index.d.cts +16 -16
- package/dist/configs/index.d.ts +16 -16
- package/dist/configs/javascript.d.cts +1 -1
- package/dist/configs/javascript.d.ts +1 -1
- package/dist/configs/jsdoc.d.cts +1 -1
- package/dist/configs/jsdoc.d.ts +1 -1
- package/dist/configs/jsonc.d.cts +1 -1
- package/dist/configs/jsonc.d.ts +1 -1
- package/dist/configs/prettier.d.cts +1 -1
- package/dist/configs/prettier.d.ts +1 -1
- package/dist/configs/promise.d.cts +1 -1
- package/dist/configs/promise.d.ts +1 -1
- package/dist/configs/react.d.cts +2 -2
- package/dist/configs/react.d.ts +2 -2
- package/dist/configs/regexp.d.cts +1 -1
- package/dist/configs/regexp.d.ts +1 -1
- package/dist/configs/svelte.d.cts +2 -2
- package/dist/configs/svelte.d.ts +2 -2
- package/dist/configs/toml.d.cts +1 -1
- package/dist/configs/toml.d.ts +1 -1
- package/dist/configs/typescript.d.cts +1 -1
- package/dist/configs/typescript.d.ts +1 -1
- package/dist/configs/unicorn.d.cts +1 -1
- package/dist/configs/unicorn.d.ts +1 -1
- package/dist/configs/vitest.d.cts +1 -1
- package/dist/configs/vitest.d.ts +1 -1
- package/dist/configs/vue.d.cts +2 -2
- package/dist/configs/vue.d.ts +2 -2
- package/dist/configs/yml.d.cts +1 -1
- package/dist/configs/yml.d.ts +1 -1
- package/dist/index.cjs +253 -242
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +253 -242
- package/dist/types/gens/imports.d.cts +477 -0
- package/dist/types/gens/imports.d.ts +477 -0
- package/dist/types/index.d.cts +18 -18
- package/dist/types/index.d.ts +18 -18
- package/dist/types/overrides.d.cts +1 -1
- package/dist/types/overrides.d.ts +1 -1
- package/package.json +12 -2
package/dist/index.cjs
CHANGED
|
@@ -31,6 +31,13 @@ function defineConfig(...configs) {
|
|
|
31
31
|
return new FlatConfigComposer().append(...baseConfigs, ...configs);
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
+
//#endregion
|
|
35
|
+
//#region node_modules/.pnpm/@kazupon+jts-utils@0.2.0/node_modules/@kazupon/jts-utils/dist/module/index.mjs
|
|
36
|
+
async function interopDefault(mod) {
|
|
37
|
+
const resolved = await mod;
|
|
38
|
+
return resolved.default || resolved;
|
|
39
|
+
}
|
|
40
|
+
|
|
34
41
|
//#endregion
|
|
35
42
|
//#region src/globs.ts
|
|
36
43
|
const GLOB_JS = "**/*.?([cm])js";
|
|
@@ -48,13 +55,6 @@ const GLOB_SRC_EXT = "?([cm])[jt]s?(x)";
|
|
|
48
55
|
const GLOB_TESTS = [`**/test/**/*.${GLOB_SRC_EXT}`, `**/tests/**/*.${GLOB_SRC_EXT}`, `**/spec/**/*.${GLOB_SRC_EXT}`, `**/specs/**/*.${GLOB_SRC_EXT}`, `**/e2e/**/*.${GLOB_SRC_EXT}`, `**/__tests__/**/*.${GLOB_SRC_EXT}`, `**/__test__/**/*.${GLOB_SRC_EXT}`, `**/*.spec.${GLOB_SRC_EXT}`, `**/*.test.${GLOB_SRC_EXT}`];
|
|
49
56
|
const GLOB_TESTS_TYPE = [`**/*.test-d.${GLOB_SRC_EXT}`, `**/*.spec-d.${GLOB_SRC_EXT}`];
|
|
50
57
|
|
|
51
|
-
//#endregion
|
|
52
|
-
//#region node_modules/.pnpm/@kazupon+jts-utils@0.2.0/node_modules/@kazupon/jts-utils/dist/module/index.mjs
|
|
53
|
-
async function interopDefault(mod) {
|
|
54
|
-
const resolved = await mod;
|
|
55
|
-
return resolved.default || resolved;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
58
|
//#endregion
|
|
59
59
|
//#region src/utils.ts
|
|
60
60
|
async function loadPlugin(name) {
|
|
@@ -72,38 +72,6 @@ function getGlobSourceFiles(useTypeScript = false) {
|
|
|
72
72
|
return [GLOB_JS, GLOB_JSX, ...useTypeScript ? [GLOB_TS, GLOB_TSX] : []];
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
-
//#endregion
|
|
76
|
-
//#region src/configs/javascript.ts
|
|
77
|
-
async function javascript(options = {}) {
|
|
78
|
-
const { rules: overrideRules = {} } = options;
|
|
79
|
-
const js = await loadPlugin("@eslint/js");
|
|
80
|
-
return [{
|
|
81
|
-
name: "eslint/defaults/rules",
|
|
82
|
-
...js.configs.recommended
|
|
83
|
-
}, {
|
|
84
|
-
name: "@kazupon/javascript/@eslint/js",
|
|
85
|
-
languageOptions: {
|
|
86
|
-
ecmaVersion: 2022,
|
|
87
|
-
globals: {
|
|
88
|
-
...globals.browser,
|
|
89
|
-
...globals.node,
|
|
90
|
-
...globals.es2022,
|
|
91
|
-
document: "readonly",
|
|
92
|
-
navigator: "readonly",
|
|
93
|
-
window: "readonly"
|
|
94
|
-
},
|
|
95
|
-
parserOptions: {
|
|
96
|
-
ecmaFeatures: { jsx: true },
|
|
97
|
-
ecmaVersion: 2022,
|
|
98
|
-
sourceType: "module"
|
|
99
|
-
},
|
|
100
|
-
sourceType: "module"
|
|
101
|
-
},
|
|
102
|
-
linterOptions: { reportUnusedDisableDirectives: true },
|
|
103
|
-
rules: { ...overrideRules }
|
|
104
|
-
}];
|
|
105
|
-
}
|
|
106
|
-
|
|
107
75
|
//#endregion
|
|
108
76
|
//#region src/configs/comments.ts
|
|
109
77
|
async function comments(options = {}) {
|
|
@@ -119,71 +87,24 @@ async function comments(options = {}) {
|
|
|
119
87
|
}];
|
|
120
88
|
}
|
|
121
89
|
|
|
122
|
-
//#endregion
|
|
123
|
-
//#region src/configs/typescript.ts
|
|
124
|
-
async function typescript(options = {}) {
|
|
125
|
-
const { rules: overrideRules = {}, extraFileExtensions = [], parserOptions = { project: true } } = options;
|
|
126
|
-
const ts = await loadPlugin("typescript-eslint");
|
|
127
|
-
const files = options.files ?? [GLOB_TS, GLOB_TSX, ...extraFileExtensions.map((ext) => `**/*${ext}`)];
|
|
128
|
-
return [...ts.configs.recommendedTypeChecked, {
|
|
129
|
-
files: [GLOB_JS, GLOB_JSX, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_YAML, GLOB_TOML],
|
|
130
|
-
...ts.configs.disableTypeChecked
|
|
131
|
-
}, {
|
|
132
|
-
name: "@kazupon/typescipt/typescript-eslint",
|
|
133
|
-
files,
|
|
134
|
-
languageOptions: {
|
|
135
|
-
parser: ts.parser,
|
|
136
|
-
parserOptions: {
|
|
137
|
-
extraFileExtensions: extraFileExtensions.map((ext) => `${ext}`),
|
|
138
|
-
sourceType: "module",
|
|
139
|
-
...parserOptions
|
|
140
|
-
}
|
|
141
|
-
},
|
|
142
|
-
rules: {
|
|
143
|
-
"@typescript-eslint/no-unused-vars": ["error", {
|
|
144
|
-
args: "all",
|
|
145
|
-
argsIgnorePattern: "^_",
|
|
146
|
-
caughtErrors: "all",
|
|
147
|
-
caughtErrorsIgnorePattern: "^_",
|
|
148
|
-
destructuredArrayIgnorePattern: "^_",
|
|
149
|
-
varsIgnorePattern: "^_",
|
|
150
|
-
ignoreRestSiblings: true
|
|
151
|
-
}],
|
|
152
|
-
...overrideRules
|
|
153
|
-
}
|
|
154
|
-
}];
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
//#endregion
|
|
158
|
-
//#region src/configs/jsdoc.ts
|
|
159
|
-
async function jsdoc(options = {}) {
|
|
160
|
-
const { rules: overrideRules = {}, typescript: typescript$1, error = false } = options;
|
|
161
|
-
const jsdoc$1 = await loadPlugin("eslint-plugin-jsdoc");
|
|
162
|
-
function resolvePreset() {
|
|
163
|
-
let preset = "recommended";
|
|
164
|
-
if (typescript$1 === "syntax") {
|
|
165
|
-
preset = `${preset}-typescript`;
|
|
166
|
-
} else if (typescript$1 === "flavor") {
|
|
167
|
-
preset = `${preset}-typescript-flavor`;
|
|
168
|
-
}
|
|
169
|
-
if (error) {
|
|
170
|
-
preset = `${preset}-error`;
|
|
171
|
-
}
|
|
172
|
-
return preset;
|
|
173
|
-
}
|
|
174
|
-
return [jsdoc$1.configs[`flat/${resolvePreset()}`], {
|
|
175
|
-
name: "@kazupon/jsdoc",
|
|
176
|
-
rules: { ...overrideRules }
|
|
177
|
-
}];
|
|
178
|
-
}
|
|
179
|
-
|
|
180
90
|
//#endregion
|
|
181
91
|
//#region src/configs/imports.ts
|
|
182
92
|
const IMPORTS_FILES = [GLOB_JS, GLOB_JSX, GLOB_TS, GLOB_TSX];
|
|
183
93
|
async function imports(options = {}) {
|
|
184
94
|
const { rules: overrideRules = {} } = options;
|
|
185
95
|
const unused = await loadPlugin("eslint-plugin-unused-imports");
|
|
186
|
-
const
|
|
96
|
+
const importX = await loadPlugin("eslint-plugin-import-x");
|
|
97
|
+
const configs = [importX.flatConfigs.recommended];
|
|
98
|
+
if (options.typescript) {
|
|
99
|
+
try {
|
|
100
|
+
await loadPlugin("eslint-import-resolver-typescript");
|
|
101
|
+
importX.flatConfigs.typescript.settings["import-x/resolver"]["typescript"] = true;
|
|
102
|
+
configs.push(importX.flatConfigs.typescript);
|
|
103
|
+
} catch (error) {
|
|
104
|
+
throw new Error(`Not found eslint-import-resolver-typescript: ${error.message}`);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
configs.push({
|
|
187
108
|
name: "unused-imports",
|
|
188
109
|
plugins: { "unused-imports": unused },
|
|
189
110
|
files: IMPORTS_FILES,
|
|
@@ -202,7 +123,7 @@ async function imports(options = {}) {
|
|
|
202
123
|
ignoreRestSiblings: true
|
|
203
124
|
}]
|
|
204
125
|
}
|
|
205
|
-
}
|
|
126
|
+
});
|
|
206
127
|
const overriddenConfig = {
|
|
207
128
|
name: "@kazupon/imports",
|
|
208
129
|
files: IMPORTS_FILES,
|
|
@@ -213,77 +134,56 @@ async function imports(options = {}) {
|
|
|
213
134
|
}
|
|
214
135
|
|
|
215
136
|
//#endregion
|
|
216
|
-
//#region src/configs/
|
|
217
|
-
async function
|
|
218
|
-
const { rules: overrideRules = {} } = options;
|
|
219
|
-
const promise$1 = await loadPlugin("eslint-plugin-promise");
|
|
220
|
-
return [{
|
|
221
|
-
name: "promise/flat/recommended",
|
|
222
|
-
...promise$1.configs["flat/recommended"]
|
|
223
|
-
}, {
|
|
224
|
-
name: "@kazupon/promise",
|
|
225
|
-
rules: { ...overrideRules }
|
|
226
|
-
}];
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
//#endregion
|
|
230
|
-
//#region src/configs/regexp.ts
|
|
231
|
-
async function regexp(options = {}) {
|
|
232
|
-
const { rules: overrideRules = {} } = options;
|
|
233
|
-
const regexp$1 = await loadPlugin("eslint-plugin-regexp");
|
|
234
|
-
return [{
|
|
235
|
-
name: "regexp/flat/recommended",
|
|
236
|
-
...regexp$1.configs["flat/recommended"]
|
|
237
|
-
}, {
|
|
238
|
-
name: "@kazupon/eslint-regexp",
|
|
239
|
-
rules: { ...overrideRules }
|
|
240
|
-
}];
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
//#endregion
|
|
244
|
-
//#region src/configs/toml.ts
|
|
245
|
-
async function toml(options = {}) {
|
|
246
|
-
const { rules: overrideRules = {} } = options;
|
|
247
|
-
const toml$1 = await loadPlugin("eslint-plugin-toml");
|
|
248
|
-
const configs = [];
|
|
249
|
-
configs.push(...toml$1.configs["flat/standard"].map((config, index) => {
|
|
250
|
-
return config.name ? config : {
|
|
251
|
-
name: `toml/flat/standard/${index}`,
|
|
252
|
-
...config
|
|
253
|
-
};
|
|
254
|
-
}));
|
|
255
|
-
const overriddenConfig = {
|
|
256
|
-
name: "@kazupon/toml",
|
|
257
|
-
files: [GLOB_TOML],
|
|
258
|
-
rules: { ...overrideRules }
|
|
259
|
-
};
|
|
260
|
-
configs.push(overriddenConfig);
|
|
261
|
-
return configs;
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
//#endregion
|
|
265
|
-
//#region src/configs/unicorn.ts
|
|
266
|
-
async function unicorn(options = {}) {
|
|
137
|
+
//#region src/configs/javascript.ts
|
|
138
|
+
async function javascript(options = {}) {
|
|
267
139
|
const { rules: overrideRules = {} } = options;
|
|
268
|
-
const
|
|
269
|
-
const unicorn$1 = await loadPlugin("eslint-plugin-unicorn");
|
|
140
|
+
const js = await loadPlugin("@eslint/js");
|
|
270
141
|
return [{
|
|
271
|
-
|
|
272
|
-
...
|
|
142
|
+
name: "eslint/defaults/rules",
|
|
143
|
+
...js.configs.recommended
|
|
273
144
|
}, {
|
|
274
|
-
name: "@kazupon/
|
|
275
|
-
|
|
145
|
+
name: "@kazupon/javascript/@eslint/js",
|
|
146
|
+
languageOptions: {
|
|
147
|
+
ecmaVersion: 2022,
|
|
148
|
+
globals: {
|
|
149
|
+
...globals.browser,
|
|
150
|
+
...globals.node,
|
|
151
|
+
...globals.es2022,
|
|
152
|
+
document: "readonly",
|
|
153
|
+
navigator: "readonly",
|
|
154
|
+
window: "readonly"
|
|
155
|
+
},
|
|
156
|
+
parserOptions: {
|
|
157
|
+
ecmaFeatures: { jsx: true },
|
|
158
|
+
ecmaVersion: 2022,
|
|
159
|
+
sourceType: "module"
|
|
160
|
+
},
|
|
161
|
+
sourceType: "module"
|
|
162
|
+
},
|
|
163
|
+
linterOptions: { reportUnusedDisableDirectives: true },
|
|
276
164
|
rules: { ...overrideRules }
|
|
277
165
|
}];
|
|
278
166
|
}
|
|
279
167
|
|
|
280
168
|
//#endregion
|
|
281
|
-
//#region src/configs/
|
|
282
|
-
async function
|
|
283
|
-
const { rules: overrideRules = {} } = options;
|
|
284
|
-
const
|
|
285
|
-
|
|
286
|
-
|
|
169
|
+
//#region src/configs/jsdoc.ts
|
|
170
|
+
async function jsdoc(options = {}) {
|
|
171
|
+
const { rules: overrideRules = {}, typescript: typescript$1, error = false } = options;
|
|
172
|
+
const jsdoc$1 = await loadPlugin("eslint-plugin-jsdoc");
|
|
173
|
+
function resolvePreset() {
|
|
174
|
+
let preset = "recommended";
|
|
175
|
+
if (typescript$1 === "syntax") {
|
|
176
|
+
preset = `${preset}-typescript`;
|
|
177
|
+
} else if (typescript$1 === "flavor") {
|
|
178
|
+
preset = `${preset}-typescript-flavor`;
|
|
179
|
+
}
|
|
180
|
+
if (error) {
|
|
181
|
+
preset = `${preset}-error`;
|
|
182
|
+
}
|
|
183
|
+
return preset;
|
|
184
|
+
}
|
|
185
|
+
return [jsdoc$1.configs[`flat/${resolvePreset()}`], {
|
|
186
|
+
name: "@kazupon/jsdoc",
|
|
287
187
|
rules: { ...overrideRules }
|
|
288
188
|
}];
|
|
289
189
|
}
|
|
@@ -349,92 +249,28 @@ function jsoncSort() {
|
|
|
349
249
|
}
|
|
350
250
|
|
|
351
251
|
//#endregion
|
|
352
|
-
//#region src/configs/
|
|
353
|
-
async function
|
|
252
|
+
//#region src/configs/prettier.ts
|
|
253
|
+
async function prettier(options = {}) {
|
|
354
254
|
const { rules: overrideRules = {} } = options;
|
|
355
|
-
const
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
configs.push(...yml$1.configs["flat/standard"].map((config, index) => {
|
|
359
|
-
return config.name ? config : {
|
|
360
|
-
name: `yml/flat/standard/${index}`,
|
|
361
|
-
...config
|
|
362
|
-
};
|
|
363
|
-
}));
|
|
364
|
-
if (usePrettier) {
|
|
365
|
-
configs.push(...yml$1.configs["flat/prettier"].map((config, index) => {
|
|
366
|
-
return config.name ? config : {
|
|
367
|
-
name: `yml/flat/prettier/${index}`,
|
|
368
|
-
...config
|
|
369
|
-
};
|
|
370
|
-
}));
|
|
371
|
-
}
|
|
372
|
-
const overriddenConfig = {
|
|
373
|
-
name: "@kazupon/yml",
|
|
374
|
-
files: [GLOB_YAML],
|
|
255
|
+
const prettier$1 = await loadPlugin("eslint-config-prettier");
|
|
256
|
+
return [prettier$1, {
|
|
257
|
+
name: "@kazupon/prettier",
|
|
375
258
|
rules: { ...overrideRules }
|
|
376
|
-
};
|
|
377
|
-
configs.push(overriddenConfig);
|
|
378
|
-
return configs;
|
|
259
|
+
}];
|
|
379
260
|
}
|
|
380
|
-
const yaml = yml;
|
|
381
261
|
|
|
382
262
|
//#endregion
|
|
383
|
-
//#region src/configs/
|
|
384
|
-
async function
|
|
385
|
-
const { rules: overrideRules = {}
|
|
386
|
-
const
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
const composableBase = { ...composable.configs["flat/recommended"][0] };
|
|
393
|
-
delete composableBase.languageOptions;
|
|
394
|
-
configs.push(composableBase, composable.configs["flat/recommended"][1]);
|
|
395
|
-
}
|
|
396
|
-
if (options.scopedCss) {
|
|
397
|
-
const scopedCss = await loadPlugin("eslint-plugin-vue-scoped-css");
|
|
398
|
-
const scopedCssMapped = scopedCss.configs["flat/recommended"].map((config, index) => {
|
|
399
|
-
return config.name ? config : {
|
|
400
|
-
name: `vue/scoped-css/recommended/${index}`,
|
|
401
|
-
...config
|
|
402
|
-
};
|
|
403
|
-
});
|
|
404
|
-
configs.push(scopedCssMapped[0], scopedCssMapped[2]);
|
|
405
|
-
}
|
|
406
|
-
if (options.a11y) {
|
|
407
|
-
const a11y = await loadPlugin("eslint-plugin-vuejs-accessibility");
|
|
408
|
-
const a11yBase = { ...a11y.configs["flat/recommended"][0] };
|
|
409
|
-
delete a11yBase.languageOptions;
|
|
410
|
-
configs.push(a11yBase);
|
|
411
|
-
const a11yRules = {
|
|
412
|
-
...a11y.configs["flat/recommended"][1],
|
|
413
|
-
name: "vuejs-accessibility:rules"
|
|
414
|
-
};
|
|
415
|
-
delete a11yRules.languageOptions;
|
|
416
|
-
delete a11yRules.plugins;
|
|
417
|
-
configs.push(a11yRules);
|
|
418
|
-
}
|
|
419
|
-
const customConfig = {
|
|
420
|
-
name: "@kazupon/vue",
|
|
421
|
-
files: [GLOB_VUE],
|
|
263
|
+
//#region src/configs/promise.ts
|
|
264
|
+
async function promise(options = {}) {
|
|
265
|
+
const { rules: overrideRules = {} } = options;
|
|
266
|
+
const promise$1 = await loadPlugin("eslint-plugin-promise");
|
|
267
|
+
return [{
|
|
268
|
+
name: "promise/flat/recommended",
|
|
269
|
+
...promise$1.configs["flat/recommended"]
|
|
270
|
+
}, {
|
|
271
|
+
name: "@kazupon/promise",
|
|
422
272
|
rules: { ...overrideRules }
|
|
423
|
-
};
|
|
424
|
-
if (options.typescript) {
|
|
425
|
-
customConfig.languageOptions = {
|
|
426
|
-
parser: vueParser,
|
|
427
|
-
parserOptions: {
|
|
428
|
-
sourceType: "module",
|
|
429
|
-
parser: await getTypeScriptParser(),
|
|
430
|
-
ecmaFeatures: { jsx: true },
|
|
431
|
-
extraFileExtensions: [".vue"],
|
|
432
|
-
...parserOptions
|
|
433
|
-
}
|
|
434
|
-
};
|
|
435
|
-
}
|
|
436
|
-
configs.push(customConfig);
|
|
437
|
-
return configs;
|
|
273
|
+
}];
|
|
438
274
|
}
|
|
439
275
|
|
|
440
276
|
//#endregion
|
|
@@ -469,6 +305,20 @@ async function react(options = {}) {
|
|
|
469
305
|
return [...configs, customConfig];
|
|
470
306
|
}
|
|
471
307
|
|
|
308
|
+
//#endregion
|
|
309
|
+
//#region src/configs/regexp.ts
|
|
310
|
+
async function regexp(options = {}) {
|
|
311
|
+
const { rules: overrideRules = {} } = options;
|
|
312
|
+
const regexp$1 = await loadPlugin("eslint-plugin-regexp");
|
|
313
|
+
return [{
|
|
314
|
+
name: "regexp/flat/recommended",
|
|
315
|
+
...regexp$1.configs["flat/recommended"]
|
|
316
|
+
}, {
|
|
317
|
+
name: "@kazupon/eslint-regexp",
|
|
318
|
+
rules: { ...overrideRules }
|
|
319
|
+
}];
|
|
320
|
+
}
|
|
321
|
+
|
|
472
322
|
//#endregion
|
|
473
323
|
//#region src/configs/svelte.ts
|
|
474
324
|
async function svelte(options = {}) {
|
|
@@ -496,6 +346,78 @@ async function svelte(options = {}) {
|
|
|
496
346
|
return [...svelte$1.configs["flat/recommended"], customConfig];
|
|
497
347
|
}
|
|
498
348
|
|
|
349
|
+
//#endregion
|
|
350
|
+
//#region src/configs/toml.ts
|
|
351
|
+
async function toml(options = {}) {
|
|
352
|
+
const { rules: overrideRules = {} } = options;
|
|
353
|
+
const toml$1 = await loadPlugin("eslint-plugin-toml");
|
|
354
|
+
const configs = [];
|
|
355
|
+
configs.push(...toml$1.configs["flat/standard"].map((config, index) => {
|
|
356
|
+
return config.name ? config : {
|
|
357
|
+
name: `toml/flat/standard/${index}`,
|
|
358
|
+
...config
|
|
359
|
+
};
|
|
360
|
+
}));
|
|
361
|
+
const overriddenConfig = {
|
|
362
|
+
name: "@kazupon/toml",
|
|
363
|
+
files: [GLOB_TOML],
|
|
364
|
+
rules: { ...overrideRules }
|
|
365
|
+
};
|
|
366
|
+
configs.push(overriddenConfig);
|
|
367
|
+
return configs;
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
//#endregion
|
|
371
|
+
//#region src/configs/typescript.ts
|
|
372
|
+
async function typescript(options = {}) {
|
|
373
|
+
const { rules: overrideRules = {}, extraFileExtensions = [], parserOptions = { project: true } } = options;
|
|
374
|
+
const ts = await loadPlugin("typescript-eslint");
|
|
375
|
+
const files = options.files ?? [GLOB_TS, GLOB_TSX, ...extraFileExtensions.map((ext) => `**/*${ext}`)];
|
|
376
|
+
return [...ts.configs.recommendedTypeChecked, {
|
|
377
|
+
files: [GLOB_JS, GLOB_JSX, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_YAML, GLOB_TOML],
|
|
378
|
+
...ts.configs.disableTypeChecked
|
|
379
|
+
}, {
|
|
380
|
+
name: "@kazupon/typescipt/typescript-eslint",
|
|
381
|
+
files,
|
|
382
|
+
languageOptions: {
|
|
383
|
+
parser: ts.parser,
|
|
384
|
+
parserOptions: {
|
|
385
|
+
extraFileExtensions: extraFileExtensions.map((ext) => `${ext}`),
|
|
386
|
+
sourceType: "module",
|
|
387
|
+
...parserOptions
|
|
388
|
+
}
|
|
389
|
+
},
|
|
390
|
+
rules: {
|
|
391
|
+
"@typescript-eslint/no-unused-vars": ["error", {
|
|
392
|
+
args: "all",
|
|
393
|
+
argsIgnorePattern: "^_",
|
|
394
|
+
caughtErrors: "all",
|
|
395
|
+
caughtErrorsIgnorePattern: "^_",
|
|
396
|
+
destructuredArrayIgnorePattern: "^_",
|
|
397
|
+
varsIgnorePattern: "^_",
|
|
398
|
+
ignoreRestSiblings: true
|
|
399
|
+
}],
|
|
400
|
+
...overrideRules
|
|
401
|
+
}
|
|
402
|
+
}];
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
//#endregion
|
|
406
|
+
//#region src/configs/unicorn.ts
|
|
407
|
+
async function unicorn(options = {}) {
|
|
408
|
+
const { rules: overrideRules = {} } = options;
|
|
409
|
+
const useTypeScript = !options.typescript;
|
|
410
|
+
const unicorn$1 = await loadPlugin("eslint-plugin-unicorn");
|
|
411
|
+
return [{
|
|
412
|
+
files: getGlobSourceFiles(useTypeScript),
|
|
413
|
+
...unicorn$1.configs["flat/recommended"]
|
|
414
|
+
}, {
|
|
415
|
+
name: "@kazupon/unicorn",
|
|
416
|
+
files: getGlobSourceFiles(useTypeScript),
|
|
417
|
+
rules: { ...overrideRules }
|
|
418
|
+
}];
|
|
419
|
+
}
|
|
420
|
+
|
|
499
421
|
//#endregion
|
|
500
422
|
//#region src/configs/vitest.ts
|
|
501
423
|
async function vitest(options = {}) {
|
|
@@ -527,6 +449,95 @@ async function vitest(options = {}) {
|
|
|
527
449
|
return configs;
|
|
528
450
|
}
|
|
529
451
|
|
|
452
|
+
//#endregion
|
|
453
|
+
//#region src/configs/vue.ts
|
|
454
|
+
async function vue(options = {}) {
|
|
455
|
+
const { rules: overrideRules = {}, parserOptions = { project: true } } = options;
|
|
456
|
+
const vue$1 = await loadPlugin("eslint-plugin-vue");
|
|
457
|
+
const vueParser = vue$1.configs["flat/base"][1]["languageOptions"]["parser"];
|
|
458
|
+
const configs = [];
|
|
459
|
+
configs.push(...vue$1.configs["flat/recommended"]);
|
|
460
|
+
if (options.composable) {
|
|
461
|
+
const composable = await loadPlugin("eslint-plugin-vue-composable");
|
|
462
|
+
const composableBase = { ...composable.configs["flat/recommended"][0] };
|
|
463
|
+
delete composableBase.languageOptions;
|
|
464
|
+
configs.push(composableBase, composable.configs["flat/recommended"][1]);
|
|
465
|
+
}
|
|
466
|
+
if (options.scopedCss) {
|
|
467
|
+
const scopedCss = await loadPlugin("eslint-plugin-vue-scoped-css");
|
|
468
|
+
const scopedCssMapped = scopedCss.configs["flat/recommended"].map((config, index) => {
|
|
469
|
+
return config.name ? config : {
|
|
470
|
+
name: `vue/scoped-css/recommended/${index}`,
|
|
471
|
+
...config
|
|
472
|
+
};
|
|
473
|
+
});
|
|
474
|
+
configs.push(scopedCssMapped[0], scopedCssMapped[2]);
|
|
475
|
+
}
|
|
476
|
+
if (options.a11y) {
|
|
477
|
+
const a11y = await loadPlugin("eslint-plugin-vuejs-accessibility");
|
|
478
|
+
const a11yBase = { ...a11y.configs["flat/recommended"][0] };
|
|
479
|
+
delete a11yBase.languageOptions;
|
|
480
|
+
configs.push(a11yBase);
|
|
481
|
+
const a11yRules = {
|
|
482
|
+
...a11y.configs["flat/recommended"][1],
|
|
483
|
+
name: "vuejs-accessibility:rules"
|
|
484
|
+
};
|
|
485
|
+
delete a11yRules.languageOptions;
|
|
486
|
+
delete a11yRules.plugins;
|
|
487
|
+
configs.push(a11yRules);
|
|
488
|
+
}
|
|
489
|
+
const customConfig = {
|
|
490
|
+
name: "@kazupon/vue",
|
|
491
|
+
files: [GLOB_VUE],
|
|
492
|
+
rules: { ...overrideRules }
|
|
493
|
+
};
|
|
494
|
+
if (options.typescript) {
|
|
495
|
+
customConfig.languageOptions = {
|
|
496
|
+
parser: vueParser,
|
|
497
|
+
parserOptions: {
|
|
498
|
+
sourceType: "module",
|
|
499
|
+
parser: await getTypeScriptParser(),
|
|
500
|
+
ecmaFeatures: { jsx: true },
|
|
501
|
+
extraFileExtensions: [".vue"],
|
|
502
|
+
...parserOptions
|
|
503
|
+
}
|
|
504
|
+
};
|
|
505
|
+
}
|
|
506
|
+
configs.push(customConfig);
|
|
507
|
+
return configs;
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
//#endregion
|
|
511
|
+
//#region src/configs/yml.ts
|
|
512
|
+
async function yml(options = {}) {
|
|
513
|
+
const { rules: overrideRules = {} } = options;
|
|
514
|
+
const usePrettier = !!options.prettier;
|
|
515
|
+
const yml$1 = await loadPlugin("eslint-plugin-yml");
|
|
516
|
+
const configs = [];
|
|
517
|
+
configs.push(...yml$1.configs["flat/standard"].map((config, index) => {
|
|
518
|
+
return config.name ? config : {
|
|
519
|
+
name: `yml/flat/standard/${index}`,
|
|
520
|
+
...config
|
|
521
|
+
};
|
|
522
|
+
}));
|
|
523
|
+
if (usePrettier) {
|
|
524
|
+
configs.push(...yml$1.configs["flat/prettier"].map((config, index) => {
|
|
525
|
+
return config.name ? config : {
|
|
526
|
+
name: `yml/flat/prettier/${index}`,
|
|
527
|
+
...config
|
|
528
|
+
};
|
|
529
|
+
}));
|
|
530
|
+
}
|
|
531
|
+
const overriddenConfig = {
|
|
532
|
+
name: "@kazupon/yml",
|
|
533
|
+
files: [GLOB_YAML],
|
|
534
|
+
rules: { ...overrideRules }
|
|
535
|
+
};
|
|
536
|
+
configs.push(overriddenConfig);
|
|
537
|
+
return configs;
|
|
538
|
+
}
|
|
539
|
+
const yaml = yml;
|
|
540
|
+
|
|
530
541
|
//#endregion
|
|
531
542
|
Object.defineProperty(exports, 'comments', {
|
|
532
543
|
enumerable: true,
|
package/dist/index.d.cts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from './config';
|
|
2
|
-
export * from './configs';
|
|
3
|
-
export * from './types';
|
|
1
|
+
export * from './config.ts';
|
|
2
|
+
export * from './configs/index.ts';
|
|
3
|
+
export * from './types/index.ts';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from './config';
|
|
2
|
-
export * from './configs';
|
|
3
|
-
export * from './types';
|
|
1
|
+
export * from './config.ts';
|
|
2
|
+
export * from './configs/index.ts';
|
|
3
|
+
export * from './types/index.ts';
|