@kazupon/eslint-config 0.15.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 +24 -22
- package/dist/configs/comments.d.cts +1 -1
- package/dist/configs/comments.d.ts +1 -1
- package/dist/configs/imports.d.cts +21 -0
- package/dist/configs/imports.d.ts +21 -0
- package/dist/configs/index.d.cts +16 -15
- package/dist/configs/index.d.ts +16 -15
- 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 +19 -4
- package/dist/configs/vue.d.ts +19 -4
- package/dist/configs/yml.d.cts +1 -1
- package/dist/configs/yml.d.ts +1 -1
- package/dist/index.cjs +265 -182
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +260 -183
- package/dist/types/gens/eslint.d.cts +2 -1
- package/dist/types/gens/eslint.d.ts +2 -1
- package/dist/types/gens/imports.d.cts +519 -0
- package/dist/types/gens/imports.d.ts +519 -0
- package/dist/types/gens/vue.d.cts +281 -0
- package/dist/types/gens/vue.d.ts +281 -0
- package/dist/types/index.d.cts +18 -17
- package/dist/types/index.d.ts +18 -17
- package/dist/types/overrides.d.cts +1 -1
- package/dist/types/overrides.d.ts +1 -1
- package/package.json +32 -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,6 +72,67 @@ 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/comments.ts
|
|
77
|
+
async function comments(options = {}) {
|
|
78
|
+
const { rules: overrideRules = {} } = options;
|
|
79
|
+
const comments$1 = await loadPlugin("@eslint-community/eslint-plugin-eslint-comments");
|
|
80
|
+
return [{
|
|
81
|
+
name: "@eslint-community/eslint-comments/recommended",
|
|
82
|
+
plugins: { "@eslint-community/eslint-comments": comments$1 },
|
|
83
|
+
rules: { ...comments$1.configs.recommended.rules }
|
|
84
|
+
}, {
|
|
85
|
+
name: "@kazupon/eslint-comments",
|
|
86
|
+
rules: { ...overrideRules }
|
|
87
|
+
}];
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
//#endregion
|
|
91
|
+
//#region src/configs/imports.ts
|
|
92
|
+
const IMPORTS_FILES = [GLOB_JS, GLOB_JSX, GLOB_TS, GLOB_TSX];
|
|
93
|
+
async function imports(options = {}) {
|
|
94
|
+
const { rules: overrideRules = {} } = options;
|
|
95
|
+
const unused = await loadPlugin("eslint-plugin-unused-imports");
|
|
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({
|
|
108
|
+
name: "unused-imports",
|
|
109
|
+
plugins: { "unused-imports": unused },
|
|
110
|
+
files: IMPORTS_FILES,
|
|
111
|
+
rules: {
|
|
112
|
+
"no-unused-vars": "off",
|
|
113
|
+
"@typescript-eslint/no-unused-vars": "off",
|
|
114
|
+
"unused-imports/no-unused-imports": "error",
|
|
115
|
+
"unused-imports/no-unused-vars": ["error", {
|
|
116
|
+
args: "all",
|
|
117
|
+
argsIgnorePattern: "^_",
|
|
118
|
+
caughtErrors: "all",
|
|
119
|
+
caughtErrorsIgnorePattern: "^_",
|
|
120
|
+
destructuredArrayIgnorePattern: "^_",
|
|
121
|
+
vars: "all",
|
|
122
|
+
varsIgnorePattern: "^_",
|
|
123
|
+
ignoreRestSiblings: true
|
|
124
|
+
}]
|
|
125
|
+
}
|
|
126
|
+
});
|
|
127
|
+
const overriddenConfig = {
|
|
128
|
+
name: "@kazupon/imports",
|
|
129
|
+
files: IMPORTS_FILES,
|
|
130
|
+
rules: { ...overrideRules }
|
|
131
|
+
};
|
|
132
|
+
configs.push(overriddenConfig);
|
|
133
|
+
return configs;
|
|
134
|
+
}
|
|
135
|
+
|
|
75
136
|
//#endregion
|
|
76
137
|
//#region src/configs/javascript.ts
|
|
77
138
|
async function javascript(options = {}) {
|
|
@@ -104,56 +165,6 @@ async function javascript(options = {}) {
|
|
|
104
165
|
}];
|
|
105
166
|
}
|
|
106
167
|
|
|
107
|
-
//#endregion
|
|
108
|
-
//#region src/configs/comments.ts
|
|
109
|
-
async function comments(options = {}) {
|
|
110
|
-
const { rules: overrideRules = {} } = options;
|
|
111
|
-
const comments$1 = await loadPlugin("@eslint-community/eslint-plugin-eslint-comments");
|
|
112
|
-
return [{
|
|
113
|
-
name: "@eslint-community/eslint-comments/recommended",
|
|
114
|
-
plugins: { "@eslint-community/eslint-comments": comments$1 },
|
|
115
|
-
rules: { ...comments$1.configs.recommended.rules }
|
|
116
|
-
}, {
|
|
117
|
-
name: "@kazupon/eslint-comments",
|
|
118
|
-
rules: { ...overrideRules }
|
|
119
|
-
}];
|
|
120
|
-
}
|
|
121
|
-
|
|
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
168
|
//#endregion
|
|
158
169
|
//#region src/configs/jsdoc.ts
|
|
159
170
|
async function jsdoc(options = {}) {
|
|
@@ -177,82 +188,6 @@ async function jsdoc(options = {}) {
|
|
|
177
188
|
}];
|
|
178
189
|
}
|
|
179
190
|
|
|
180
|
-
//#endregion
|
|
181
|
-
//#region src/configs/promise.ts
|
|
182
|
-
async function promise(options = {}) {
|
|
183
|
-
const { rules: overrideRules = {} } = options;
|
|
184
|
-
const promise$1 = await loadPlugin("eslint-plugin-promise");
|
|
185
|
-
return [{
|
|
186
|
-
name: "promise/flat/recommended",
|
|
187
|
-
...promise$1.configs["flat/recommended"]
|
|
188
|
-
}, {
|
|
189
|
-
name: "@kazupon/promise",
|
|
190
|
-
rules: { ...overrideRules }
|
|
191
|
-
}];
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
//#endregion
|
|
195
|
-
//#region src/configs/regexp.ts
|
|
196
|
-
async function regexp(options = {}) {
|
|
197
|
-
const { rules: overrideRules = {} } = options;
|
|
198
|
-
const regexp$1 = await loadPlugin("eslint-plugin-regexp");
|
|
199
|
-
return [{
|
|
200
|
-
name: "regexp/flat/recommended",
|
|
201
|
-
...regexp$1.configs["flat/recommended"]
|
|
202
|
-
}, {
|
|
203
|
-
name: "@kazupon/eslint-regexp",
|
|
204
|
-
rules: { ...overrideRules }
|
|
205
|
-
}];
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
//#endregion
|
|
209
|
-
//#region src/configs/toml.ts
|
|
210
|
-
async function toml(options = {}) {
|
|
211
|
-
const { rules: overrideRules = {} } = options;
|
|
212
|
-
const toml$1 = await loadPlugin("eslint-plugin-toml");
|
|
213
|
-
const configs = [];
|
|
214
|
-
configs.push(...toml$1.configs["flat/standard"].map((config, index) => {
|
|
215
|
-
return config.name ? config : {
|
|
216
|
-
name: `toml/flat/standard/${index}`,
|
|
217
|
-
...config
|
|
218
|
-
};
|
|
219
|
-
}));
|
|
220
|
-
const overriddenConfig = {
|
|
221
|
-
name: "@kazupon/toml",
|
|
222
|
-
files: [GLOB_TOML],
|
|
223
|
-
rules: { ...overrideRules }
|
|
224
|
-
};
|
|
225
|
-
configs.push(overriddenConfig);
|
|
226
|
-
return configs;
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
//#endregion
|
|
230
|
-
//#region src/configs/unicorn.ts
|
|
231
|
-
async function unicorn(options = {}) {
|
|
232
|
-
const { rules: overrideRules = {} } = options;
|
|
233
|
-
const useTypeScript = !options.typescript;
|
|
234
|
-
const unicorn$1 = await loadPlugin("eslint-plugin-unicorn");
|
|
235
|
-
return [{
|
|
236
|
-
files: getGlobSourceFiles(useTypeScript),
|
|
237
|
-
...unicorn$1.configs["flat/recommended"]
|
|
238
|
-
}, {
|
|
239
|
-
name: "@kazupon/unicorn",
|
|
240
|
-
files: getGlobSourceFiles(useTypeScript),
|
|
241
|
-
rules: { ...overrideRules }
|
|
242
|
-
}];
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
//#endregion
|
|
246
|
-
//#region src/configs/prettier.ts
|
|
247
|
-
async function prettier(options = {}) {
|
|
248
|
-
const { rules: overrideRules = {} } = options;
|
|
249
|
-
const prettier$1 = await loadPlugin("eslint-config-prettier");
|
|
250
|
-
return [prettier$1, {
|
|
251
|
-
name: "@kazupon/prettier",
|
|
252
|
-
rules: { ...overrideRules }
|
|
253
|
-
}];
|
|
254
|
-
}
|
|
255
|
-
|
|
256
191
|
//#endregion
|
|
257
192
|
//#region src/configs/jsonc.ts
|
|
258
193
|
async function jsonc(options = {}) {
|
|
@@ -314,61 +249,28 @@ function jsoncSort() {
|
|
|
314
249
|
}
|
|
315
250
|
|
|
316
251
|
//#endregion
|
|
317
|
-
//#region src/configs/
|
|
318
|
-
async function
|
|
252
|
+
//#region src/configs/prettier.ts
|
|
253
|
+
async function prettier(options = {}) {
|
|
319
254
|
const { rules: overrideRules = {} } = options;
|
|
320
|
-
const
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
configs.push(...yml$1.configs["flat/standard"].map((config, index) => {
|
|
324
|
-
return config.name ? config : {
|
|
325
|
-
name: `yml/flat/standard/${index}`,
|
|
326
|
-
...config
|
|
327
|
-
};
|
|
328
|
-
}));
|
|
329
|
-
if (usePrettier) {
|
|
330
|
-
configs.push(...yml$1.configs["flat/prettier"].map((config, index) => {
|
|
331
|
-
return config.name ? config : {
|
|
332
|
-
name: `yml/flat/prettier/${index}`,
|
|
333
|
-
...config
|
|
334
|
-
};
|
|
335
|
-
}));
|
|
336
|
-
}
|
|
337
|
-
const overriddenConfig = {
|
|
338
|
-
name: "@kazupon/yml",
|
|
339
|
-
files: [GLOB_YAML],
|
|
255
|
+
const prettier$1 = await loadPlugin("eslint-config-prettier");
|
|
256
|
+
return [prettier$1, {
|
|
257
|
+
name: "@kazupon/prettier",
|
|
340
258
|
rules: { ...overrideRules }
|
|
341
|
-
};
|
|
342
|
-
configs.push(overriddenConfig);
|
|
343
|
-
return configs;
|
|
259
|
+
}];
|
|
344
260
|
}
|
|
345
|
-
const yaml = yml;
|
|
346
261
|
|
|
347
262
|
//#endregion
|
|
348
|
-
//#region src/configs/
|
|
349
|
-
async function
|
|
350
|
-
const { rules: overrideRules = {}
|
|
351
|
-
const
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
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",
|
|
357
272
|
rules: { ...overrideRules }
|
|
358
|
-
};
|
|
359
|
-
if (useTypeScript) {
|
|
360
|
-
customConfig.languageOptions = {
|
|
361
|
-
parser: vueParser,
|
|
362
|
-
parserOptions: {
|
|
363
|
-
sourceType: "module",
|
|
364
|
-
parser: await getTypeScriptParser(),
|
|
365
|
-
ecmaFeatures: { jsx: true },
|
|
366
|
-
extraFileExtensions: [".vue"],
|
|
367
|
-
...parserOptions
|
|
368
|
-
}
|
|
369
|
-
};
|
|
370
|
-
}
|
|
371
|
-
return [...vue$1.configs["flat/recommended"], customConfig];
|
|
273
|
+
}];
|
|
372
274
|
}
|
|
373
275
|
|
|
374
276
|
//#endregion
|
|
@@ -403,6 +305,20 @@ async function react(options = {}) {
|
|
|
403
305
|
return [...configs, customConfig];
|
|
404
306
|
}
|
|
405
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
|
+
|
|
406
322
|
//#endregion
|
|
407
323
|
//#region src/configs/svelte.ts
|
|
408
324
|
async function svelte(options = {}) {
|
|
@@ -430,6 +346,78 @@ async function svelte(options = {}) {
|
|
|
430
346
|
return [...svelte$1.configs["flat/recommended"], customConfig];
|
|
431
347
|
}
|
|
432
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
|
+
|
|
433
421
|
//#endregion
|
|
434
422
|
//#region src/configs/vitest.ts
|
|
435
423
|
async function vitest(options = {}) {
|
|
@@ -461,6 +449,95 @@ async function vitest(options = {}) {
|
|
|
461
449
|
return configs;
|
|
462
450
|
}
|
|
463
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
|
+
|
|
464
541
|
//#endregion
|
|
465
542
|
Object.defineProperty(exports, 'comments', {
|
|
466
543
|
enumerable: true,
|
|
@@ -474,6 +551,12 @@ Object.defineProperty(exports, 'defineConfig', {
|
|
|
474
551
|
return defineConfig;
|
|
475
552
|
}
|
|
476
553
|
});
|
|
554
|
+
Object.defineProperty(exports, 'imports', {
|
|
555
|
+
enumerable: true,
|
|
556
|
+
get: function () {
|
|
557
|
+
return imports;
|
|
558
|
+
}
|
|
559
|
+
});
|
|
477
560
|
Object.defineProperty(exports, 'javascript', {
|
|
478
561
|
enumerable: true,
|
|
479
562
|
get: function () {
|
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';
|