@whoj/eslint-config 2.1.0 → 2.2.1
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 +18 -18
- package/bin/index.js +1 -1
- package/dist/cli.js +115 -113
- package/dist/index.d.ts +90 -78
- package/dist/index.js +1594 -1534
- package/package.json +4 -2
package/README.md
CHANGED
|
@@ -24,9 +24,9 @@ And create `eslint.config.mjs` in your project root:
|
|
|
24
24
|
|
|
25
25
|
```js
|
|
26
26
|
// eslint.config.mjs
|
|
27
|
-
import whoj from '@whoj/eslint-config'
|
|
27
|
+
import whoj from '@whoj/eslint-config';
|
|
28
28
|
|
|
29
|
-
export default whoj()
|
|
29
|
+
export default whoj();
|
|
30
30
|
```
|
|
31
31
|
|
|
32
32
|
<details>
|
|
@@ -37,27 +37,27 @@ Combined with legacy config:
|
|
|
37
37
|
If you still use some configs from the legacy eslintrc format, you can use the [`@eslint/eslintrc`](https://www.npmjs.com/package/@eslint/eslintrc) package to convert them to the flat config.
|
|
38
38
|
|
|
39
39
|
```js
|
|
40
|
-
import { FlatCompat } from '@eslint/eslintrc'
|
|
41
40
|
// eslint.config.mjs
|
|
42
|
-
import whoj from '@whoj/eslint-config'
|
|
41
|
+
import whoj from '@whoj/eslint-config';
|
|
42
|
+
import { FlatCompat } from '@eslint/eslintrc';
|
|
43
43
|
|
|
44
|
-
const compat = new FlatCompat()
|
|
44
|
+
const compat = new FlatCompat();
|
|
45
45
|
|
|
46
46
|
export default whoj(
|
|
47
47
|
{
|
|
48
|
-
ignores: []
|
|
48
|
+
ignores: []
|
|
49
49
|
},
|
|
50
50
|
|
|
51
51
|
// Legacy config
|
|
52
52
|
...compat.config({
|
|
53
53
|
extends: [
|
|
54
|
-
'eslint:recommended'
|
|
54
|
+
'eslint:recommended'
|
|
55
55
|
// Other extends...
|
|
56
|
-
]
|
|
56
|
+
]
|
|
57
57
|
})
|
|
58
58
|
|
|
59
59
|
// Other flat configs...
|
|
60
|
-
)
|
|
60
|
+
);
|
|
61
61
|
```
|
|
62
62
|
|
|
63
63
|
> Note that `.eslintignore` no longer works in Flat config, see [customization](#customization) for more details.
|
|
@@ -149,7 +149,7 @@ You can configure each integration individually, for example:
|
|
|
149
149
|
|
|
150
150
|
```js
|
|
151
151
|
// eslint.config.js
|
|
152
|
-
import whoj from '@whoj/eslint-config'
|
|
152
|
+
import whoj from '@whoj/eslint-config';
|
|
153
153
|
|
|
154
154
|
export default whoj({
|
|
155
155
|
// Type of the project. 'lib' for libraries, the default is 'app'
|
|
@@ -161,7 +161,7 @@ export default whoj({
|
|
|
161
161
|
// Or customize the stylistic rules
|
|
162
162
|
stylistic: {
|
|
163
163
|
indent: 2, // 4, or 'tab'
|
|
164
|
-
quotes: 'single'
|
|
164
|
+
quotes: 'single' // or 'double'
|
|
165
165
|
},
|
|
166
166
|
|
|
167
167
|
// TypeScript and Vue are autodetected, you can also explicitly enable them:
|
|
@@ -174,17 +174,17 @@ export default whoj({
|
|
|
174
174
|
|
|
175
175
|
// `.eslintignore` is no longer supported in Flat config, use `ignores` instead
|
|
176
176
|
ignores: [
|
|
177
|
-
'**/fixtures'
|
|
177
|
+
'**/fixtures'
|
|
178
178
|
// ...globs
|
|
179
179
|
]
|
|
180
|
-
})
|
|
180
|
+
});
|
|
181
181
|
```
|
|
182
182
|
|
|
183
183
|
The `whoj` factory function also accepts any number of arbitrary custom config overrides:
|
|
184
184
|
|
|
185
185
|
```js
|
|
186
186
|
// eslint.config.js
|
|
187
|
-
import whoj from '@whoj/eslint-config'
|
|
187
|
+
import whoj from '@whoj/eslint-config';
|
|
188
188
|
|
|
189
189
|
export default whoj(
|
|
190
190
|
{
|
|
@@ -195,12 +195,12 @@ export default whoj(
|
|
|
195
195
|
// you can have multiple configs
|
|
196
196
|
{
|
|
197
197
|
files: ['**/*.ts'],
|
|
198
|
-
rules: {}
|
|
198
|
+
rules: {}
|
|
199
199
|
},
|
|
200
200
|
{
|
|
201
|
-
rules: {}
|
|
202
|
-
}
|
|
203
|
-
)
|
|
201
|
+
rules: {}
|
|
202
|
+
}
|
|
203
|
+
);
|
|
204
204
|
```
|
|
205
205
|
|
|
206
206
|
Going more advanced, Check out [configs](https://github.com/antfu/eslint-config)
|
package/bin/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import '../dist/cli.js'
|
|
2
|
+
import '../dist/cli.js';
|
package/dist/cli.js
CHANGED
|
@@ -7,21 +7,114 @@ init_esm_shims();
|
|
|
7
7
|
|
|
8
8
|
// src/cli/index.ts
|
|
9
9
|
init_esm_shims();
|
|
10
|
+
import yargs from "yargs";
|
|
11
|
+
import c6 from "picocolors";
|
|
10
12
|
import process5 from "node:process";
|
|
11
13
|
import * as p5 from "@clack/prompts";
|
|
12
|
-
import c6 from "picocolors";
|
|
13
|
-
import yargs from "yargs";
|
|
14
14
|
import { hideBin } from "yargs/helpers";
|
|
15
15
|
|
|
16
|
-
// src/cli/
|
|
16
|
+
// src/cli/run.ts
|
|
17
|
+
init_esm_shims();
|
|
18
|
+
import fs3 from "node:fs";
|
|
19
|
+
import c5 from "picocolors";
|
|
20
|
+
import path4 from "node:path";
|
|
21
|
+
import process4 from "node:process";
|
|
22
|
+
import * as p4 from "@clack/prompts";
|
|
23
|
+
|
|
24
|
+
// src/cli/utils.ts
|
|
17
25
|
init_esm_shims();
|
|
26
|
+
import { execSync } from "node:child_process";
|
|
27
|
+
function isGitClean() {
|
|
28
|
+
try {
|
|
29
|
+
execSync("git diff-index --quiet HEAD --");
|
|
30
|
+
return true;
|
|
31
|
+
} catch {
|
|
32
|
+
return false;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
function getEslintConfigContent(mainConfig, additionalConfigs) {
|
|
36
|
+
return `
|
|
37
|
+
import whoj from '@whoj/eslint-config'
|
|
38
|
+
|
|
39
|
+
export default whoj({
|
|
40
|
+
${mainConfig}
|
|
41
|
+
}${additionalConfigs?.map((config) => `,{
|
|
42
|
+
${config}
|
|
43
|
+
}`)})
|
|
44
|
+
`.trimStart();
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
// src/cli/stages/update-eslint-files.ts
|
|
48
|
+
init_esm_shims();
|
|
49
|
+
import fs from "node:fs";
|
|
18
50
|
import c from "picocolors";
|
|
51
|
+
import path from "node:path";
|
|
52
|
+
import fsp from "node:fs/promises";
|
|
53
|
+
import process from "node:process";
|
|
54
|
+
import * as p from "@clack/prompts";
|
|
55
|
+
import parse from "parse-gitignore";
|
|
56
|
+
async function updateEslintFiles(result) {
|
|
57
|
+
const cwd = process.cwd();
|
|
58
|
+
const pathESLintIgnore = path.join(cwd, ".eslintignore");
|
|
59
|
+
const pathPackageJSON = path.join(cwd, "package.json");
|
|
60
|
+
const pkgContent = await fsp.readFile(pathPackageJSON, "utf-8");
|
|
61
|
+
const pkg = JSON.parse(pkgContent);
|
|
62
|
+
const configFileName = pkg.type === "module" ? "eslint.config.js" : "eslint.config.mjs";
|
|
63
|
+
const pathFlatConfig = path.join(cwd, configFileName);
|
|
64
|
+
const eslintIgnores = [];
|
|
65
|
+
if (fs.existsSync(pathESLintIgnore)) {
|
|
66
|
+
p.log.step(c.cyan("Migrating existing .eslintignore"));
|
|
67
|
+
const content = await fsp.readFile(pathESLintIgnore, "utf-8");
|
|
68
|
+
const parsed = parse(content);
|
|
69
|
+
const globs = parsed.globs();
|
|
70
|
+
for (const glob of globs) {
|
|
71
|
+
if (glob.type === "ignore")
|
|
72
|
+
eslintIgnores.push(...glob.patterns);
|
|
73
|
+
else if (glob.type === "unignore")
|
|
74
|
+
eslintIgnores.push(...glob.patterns.map((pattern) => `!${pattern}`));
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
const configLines = [];
|
|
78
|
+
if (eslintIgnores.length)
|
|
79
|
+
configLines.push(`ignores: ${JSON.stringify(eslintIgnores)},`);
|
|
80
|
+
if (result.extra.includes("formatter"))
|
|
81
|
+
configLines.push("formatters: true,");
|
|
82
|
+
if (result.extra.includes("unocss"))
|
|
83
|
+
configLines.push("unocss: true,");
|
|
84
|
+
for (const framework of result.frameworks)
|
|
85
|
+
configLines.push(`${framework}: true,`);
|
|
86
|
+
const mainConfig = configLines.map((i) => ` ${i}`).join("\n");
|
|
87
|
+
const additionalConfig = [];
|
|
88
|
+
const eslintConfigContent = getEslintConfigContent(mainConfig, additionalConfig);
|
|
89
|
+
await fsp.writeFile(pathFlatConfig, eslintConfigContent);
|
|
90
|
+
p.log.success(c.green(`Created ${configFileName}`));
|
|
91
|
+
const files = fs.readdirSync(cwd);
|
|
92
|
+
const legacyConfig = [];
|
|
93
|
+
files.forEach((file) => {
|
|
94
|
+
if (/eslint|prettier/.test(file) && !/eslint\.config\./.test(file))
|
|
95
|
+
legacyConfig.push(file);
|
|
96
|
+
});
|
|
97
|
+
if (legacyConfig.length)
|
|
98
|
+
p.note(`${c.dim(legacyConfig.join(", "))}`, "You can now remove those files manually");
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
// src/cli/stages/update-package-json.ts
|
|
102
|
+
init_esm_shims();
|
|
103
|
+
import c3 from "picocolors";
|
|
104
|
+
import path2 from "node:path";
|
|
105
|
+
import fsp2 from "node:fs/promises";
|
|
106
|
+
import process2 from "node:process";
|
|
107
|
+
import * as p2 from "@clack/prompts";
|
|
108
|
+
|
|
109
|
+
// src/cli/constants.ts
|
|
110
|
+
init_esm_shims();
|
|
111
|
+
import c2 from "picocolors";
|
|
19
112
|
|
|
20
113
|
// package.json
|
|
21
114
|
var package_default = {
|
|
22
115
|
name: "@whoj/eslint-config",
|
|
23
116
|
type: "module",
|
|
24
|
-
version: "2.1
|
|
117
|
+
version: "2.2.1",
|
|
25
118
|
packageManager: "pnpm@10.2.1",
|
|
26
119
|
description: "ESLint config",
|
|
27
120
|
license: "MIT",
|
|
@@ -46,6 +139,7 @@ var package_default = {
|
|
|
46
139
|
"build:inspector": "pnpm build && npx @eslint/config-inspector build",
|
|
47
140
|
watch: "tsup --watch",
|
|
48
141
|
lint: "eslint .",
|
|
142
|
+
"lint:fix": "eslint . --fix",
|
|
49
143
|
typegen: "tsx scripts/typegen.ts",
|
|
50
144
|
prepack: "nr build",
|
|
51
145
|
release: "bumpp && pnpm publish",
|
|
@@ -78,6 +172,7 @@ var package_default = {
|
|
|
78
172
|
"@clack/prompts": "^0.9.1",
|
|
79
173
|
"@eslint-community/eslint-plugin-eslint-comments": "^4.4.1",
|
|
80
174
|
"@eslint/markdown": "^6.2.2",
|
|
175
|
+
"@nuxt/eslint-config": "^1.0.1",
|
|
81
176
|
"@stylistic/eslint-plugin": "^3.0.1",
|
|
82
177
|
"@typescript-eslint/eslint-plugin": "^8.22.0",
|
|
83
178
|
"@typescript-eslint/parser": "^8.22.0",
|
|
@@ -224,27 +319,27 @@ var vscodeSettingsString = `
|
|
|
224
319
|
`;
|
|
225
320
|
var frameworkOptions = [
|
|
226
321
|
{
|
|
227
|
-
label:
|
|
322
|
+
label: c2.green("Vue"),
|
|
228
323
|
value: "vue"
|
|
229
324
|
},
|
|
230
325
|
{
|
|
231
|
-
label:
|
|
326
|
+
label: c2.cyan("React"),
|
|
232
327
|
value: "react"
|
|
233
328
|
},
|
|
234
329
|
{
|
|
235
|
-
label:
|
|
330
|
+
label: c2.red("Svelte"),
|
|
236
331
|
value: "svelte"
|
|
237
332
|
},
|
|
238
333
|
{
|
|
239
|
-
label:
|
|
334
|
+
label: c2.magenta("Astro"),
|
|
240
335
|
value: "astro"
|
|
241
336
|
},
|
|
242
337
|
{
|
|
243
|
-
label:
|
|
338
|
+
label: c2.cyan("Solid"),
|
|
244
339
|
value: "solid"
|
|
245
340
|
},
|
|
246
341
|
{
|
|
247
|
-
label:
|
|
342
|
+
label: c2.blue("Slidev"),
|
|
248
343
|
value: "slidev"
|
|
249
344
|
}
|
|
250
345
|
];
|
|
@@ -252,11 +347,11 @@ var frameworks = frameworkOptions.map(({ value }) => value);
|
|
|
252
347
|
var extraOptions = [
|
|
253
348
|
{
|
|
254
349
|
hint: "Use external formatters (Prettier and/or dprint) to format files that ESLint cannot handle yet (.css, .html, etc)",
|
|
255
|
-
label:
|
|
350
|
+
label: c2.red("Formatter"),
|
|
256
351
|
value: "formatter"
|
|
257
352
|
},
|
|
258
353
|
{
|
|
259
|
-
label:
|
|
354
|
+
label: c2.cyan("UnoCSS"),
|
|
260
355
|
value: "unocss"
|
|
261
356
|
}
|
|
262
357
|
];
|
|
@@ -284,100 +379,7 @@ var dependenciesMap = {
|
|
|
284
379
|
vue: []
|
|
285
380
|
};
|
|
286
381
|
|
|
287
|
-
// src/cli/run.ts
|
|
288
|
-
init_esm_shims();
|
|
289
|
-
import fs3 from "node:fs";
|
|
290
|
-
import path4 from "node:path";
|
|
291
|
-
import process4 from "node:process";
|
|
292
|
-
import * as p4 from "@clack/prompts";
|
|
293
|
-
import c5 from "picocolors";
|
|
294
|
-
|
|
295
|
-
// src/cli/stages/update-eslint-files.ts
|
|
296
|
-
init_esm_shims();
|
|
297
|
-
import fs from "node:fs";
|
|
298
|
-
import fsp from "node:fs/promises";
|
|
299
|
-
import path from "node:path";
|
|
300
|
-
import process from "node:process";
|
|
301
|
-
import * as p from "@clack/prompts";
|
|
302
|
-
import parse from "parse-gitignore";
|
|
303
|
-
import c2 from "picocolors";
|
|
304
|
-
|
|
305
|
-
// src/cli/utils.ts
|
|
306
|
-
init_esm_shims();
|
|
307
|
-
import { execSync } from "node:child_process";
|
|
308
|
-
function isGitClean() {
|
|
309
|
-
try {
|
|
310
|
-
execSync("git diff-index --quiet HEAD --");
|
|
311
|
-
return true;
|
|
312
|
-
} catch {
|
|
313
|
-
return false;
|
|
314
|
-
}
|
|
315
|
-
}
|
|
316
|
-
function getEslintConfigContent(mainConfig, additionalConfigs) {
|
|
317
|
-
return `
|
|
318
|
-
import whoj from '@whoj/eslint-config'
|
|
319
|
-
|
|
320
|
-
export default whoj({
|
|
321
|
-
${mainConfig}
|
|
322
|
-
}${additionalConfigs?.map((config) => `,{
|
|
323
|
-
${config}
|
|
324
|
-
}`)})
|
|
325
|
-
`.trimStart();
|
|
326
|
-
}
|
|
327
|
-
|
|
328
|
-
// src/cli/stages/update-eslint-files.ts
|
|
329
|
-
async function updateEslintFiles(result) {
|
|
330
|
-
const cwd = process.cwd();
|
|
331
|
-
const pathESLintIgnore = path.join(cwd, ".eslintignore");
|
|
332
|
-
const pathPackageJSON = path.join(cwd, "package.json");
|
|
333
|
-
const pkgContent = await fsp.readFile(pathPackageJSON, "utf-8");
|
|
334
|
-
const pkg = JSON.parse(pkgContent);
|
|
335
|
-
const configFileName = pkg.type === "module" ? "eslint.config.js" : "eslint.config.mjs";
|
|
336
|
-
const pathFlatConfig = path.join(cwd, configFileName);
|
|
337
|
-
const eslintIgnores = [];
|
|
338
|
-
if (fs.existsSync(pathESLintIgnore)) {
|
|
339
|
-
p.log.step(c2.cyan(`Migrating existing .eslintignore`));
|
|
340
|
-
const content = await fsp.readFile(pathESLintIgnore, "utf-8");
|
|
341
|
-
const parsed = parse(content);
|
|
342
|
-
const globs = parsed.globs();
|
|
343
|
-
for (const glob of globs) {
|
|
344
|
-
if (glob.type === "ignore")
|
|
345
|
-
eslintIgnores.push(...glob.patterns);
|
|
346
|
-
else if (glob.type === "unignore")
|
|
347
|
-
eslintIgnores.push(...glob.patterns.map((pattern) => `!${pattern}`));
|
|
348
|
-
}
|
|
349
|
-
}
|
|
350
|
-
const configLines = [];
|
|
351
|
-
if (eslintIgnores.length)
|
|
352
|
-
configLines.push(`ignores: ${JSON.stringify(eslintIgnores)},`);
|
|
353
|
-
if (result.extra.includes("formatter"))
|
|
354
|
-
configLines.push(`formatters: true,`);
|
|
355
|
-
if (result.extra.includes("unocss"))
|
|
356
|
-
configLines.push(`unocss: true,`);
|
|
357
|
-
for (const framework of result.frameworks)
|
|
358
|
-
configLines.push(`${framework}: true,`);
|
|
359
|
-
const mainConfig = configLines.map((i) => ` ${i}`).join("\n");
|
|
360
|
-
const additionalConfig = [];
|
|
361
|
-
const eslintConfigContent = getEslintConfigContent(mainConfig, additionalConfig);
|
|
362
|
-
await fsp.writeFile(pathFlatConfig, eslintConfigContent);
|
|
363
|
-
p.log.success(c2.green(`Created ${configFileName}`));
|
|
364
|
-
const files = fs.readdirSync(cwd);
|
|
365
|
-
const legacyConfig = [];
|
|
366
|
-
files.forEach((file) => {
|
|
367
|
-
if (/eslint|prettier/.test(file) && !/eslint\.config\./.test(file))
|
|
368
|
-
legacyConfig.push(file);
|
|
369
|
-
});
|
|
370
|
-
if (legacyConfig.length)
|
|
371
|
-
p.note(`${c2.dim(legacyConfig.join(", "))}`, "You can now remove those files manually");
|
|
372
|
-
}
|
|
373
|
-
|
|
374
382
|
// src/cli/stages/update-package-json.ts
|
|
375
|
-
init_esm_shims();
|
|
376
|
-
import fsp2 from "node:fs/promises";
|
|
377
|
-
import path2 from "node:path";
|
|
378
|
-
import process2 from "node:process";
|
|
379
|
-
import * as p2 from "@clack/prompts";
|
|
380
|
-
import c3 from "picocolors";
|
|
381
383
|
async function updatePackageJson(result) {
|
|
382
384
|
const cwd = process2.cwd();
|
|
383
385
|
const pathPackageJSON = path2.join(cwd, "package.json");
|
|
@@ -425,17 +427,17 @@ async function updatePackageJson(result) {
|
|
|
425
427
|
if (addedPackages.length)
|
|
426
428
|
p2.note(`${c3.dim(addedPackages.join(", "))}`, "Added packages");
|
|
427
429
|
await fsp2.writeFile(pathPackageJSON, JSON.stringify(pkg, null, 2));
|
|
428
|
-
p2.log.success(c3.green(
|
|
430
|
+
p2.log.success(c3.green("Changes wrote to package.json"));
|
|
429
431
|
}
|
|
430
432
|
|
|
431
433
|
// src/cli/stages/update-vscode-settings.ts
|
|
432
434
|
init_esm_shims();
|
|
433
435
|
import fs2 from "node:fs";
|
|
434
|
-
import
|
|
436
|
+
import c4 from "picocolors";
|
|
435
437
|
import path3 from "node:path";
|
|
438
|
+
import fsp3 from "node:fs/promises";
|
|
436
439
|
import process3 from "node:process";
|
|
437
440
|
import * as p3 from "@clack/prompts";
|
|
438
|
-
import c4 from "picocolors";
|
|
439
441
|
async function updateVscodeSettings(result) {
|
|
440
442
|
const cwd = process3.cwd();
|
|
441
443
|
if (!result.updateVscodeSettings)
|
|
@@ -447,7 +449,7 @@ async function updateVscodeSettings(result) {
|
|
|
447
449
|
if (!fs2.existsSync(settingsPath)) {
|
|
448
450
|
await fsp3.writeFile(settingsPath, `{${vscodeSettingsString}}
|
|
449
451
|
`, "utf-8");
|
|
450
|
-
p3.log.success(c4.green(
|
|
452
|
+
p3.log.success(c4.green("Created .vscode/settings.json"));
|
|
451
453
|
} else {
|
|
452
454
|
let settingsContent = await fsp3.readFile(settingsPath, "utf8");
|
|
453
455
|
settingsContent = settingsContent.trim().replace(/\s*\}$/, "");
|
|
@@ -455,7 +457,7 @@ async function updateVscodeSettings(result) {
|
|
|
455
457
|
settingsContent += `${vscodeSettingsString}}
|
|
456
458
|
`;
|
|
457
459
|
await fsp3.writeFile(settingsPath, settingsContent, "utf-8");
|
|
458
|
-
p3.log.success(c4.green(
|
|
460
|
+
p3.log.success(c4.green("Updated .vscode/settings.json"));
|
|
459
461
|
}
|
|
460
462
|
}
|
|
461
463
|
|
|
@@ -465,7 +467,7 @@ async function run(options = {}) {
|
|
|
465
467
|
const argTemplate = options.frameworks?.map((m) => m.trim());
|
|
466
468
|
const argExtra = options.extra?.map((m) => m.trim());
|
|
467
469
|
if (fs3.existsSync(path4.join(process4.cwd(), "eslint.config.js"))) {
|
|
468
|
-
p4.log.warn(c5.yellow(
|
|
470
|
+
p4.log.warn(c5.yellow("eslint.config.js already exists, migration wizard exited."));
|
|
469
471
|
return process4.exit(1);
|
|
470
472
|
}
|
|
471
473
|
let result = {
|
|
@@ -526,7 +528,7 @@ async function run(options = {}) {
|
|
|
526
528
|
await updatePackageJson(result);
|
|
527
529
|
await updateEslintFiles(result);
|
|
528
530
|
await updateVscodeSettings(result);
|
|
529
|
-
p4.log.success(c5.green(
|
|
531
|
+
p4.log.success(c5.green("Setup completed"));
|
|
530
532
|
p4.outro(`Now you can update the dependencies by run ${c5.blue("pnpm install")} and run ${c5.blue("eslint . --fix")}
|
|
531
533
|
`);
|
|
532
534
|
}
|
|
@@ -534,7 +536,7 @@ async function run(options = {}) {
|
|
|
534
536
|
// src/cli/index.ts
|
|
535
537
|
function header() {
|
|
536
538
|
console.log("\n");
|
|
537
|
-
p5.intro(`${c6.green(
|
|
539
|
+
p5.intro(`${c6.green("@whoj/eslint-config ")}${c6.dim(`v${package_default.version}`)}`);
|
|
538
540
|
}
|
|
539
541
|
var instance = yargs(hideBin(process5.argv)).scriptName("@whoj/eslint-config").usage("").command(
|
|
540
542
|
"*",
|
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { Linter } from 'eslint';
|
|
2
|
-
import {
|
|
2
|
+
import { FlatConfigComposer } from 'eslint-flat-config-utils';
|
|
3
3
|
import { ParserOptions } from '@typescript-eslint/parser';
|
|
4
4
|
import { FlatGitignoreOptions } from 'eslint-config-flat-gitignore';
|
|
5
|
+
import { StylisticCustomizeOptions } from '@stylistic/eslint-plugin';
|
|
5
6
|
import { Options } from 'eslint-processor-vue-blocks';
|
|
6
|
-
import {
|
|
7
|
+
import { NuxtESLintConfigOptions, NuxtESLintFeaturesOptions } from '@nuxt/eslint-config/flat';
|
|
7
8
|
|
|
8
9
|
/* eslint-disable */
|
|
9
10
|
/* prettier-ignore */
|
|
@@ -16395,6 +16396,9 @@ interface OptionsFiles {
|
|
|
16395
16396
|
*/
|
|
16396
16397
|
files?: string[];
|
|
16397
16398
|
}
|
|
16399
|
+
interface OptionsNuxt extends Omit<NuxtESLintConfigOptions, 'features'> {
|
|
16400
|
+
features?: Omit<NuxtESLintFeaturesOptions, 'standalone'>;
|
|
16401
|
+
}
|
|
16398
16402
|
interface OptionsVue extends OptionsOverrides {
|
|
16399
16403
|
/**
|
|
16400
16404
|
* Create virtual files for Vue SFC blocks to enable linting.
|
|
@@ -16525,7 +16529,7 @@ interface OptionsHasTypeScript {
|
|
|
16525
16529
|
interface OptionsStylistic {
|
|
16526
16530
|
stylistic?: boolean | StylisticConfig;
|
|
16527
16531
|
}
|
|
16528
|
-
interface StylisticConfig extends Pick<StylisticCustomizeOptions, 'indent' | 'quotes' | 'jsx' | 'semi'> {
|
|
16532
|
+
interface StylisticConfig extends Pick<StylisticCustomizeOptions, 'indent' | 'quotes' | 'jsx' | 'semi' | 'commaDangle'> {
|
|
16529
16533
|
}
|
|
16530
16534
|
interface OptionsOverrides {
|
|
16531
16535
|
overrides?: TypedFlatConfigItem['rules'];
|
|
@@ -16617,6 +16621,12 @@ interface OptionsConfig extends OptionsComponentExts, OptionsProjectType {
|
|
|
16617
16621
|
* @default auto-detect based on the dependencies
|
|
16618
16622
|
*/
|
|
16619
16623
|
vue?: boolean | OptionsVue;
|
|
16624
|
+
/**
|
|
16625
|
+
* Enable Nuxt support.
|
|
16626
|
+
*
|
|
16627
|
+
* @default auto-detect based on the dependencies
|
|
16628
|
+
*/
|
|
16629
|
+
nuxt?: boolean | OptionsNuxt;
|
|
16620
16630
|
/**
|
|
16621
16631
|
* Enable JSONC support.
|
|
16622
16632
|
*
|
|
@@ -16776,80 +16786,6 @@ type ResolvedOptions<T> = T extends boolean ? never : NonNullable<T>;
|
|
|
16776
16786
|
declare function resolveSubOptions<K extends keyof OptionsConfig>(options: OptionsConfig, key: K): ResolvedOptions<OptionsConfig[K]>;
|
|
16777
16787
|
declare function getOverrides<K extends keyof OptionsConfig>(options: OptionsConfig, key: K): Partial<Linter.RulesRecord & RuleOptions>;
|
|
16778
16788
|
|
|
16779
|
-
declare function astro(options?: OptionsOverrides & OptionsStylistic & OptionsFiles): Promise<TypedFlatConfigItem[]>;
|
|
16780
|
-
|
|
16781
|
-
declare function command(): Promise<TypedFlatConfigItem[]>;
|
|
16782
|
-
|
|
16783
|
-
declare function comments(): Promise<TypedFlatConfigItem[]>;
|
|
16784
|
-
|
|
16785
|
-
declare function disables(): Promise<TypedFlatConfigItem[]>;
|
|
16786
|
-
|
|
16787
|
-
declare function formatters(options?: OptionsFormatters | true, stylistic?: StylisticConfig): Promise<TypedFlatConfigItem[]>;
|
|
16788
|
-
|
|
16789
|
-
declare function ignores(userIgnores?: string[]): Promise<TypedFlatConfigItem[]>;
|
|
16790
|
-
|
|
16791
|
-
declare function imports(options?: OptionsStylistic): Promise<TypedFlatConfigItem[]>;
|
|
16792
|
-
|
|
16793
|
-
declare function javascript(options?: OptionsIsInEditor & OptionsOverrides): Promise<TypedFlatConfigItem[]>;
|
|
16794
|
-
|
|
16795
|
-
declare function jsdoc(options?: OptionsStylistic): Promise<TypedFlatConfigItem[]>;
|
|
16796
|
-
|
|
16797
|
-
declare function jsonc(options?: OptionsFiles & OptionsStylistic & OptionsOverrides): Promise<TypedFlatConfigItem[]>;
|
|
16798
|
-
|
|
16799
|
-
declare function jsx(): Promise<TypedFlatConfigItem[]>;
|
|
16800
|
-
|
|
16801
|
-
declare function markdown(options?: OptionsFiles & OptionsComponentExts & OptionsOverrides): Promise<TypedFlatConfigItem[]>;
|
|
16802
|
-
|
|
16803
|
-
declare function node(): Promise<TypedFlatConfigItem[]>;
|
|
16804
|
-
|
|
16805
|
-
/**
|
|
16806
|
-
* Perfectionist plugin for props and items sorting.
|
|
16807
|
-
*
|
|
16808
|
-
* @see https://github.com/azat-io/eslint-plugin-perfectionist
|
|
16809
|
-
*/
|
|
16810
|
-
declare function perfectionist(): Promise<TypedFlatConfigItem[]>;
|
|
16811
|
-
|
|
16812
|
-
declare function react(options?: OptionsTypeScriptParserOptions & OptionsTypeScriptWithTypes & OptionsOverrides & OptionsFiles): Promise<TypedFlatConfigItem[]>;
|
|
16813
|
-
|
|
16814
|
-
declare function regexp(options?: OptionsRegExp & OptionsOverrides): Promise<TypedFlatConfigItem[]>;
|
|
16815
|
-
|
|
16816
|
-
declare function solid(options?: OptionsHasTypeScript & OptionsOverrides & OptionsFiles & OptionsTypeScriptWithTypes): Promise<TypedFlatConfigItem[]>;
|
|
16817
|
-
|
|
16818
|
-
/**
|
|
16819
|
-
* Sort package.json
|
|
16820
|
-
*
|
|
16821
|
-
* Requires `jsonc` config
|
|
16822
|
-
*/
|
|
16823
|
-
declare function sortPackageJson(): Promise<TypedFlatConfigItem[]>;
|
|
16824
|
-
/**
|
|
16825
|
-
* Sort tsconfig.json
|
|
16826
|
-
*
|
|
16827
|
-
* Requires `jsonc` config
|
|
16828
|
-
*/
|
|
16829
|
-
declare function sortTsconfig(): TypedFlatConfigItem[];
|
|
16830
|
-
|
|
16831
|
-
declare const StylisticConfigDefaults: StylisticConfig;
|
|
16832
|
-
interface StylisticOptions extends StylisticConfig, OptionsOverrides {
|
|
16833
|
-
lessOpinionated?: boolean;
|
|
16834
|
-
}
|
|
16835
|
-
declare function stylistic(options?: StylisticOptions): Promise<TypedFlatConfigItem[]>;
|
|
16836
|
-
|
|
16837
|
-
declare function svelte(options?: OptionsHasTypeScript & OptionsOverrides & OptionsStylistic & OptionsFiles): Promise<TypedFlatConfigItem[]>;
|
|
16838
|
-
|
|
16839
|
-
declare function test(options?: OptionsFiles & OptionsIsInEditor & OptionsOverrides): Promise<TypedFlatConfigItem[]>;
|
|
16840
|
-
|
|
16841
|
-
declare function toml(options?: OptionsOverrides & OptionsStylistic & OptionsFiles): Promise<TypedFlatConfigItem[]>;
|
|
16842
|
-
|
|
16843
|
-
declare function typescript(options?: OptionsFiles & OptionsComponentExts & OptionsOverrides & OptionsTypeScriptWithTypes & OptionsTypeScriptParserOptions & OptionsProjectType): Promise<TypedFlatConfigItem[]>;
|
|
16844
|
-
|
|
16845
|
-
declare function unicorn(options?: OptionsUnicorn): Promise<TypedFlatConfigItem[]>;
|
|
16846
|
-
|
|
16847
|
-
declare function unocss(options?: OptionsUnoCSS): Promise<TypedFlatConfigItem[]>;
|
|
16848
|
-
|
|
16849
|
-
declare function vue(options?: OptionsVue & OptionsHasTypeScript & OptionsOverrides & OptionsStylistic & OptionsFiles): Promise<TypedFlatConfigItem[]>;
|
|
16850
|
-
|
|
16851
|
-
declare function yaml(options?: OptionsOverrides & OptionsStylistic & OptionsFiles): Promise<TypedFlatConfigItem[]>;
|
|
16852
|
-
|
|
16853
16789
|
declare const GLOB_SRC_EXT = "?([cm])[jt]s?(x)";
|
|
16854
16790
|
declare const GLOB_SRC = "**/*.?([cm])[jt]s?(x)";
|
|
16855
16791
|
declare const GLOB_JS = "**/*.?([cm])js";
|
|
@@ -16953,4 +16889,80 @@ declare function ensurePackages(packages: (string | undefined)[]): Promise<void>
|
|
|
16953
16889
|
declare function isInEditorEnv(): boolean;
|
|
16954
16890
|
declare function isInGitHooksOrLintStaged(): boolean;
|
|
16955
16891
|
|
|
16956
|
-
|
|
16892
|
+
declare function jsx(): Promise<TypedFlatConfigItem[]>;
|
|
16893
|
+
|
|
16894
|
+
declare function vue(options?: OptionsVue & OptionsHasTypeScript & OptionsOverrides & OptionsStylistic & OptionsFiles): Promise<TypedFlatConfigItem[]>;
|
|
16895
|
+
|
|
16896
|
+
declare function node(): Promise<TypedFlatConfigItem[]>;
|
|
16897
|
+
|
|
16898
|
+
declare function nuxt({ dirs, features }?: OptionsNuxt): Promise<TypedFlatConfigItem[]>;
|
|
16899
|
+
|
|
16900
|
+
/**
|
|
16901
|
+
* Sort package.json
|
|
16902
|
+
*
|
|
16903
|
+
* Requires `jsonc` config
|
|
16904
|
+
*/
|
|
16905
|
+
declare function sortPackageJson(): Promise<TypedFlatConfigItem[]>;
|
|
16906
|
+
/**
|
|
16907
|
+
* Sort tsconfig.json
|
|
16908
|
+
*
|
|
16909
|
+
* Requires `jsonc` config
|
|
16910
|
+
*/
|
|
16911
|
+
declare function sortTsconfig(): TypedFlatConfigItem[];
|
|
16912
|
+
|
|
16913
|
+
declare function test(options?: OptionsFiles & OptionsIsInEditor & OptionsOverrides): Promise<TypedFlatConfigItem[]>;
|
|
16914
|
+
|
|
16915
|
+
declare function toml(options?: OptionsOverrides & OptionsStylistic & OptionsFiles): Promise<TypedFlatConfigItem[]>;
|
|
16916
|
+
|
|
16917
|
+
declare function yaml(options?: OptionsOverrides & OptionsStylistic & OptionsFiles): Promise<TypedFlatConfigItem[]>;
|
|
16918
|
+
|
|
16919
|
+
declare function astro(options?: OptionsOverrides & OptionsStylistic & OptionsFiles): Promise<TypedFlatConfigItem[]>;
|
|
16920
|
+
|
|
16921
|
+
declare function jsdoc(options?: OptionsStylistic): Promise<TypedFlatConfigItem[]>;
|
|
16922
|
+
|
|
16923
|
+
declare function jsonc(options?: OptionsFiles & OptionsStylistic & OptionsOverrides): Promise<TypedFlatConfigItem[]>;
|
|
16924
|
+
|
|
16925
|
+
declare function react(options?: OptionsTypeScriptParserOptions & OptionsTypeScriptWithTypes & OptionsOverrides & OptionsFiles): Promise<TypedFlatConfigItem[]>;
|
|
16926
|
+
|
|
16927
|
+
declare function solid(options?: OptionsHasTypeScript & OptionsOverrides & OptionsFiles & OptionsTypeScriptWithTypes): Promise<TypedFlatConfigItem[]>;
|
|
16928
|
+
|
|
16929
|
+
declare function regexp(options?: OptionsRegExp & OptionsOverrides): Promise<TypedFlatConfigItem[]>;
|
|
16930
|
+
|
|
16931
|
+
declare function svelte(options?: OptionsHasTypeScript & OptionsOverrides & OptionsStylistic & OptionsFiles): Promise<TypedFlatConfigItem[]>;
|
|
16932
|
+
|
|
16933
|
+
declare function unocss(options?: OptionsUnoCSS): Promise<TypedFlatConfigItem[]>;
|
|
16934
|
+
|
|
16935
|
+
declare function command(): Promise<TypedFlatConfigItem[]>;
|
|
16936
|
+
|
|
16937
|
+
declare function ignores(userIgnores?: string[]): Promise<TypedFlatConfigItem[]>;
|
|
16938
|
+
|
|
16939
|
+
declare function imports(options?: OptionsStylistic): Promise<TypedFlatConfigItem[]>;
|
|
16940
|
+
|
|
16941
|
+
declare function unicorn(options?: OptionsUnicorn): Promise<TypedFlatConfigItem[]>;
|
|
16942
|
+
|
|
16943
|
+
declare function comments(): Promise<TypedFlatConfigItem[]>;
|
|
16944
|
+
|
|
16945
|
+
declare function disables(): Promise<TypedFlatConfigItem[]>;
|
|
16946
|
+
|
|
16947
|
+
declare function markdown(options?: OptionsFiles & OptionsComponentExts & OptionsOverrides): Promise<TypedFlatConfigItem[]>;
|
|
16948
|
+
|
|
16949
|
+
declare const StylisticConfigDefaults: StylisticConfig;
|
|
16950
|
+
interface StylisticOptions extends StylisticConfig, OptionsOverrides {
|
|
16951
|
+
lessOpinionated?: boolean;
|
|
16952
|
+
}
|
|
16953
|
+
declare function stylistic(options?: StylisticOptions): Promise<TypedFlatConfigItem[]>;
|
|
16954
|
+
|
|
16955
|
+
declare function formatters(options?: OptionsFormatters | true, stylistic?: StylisticConfig): Promise<TypedFlatConfigItem[]>;
|
|
16956
|
+
|
|
16957
|
+
declare function javascript(options?: OptionsIsInEditor & OptionsOverrides): Promise<TypedFlatConfigItem[]>;
|
|
16958
|
+
|
|
16959
|
+
declare function typescript(options?: OptionsFiles & OptionsComponentExts & OptionsOverrides & OptionsTypeScriptWithTypes & OptionsTypeScriptParserOptions & OptionsProjectType): Promise<TypedFlatConfigItem[]>;
|
|
16960
|
+
|
|
16961
|
+
/**
|
|
16962
|
+
* Perfectionist plugin for props and items sorting.
|
|
16963
|
+
*
|
|
16964
|
+
* @see https://github.com/azat-io/eslint-plugin-perfectionist
|
|
16965
|
+
*/
|
|
16966
|
+
declare function perfectionist(): TypedFlatConfigItem[];
|
|
16967
|
+
|
|
16968
|
+
export { type Awaitable, type ConfigNames, GLOB_ALL_SRC, GLOB_ASTRO, GLOB_ASTRO_TS, GLOB_CSS, GLOB_EXCLUDE, GLOB_GRAPHQL, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LESS, GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_MARKDOWN_IN_MARKDOWN, GLOB_POSTCSS, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_SVELTE, GLOB_SVG, GLOB_TESTS, GLOB_TOML, GLOB_TS, GLOB_TSX, GLOB_VUE, GLOB_XML, GLOB_YAML, type OptionsComponentExts, type OptionsConfig, type OptionsFiles, type OptionsFormatters, type OptionsHasTypeScript, type OptionsIsInEditor, type OptionsNuxt, type OptionsOverrides, type OptionsProjectType, type OptionsRegExp, type OptionsStylistic, type OptionsTypeScriptParserOptions, type OptionsTypeScriptWithTypes, type OptionsTypescript, type OptionsUnicorn, type OptionsUnoCSS, type OptionsVue, type ResolvedOptions, type Rules, type StylisticConfig, StylisticConfigDefaults, type StylisticOptions, type TypedFlatConfigItem, astro, combine, command, comments, whoj as default, defaultPluginRenaming, disables, ensurePackages, formatters, getOverrides, ignores, imports, interopDefault, isInEditorEnv, isInGitHooksOrLintStaged, isPackageInScope, javascript, jsdoc, jsonc, jsx, markdown, node, nuxt, parserPlain, perfectionist, react, regexp, renamePluginInConfigs, renameRules, resolveSubOptions, solid, sortPackageJson, sortTsconfig, stylistic, svelte, test, toArray, toml, typescript, unicorn, unocss, vue, whoj, yaml };
|