@whoj/eslint-config 2.2.0 → 2.2.2
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 +21 -21
- package/dist/cli.js +42 -56
- package/dist/index.d.ts +290 -283
- package/dist/index.js +709 -757
- package/package.json +3 -3
- package/dist/chunk-3P3JBQLJ.js +0 -5191
- package/dist/chunk-5NT2OOQW.js +0 -29719
- package/dist/chunk-7F5ASJF4.js +0 -1962
- package/dist/chunk-DLJMV7EV.js +0 -626
- package/dist/chunk-G5WGJHBR.js +0 -149
- package/dist/chunk-IDB36RF3.js +0 -353
- package/dist/chunk-IKAXXATW.js +0 -6400
- package/dist/chunk-MKKAXXPL.js +0 -5769
- package/dist/chunk-MKNYKNDN.js +0 -65
- package/dist/chunk-PVCENCBM.js +0 -1053
- package/dist/chunk-QT5XME2Q.js +0 -209134
- package/dist/chunk-THBKBMVU.js +0 -8352
- package/dist/chunk-VSLGWZT6.js +0 -115
- package/dist/chunk-XZGWRL6X.js +0 -1520
- package/dist/dist-MYXPM6TG.js +0 -4953
- package/dist/dist-ZJ2E2ITJ.js +0 -26233
- package/dist/eslint-plugin-react-hooks-BV2CYKDG.js +0 -2559
- package/dist/eslint-plugin-react-refresh-N5P3A37Z.js +0 -272
- package/dist/lib-C6BFP32Q.js +0 -24437
- package/dist/lib-FENTQ4WJ.js +0 -10106
- package/dist/lib-WKUBBNE4.js +0 -26
- package/dist/lib-XQB7MXK6.js +0 -9
- package/dist/sass.node-L3JPZGSW.js +0 -125580
- package/dist/typescript-LG2A6BNW.js +0 -5
package/README.md
CHANGED
|
@@ -45,16 +45,16 @@ 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
|
-
]
|
|
57
|
-
})
|
|
56
|
+
],
|
|
57
|
+
}),
|
|
58
58
|
|
|
59
59
|
// Other flat configs...
|
|
60
60
|
);
|
|
@@ -152,31 +152,31 @@ You can configure each integration individually, for example:
|
|
|
152
152
|
import whoj from '@whoj/eslint-config';
|
|
153
153
|
|
|
154
154
|
export default whoj({
|
|
155
|
-
|
|
156
|
-
type: 'lib',
|
|
155
|
+
vue: true,
|
|
157
156
|
|
|
158
157
|
// Enable stylistic formatting rules
|
|
159
158
|
// stylistic: true,
|
|
160
159
|
|
|
161
|
-
//
|
|
162
|
-
|
|
163
|
-
indent: 2, // 4, or 'tab'
|
|
164
|
-
quotes: 'single' // or 'double'
|
|
165
|
-
},
|
|
166
|
-
|
|
167
|
-
// TypeScript and Vue are autodetected, you can also explicitly enable them:
|
|
168
|
-
typescript: true,
|
|
169
|
-
vue: true,
|
|
160
|
+
// Type of the project. 'lib' for libraries, the default is 'app'
|
|
161
|
+
type: 'lib',
|
|
170
162
|
|
|
163
|
+
yaml: false,
|
|
171
164
|
// Disable jsonc and yaml support
|
|
172
165
|
jsonc: false,
|
|
173
|
-
yaml: false,
|
|
174
166
|
|
|
167
|
+
// TypeScript and Vue are autodetected, you can also explicitly enable them:
|
|
168
|
+
typescript: true,
|
|
175
169
|
// `.eslintignore` is no longer supported in Flat config, use `ignores` instead
|
|
176
170
|
ignores: [
|
|
177
|
-
'**/fixtures'
|
|
171
|
+
'**/fixtures',
|
|
178
172
|
// ...globs
|
|
179
|
-
]
|
|
173
|
+
],
|
|
174
|
+
|
|
175
|
+
// Or customize the stylistic rules
|
|
176
|
+
stylistic: {
|
|
177
|
+
indent: 2, // 4, or 'tab'
|
|
178
|
+
quotes: 'single', // or 'double'
|
|
179
|
+
},
|
|
180
180
|
});
|
|
181
181
|
```
|
|
182
182
|
|
|
@@ -194,12 +194,12 @@ export default whoj(
|
|
|
194
194
|
// From the second arguments they are ESLint Flat Configs
|
|
195
195
|
// you can have multiple configs
|
|
196
196
|
{
|
|
197
|
+
rules: {},
|
|
197
198
|
files: ['**/*.ts'],
|
|
198
|
-
rules: {}
|
|
199
199
|
},
|
|
200
200
|
{
|
|
201
|
-
rules: {}
|
|
202
|
-
}
|
|
201
|
+
rules: {},
|
|
202
|
+
},
|
|
203
203
|
);
|
|
204
204
|
```
|
|
205
205
|
|
package/dist/cli.js
CHANGED
|
@@ -1,12 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
init_esm_shims
|
|
3
|
-
} from "./chunk-MKNYKNDN.js";
|
|
4
|
-
|
|
5
|
-
// src/cli.ts
|
|
6
|
-
init_esm_shims();
|
|
7
|
-
|
|
8
1
|
// src/cli/index.ts
|
|
9
|
-
init_esm_shims();
|
|
10
2
|
import yargs from "yargs";
|
|
11
3
|
import c6 from "picocolors";
|
|
12
4
|
import process5 from "node:process";
|
|
@@ -14,7 +6,6 @@ import * as p5 from "@clack/prompts";
|
|
|
14
6
|
import { hideBin } from "yargs/helpers";
|
|
15
7
|
|
|
16
8
|
// src/cli/run.ts
|
|
17
|
-
init_esm_shims();
|
|
18
9
|
import fs3 from "node:fs";
|
|
19
10
|
import c5 from "picocolors";
|
|
20
11
|
import path4 from "node:path";
|
|
@@ -22,7 +13,6 @@ import process4 from "node:process";
|
|
|
22
13
|
import * as p4 from "@clack/prompts";
|
|
23
14
|
|
|
24
15
|
// src/cli/utils.ts
|
|
25
|
-
init_esm_shims();
|
|
26
16
|
import { execSync } from "node:child_process";
|
|
27
17
|
function isGitClean() {
|
|
28
18
|
try {
|
|
@@ -45,7 +35,6 @@ ${config}
|
|
|
45
35
|
}
|
|
46
36
|
|
|
47
37
|
// src/cli/stages/update-eslint-files.ts
|
|
48
|
-
init_esm_shims();
|
|
49
38
|
import fs from "node:fs";
|
|
50
39
|
import c from "picocolors";
|
|
51
40
|
import path from "node:path";
|
|
@@ -99,7 +88,6 @@ async function updateEslintFiles(result) {
|
|
|
99
88
|
}
|
|
100
89
|
|
|
101
90
|
// src/cli/stages/update-package-json.ts
|
|
102
|
-
init_esm_shims();
|
|
103
91
|
import c3 from "picocolors";
|
|
104
92
|
import path2 from "node:path";
|
|
105
93
|
import fsp2 from "node:fs/promises";
|
|
@@ -107,14 +95,13 @@ import process2 from "node:process";
|
|
|
107
95
|
import * as p2 from "@clack/prompts";
|
|
108
96
|
|
|
109
97
|
// src/cli/constants.ts
|
|
110
|
-
init_esm_shims();
|
|
111
98
|
import c2 from "picocolors";
|
|
112
99
|
|
|
113
100
|
// package.json
|
|
114
101
|
var package_default = {
|
|
115
102
|
name: "@whoj/eslint-config",
|
|
116
103
|
type: "module",
|
|
117
|
-
version: "2.2.
|
|
104
|
+
version: "2.2.2",
|
|
118
105
|
packageManager: "pnpm@10.2.1",
|
|
119
106
|
description: "ESLint config",
|
|
120
107
|
license: "MIT",
|
|
@@ -176,6 +163,7 @@ var package_default = {
|
|
|
176
163
|
"@clack/prompts": "^0.9.1",
|
|
177
164
|
"@eslint-community/eslint-plugin-eslint-comments": "^4.4.1",
|
|
178
165
|
"@eslint/markdown": "^6.2.2",
|
|
166
|
+
"@nuxt/eslint-config": "^1.0.1",
|
|
179
167
|
"@stylistic/eslint-plugin": "^3.0.1",
|
|
180
168
|
"@typescript-eslint/eslint-plugin": "^8.22.0",
|
|
181
169
|
"@typescript-eslint/parser": "^8.22.0",
|
|
@@ -238,7 +226,6 @@ var package_default = {
|
|
|
238
226
|
"prettier-plugin-astro": "^0.14.1",
|
|
239
227
|
"prettier-plugin-slidev": "^1.0.5",
|
|
240
228
|
rimraf: "^6.0.1",
|
|
241
|
-
sass: "^1.84.0",
|
|
242
229
|
"simple-git-hooks": "^2.11.1",
|
|
243
230
|
svelte: "^5.19.9",
|
|
244
231
|
"svelte-eslint-parser": "^0.43.0",
|
|
@@ -322,64 +309,64 @@ var vscodeSettingsString = `
|
|
|
322
309
|
`;
|
|
323
310
|
var frameworkOptions = [
|
|
324
311
|
{
|
|
325
|
-
|
|
326
|
-
|
|
312
|
+
value: "vue",
|
|
313
|
+
label: c2.green("Vue")
|
|
327
314
|
},
|
|
328
315
|
{
|
|
329
|
-
|
|
330
|
-
|
|
316
|
+
value: "react",
|
|
317
|
+
label: c2.cyan("React")
|
|
331
318
|
},
|
|
332
319
|
{
|
|
333
|
-
|
|
334
|
-
|
|
320
|
+
value: "svelte",
|
|
321
|
+
label: c2.red("Svelte")
|
|
335
322
|
},
|
|
336
323
|
{
|
|
337
|
-
|
|
338
|
-
|
|
324
|
+
value: "astro",
|
|
325
|
+
label: c2.magenta("Astro")
|
|
339
326
|
},
|
|
340
327
|
{
|
|
341
|
-
|
|
342
|
-
|
|
328
|
+
value: "solid",
|
|
329
|
+
label: c2.cyan("Solid")
|
|
343
330
|
},
|
|
344
331
|
{
|
|
345
|
-
|
|
346
|
-
|
|
332
|
+
value: "slidev",
|
|
333
|
+
label: c2.blue("Slidev")
|
|
347
334
|
}
|
|
348
335
|
];
|
|
349
336
|
var frameworks = frameworkOptions.map(({ value }) => value);
|
|
350
337
|
var extraOptions = [
|
|
351
338
|
{
|
|
352
|
-
|
|
339
|
+
value: "formatter",
|
|
353
340
|
label: c2.red("Formatter"),
|
|
354
|
-
|
|
341
|
+
hint: "Use external formatters (Prettier and/or dprint) to format files that ESLint cannot handle yet (.css, .html, etc)"
|
|
355
342
|
},
|
|
356
343
|
{
|
|
357
|
-
|
|
358
|
-
|
|
344
|
+
value: "unocss",
|
|
345
|
+
label: c2.cyan("UnoCSS")
|
|
359
346
|
}
|
|
360
347
|
];
|
|
361
348
|
var extra = extraOptions.map(({ value }) => value);
|
|
362
349
|
var dependenciesMap = {
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
"
|
|
366
|
-
],
|
|
367
|
-
react: [
|
|
368
|
-
"@eslint-react/eslint-plugin",
|
|
369
|
-
"eslint-plugin-react-hooks",
|
|
370
|
-
"eslint-plugin-react-refresh"
|
|
350
|
+
vue: [],
|
|
351
|
+
solid: [
|
|
352
|
+
"eslint-plugin-solid"
|
|
371
353
|
],
|
|
372
354
|
slidev: [
|
|
373
355
|
"prettier-plugin-slidev"
|
|
374
356
|
],
|
|
375
|
-
|
|
376
|
-
"eslint-plugin-
|
|
357
|
+
astro: [
|
|
358
|
+
"eslint-plugin-astro",
|
|
359
|
+
"astro-eslint-parser"
|
|
377
360
|
],
|
|
378
361
|
svelte: [
|
|
379
362
|
"eslint-plugin-svelte",
|
|
380
363
|
"svelte-eslint-parser"
|
|
381
364
|
],
|
|
382
|
-
|
|
365
|
+
react: [
|
|
366
|
+
"@eslint-react/eslint-plugin",
|
|
367
|
+
"eslint-plugin-react-hooks",
|
|
368
|
+
"eslint-plugin-react-refresh"
|
|
369
|
+
]
|
|
383
370
|
};
|
|
384
371
|
|
|
385
372
|
// src/cli/stages/update-package-json.ts
|
|
@@ -396,21 +383,21 @@ async function updatePackageJson(result) {
|
|
|
396
383
|
if (result.extra.length) {
|
|
397
384
|
result.extra.forEach((item) => {
|
|
398
385
|
switch (item) {
|
|
399
|
-
case "
|
|
386
|
+
case "unocss":
|
|
400
387
|
[
|
|
401
|
-
"eslint-plugin
|
|
402
|
-
result.frameworks.includes("astro") ? "prettier-plugin-astro" : null
|
|
388
|
+
"@unocss/eslint-plugin"
|
|
403
389
|
].forEach((f) => {
|
|
404
|
-
if (!f)
|
|
405
|
-
return;
|
|
406
390
|
pkg.devDependencies[f] = package_default.devDependencies[f];
|
|
407
391
|
addedPackages.push(f);
|
|
408
392
|
});
|
|
409
393
|
break;
|
|
410
|
-
case "
|
|
394
|
+
case "formatter":
|
|
411
395
|
[
|
|
412
|
-
"
|
|
396
|
+
"eslint-plugin-format",
|
|
397
|
+
result.frameworks.includes("astro") ? "prettier-plugin-astro" : null
|
|
413
398
|
].forEach((f) => {
|
|
399
|
+
if (!f)
|
|
400
|
+
return;
|
|
414
401
|
pkg.devDependencies[f] = package_default.devDependencies[f];
|
|
415
402
|
addedPackages.push(f);
|
|
416
403
|
});
|
|
@@ -434,7 +421,6 @@ async function updatePackageJson(result) {
|
|
|
434
421
|
}
|
|
435
422
|
|
|
436
423
|
// src/cli/stages/update-vscode-settings.ts
|
|
437
|
-
init_esm_shims();
|
|
438
424
|
import fs2 from "node:fs";
|
|
439
425
|
import c4 from "picocolors";
|
|
440
426
|
import path3 from "node:path";
|
|
@@ -546,17 +532,17 @@ var instance = yargs(hideBin(process5.argv)).scriptName("@whoj/eslint-config").u
|
|
|
546
532
|
"Run the initialization or migration",
|
|
547
533
|
(args) => args.option("yes", {
|
|
548
534
|
alias: "y",
|
|
549
|
-
|
|
550
|
-
|
|
535
|
+
type: "boolean",
|
|
536
|
+
description: "Skip prompts and use default values"
|
|
551
537
|
}).option("template", {
|
|
552
538
|
alias: "t",
|
|
553
|
-
|
|
554
|
-
|
|
539
|
+
type: "string",
|
|
540
|
+
description: "Use the framework template for optimal customization: vue / react / svelte / astro"
|
|
555
541
|
}).option("extra", {
|
|
556
542
|
alias: "e",
|
|
557
543
|
array: true,
|
|
558
|
-
|
|
559
|
-
|
|
544
|
+
type: "string",
|
|
545
|
+
description: "Use the extra utils: formatter / perfectionist / unocss"
|
|
560
546
|
}).help(),
|
|
561
547
|
async (args) => {
|
|
562
548
|
header();
|