@whoj/eslint-config 2.1.0 → 2.2.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 +18 -18
- package/bin/index.js +1 -1
- package/dist/cli.js +118 -113
- package/dist/index.d.ts +90 -78
- package/dist/index.js +1594 -1534
- package/package.json +7 -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.
|
|
117
|
+
version: "2.2.0",
|
|
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",
|
|
@@ -54,12 +148,16 @@ var package_default = {
|
|
|
54
148
|
prepare: "simple-git-hooks"
|
|
55
149
|
},
|
|
56
150
|
peerDependencies: {
|
|
151
|
+
"@nuxt/eslint-config": "^1.0.1",
|
|
57
152
|
"@prettier/plugin-xml": "^3.4.1",
|
|
58
153
|
"@unocss/eslint-plugin": ">=0.50.0",
|
|
59
154
|
eslint: "^9.19.0",
|
|
60
155
|
"eslint-plugin-format": ">=0.1.0"
|
|
61
156
|
},
|
|
62
157
|
peerDependenciesMeta: {
|
|
158
|
+
"@nuxt/eslint-config": {
|
|
159
|
+
optional: true
|
|
160
|
+
},
|
|
63
161
|
"@prettier/plugin-xml": {
|
|
64
162
|
optional: true
|
|
65
163
|
},
|
|
@@ -224,27 +322,27 @@ var vscodeSettingsString = `
|
|
|
224
322
|
`;
|
|
225
323
|
var frameworkOptions = [
|
|
226
324
|
{
|
|
227
|
-
label:
|
|
325
|
+
label: c2.green("Vue"),
|
|
228
326
|
value: "vue"
|
|
229
327
|
},
|
|
230
328
|
{
|
|
231
|
-
label:
|
|
329
|
+
label: c2.cyan("React"),
|
|
232
330
|
value: "react"
|
|
233
331
|
},
|
|
234
332
|
{
|
|
235
|
-
label:
|
|
333
|
+
label: c2.red("Svelte"),
|
|
236
334
|
value: "svelte"
|
|
237
335
|
},
|
|
238
336
|
{
|
|
239
|
-
label:
|
|
337
|
+
label: c2.magenta("Astro"),
|
|
240
338
|
value: "astro"
|
|
241
339
|
},
|
|
242
340
|
{
|
|
243
|
-
label:
|
|
341
|
+
label: c2.cyan("Solid"),
|
|
244
342
|
value: "solid"
|
|
245
343
|
},
|
|
246
344
|
{
|
|
247
|
-
label:
|
|
345
|
+
label: c2.blue("Slidev"),
|
|
248
346
|
value: "slidev"
|
|
249
347
|
}
|
|
250
348
|
];
|
|
@@ -252,11 +350,11 @@ var frameworks = frameworkOptions.map(({ value }) => value);
|
|
|
252
350
|
var extraOptions = [
|
|
253
351
|
{
|
|
254
352
|
hint: "Use external formatters (Prettier and/or dprint) to format files that ESLint cannot handle yet (.css, .html, etc)",
|
|
255
|
-
label:
|
|
353
|
+
label: c2.red("Formatter"),
|
|
256
354
|
value: "formatter"
|
|
257
355
|
},
|
|
258
356
|
{
|
|
259
|
-
label:
|
|
357
|
+
label: c2.cyan("UnoCSS"),
|
|
260
358
|
value: "unocss"
|
|
261
359
|
}
|
|
262
360
|
];
|
|
@@ -284,100 +382,7 @@ var dependenciesMap = {
|
|
|
284
382
|
vue: []
|
|
285
383
|
};
|
|
286
384
|
|
|
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
385
|
// 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
386
|
async function updatePackageJson(result) {
|
|
382
387
|
const cwd = process2.cwd();
|
|
383
388
|
const pathPackageJSON = path2.join(cwd, "package.json");
|
|
@@ -425,17 +430,17 @@ async function updatePackageJson(result) {
|
|
|
425
430
|
if (addedPackages.length)
|
|
426
431
|
p2.note(`${c3.dim(addedPackages.join(", "))}`, "Added packages");
|
|
427
432
|
await fsp2.writeFile(pathPackageJSON, JSON.stringify(pkg, null, 2));
|
|
428
|
-
p2.log.success(c3.green(
|
|
433
|
+
p2.log.success(c3.green("Changes wrote to package.json"));
|
|
429
434
|
}
|
|
430
435
|
|
|
431
436
|
// src/cli/stages/update-vscode-settings.ts
|
|
432
437
|
init_esm_shims();
|
|
433
438
|
import fs2 from "node:fs";
|
|
434
|
-
import
|
|
439
|
+
import c4 from "picocolors";
|
|
435
440
|
import path3 from "node:path";
|
|
441
|
+
import fsp3 from "node:fs/promises";
|
|
436
442
|
import process3 from "node:process";
|
|
437
443
|
import * as p3 from "@clack/prompts";
|
|
438
|
-
import c4 from "picocolors";
|
|
439
444
|
async function updateVscodeSettings(result) {
|
|
440
445
|
const cwd = process3.cwd();
|
|
441
446
|
if (!result.updateVscodeSettings)
|
|
@@ -447,7 +452,7 @@ async function updateVscodeSettings(result) {
|
|
|
447
452
|
if (!fs2.existsSync(settingsPath)) {
|
|
448
453
|
await fsp3.writeFile(settingsPath, `{${vscodeSettingsString}}
|
|
449
454
|
`, "utf-8");
|
|
450
|
-
p3.log.success(c4.green(
|
|
455
|
+
p3.log.success(c4.green("Created .vscode/settings.json"));
|
|
451
456
|
} else {
|
|
452
457
|
let settingsContent = await fsp3.readFile(settingsPath, "utf8");
|
|
453
458
|
settingsContent = settingsContent.trim().replace(/\s*\}$/, "");
|
|
@@ -455,7 +460,7 @@ async function updateVscodeSettings(result) {
|
|
|
455
460
|
settingsContent += `${vscodeSettingsString}}
|
|
456
461
|
`;
|
|
457
462
|
await fsp3.writeFile(settingsPath, settingsContent, "utf-8");
|
|
458
|
-
p3.log.success(c4.green(
|
|
463
|
+
p3.log.success(c4.green("Updated .vscode/settings.json"));
|
|
459
464
|
}
|
|
460
465
|
}
|
|
461
466
|
|
|
@@ -465,7 +470,7 @@ async function run(options = {}) {
|
|
|
465
470
|
const argTemplate = options.frameworks?.map((m) => m.trim());
|
|
466
471
|
const argExtra = options.extra?.map((m) => m.trim());
|
|
467
472
|
if (fs3.existsSync(path4.join(process4.cwd(), "eslint.config.js"))) {
|
|
468
|
-
p4.log.warn(c5.yellow(
|
|
473
|
+
p4.log.warn(c5.yellow("eslint.config.js already exists, migration wizard exited."));
|
|
469
474
|
return process4.exit(1);
|
|
470
475
|
}
|
|
471
476
|
let result = {
|
|
@@ -526,7 +531,7 @@ async function run(options = {}) {
|
|
|
526
531
|
await updatePackageJson(result);
|
|
527
532
|
await updateEslintFiles(result);
|
|
528
533
|
await updateVscodeSettings(result);
|
|
529
|
-
p4.log.success(c5.green(
|
|
534
|
+
p4.log.success(c5.green("Setup completed"));
|
|
530
535
|
p4.outro(`Now you can update the dependencies by run ${c5.blue("pnpm install")} and run ${c5.blue("eslint . --fix")}
|
|
531
536
|
`);
|
|
532
537
|
}
|
|
@@ -534,7 +539,7 @@ async function run(options = {}) {
|
|
|
534
539
|
// src/cli/index.ts
|
|
535
540
|
function header() {
|
|
536
541
|
console.log("\n");
|
|
537
|
-
p5.intro(`${c6.green(
|
|
542
|
+
p5.intro(`${c6.green("@whoj/eslint-config ")}${c6.dim(`v${package_default.version}`)}`);
|
|
538
543
|
}
|
|
539
544
|
var instance = yargs(hideBin(process5.argv)).scriptName("@whoj/eslint-config").usage("").command(
|
|
540
545
|
"*",
|
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 };
|