@tb-dev/eslint-config 6.7.2 → 7.0.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/dist/index.d.ts +0 -15
- package/dist/index.js +2 -188
- package/package.json +11 -27
- package/dist/index.cjs +0 -1087
package/dist/index.d.ts
CHANGED
|
@@ -24,11 +24,6 @@ declare interface ConfigOptions {
|
|
|
24
24
|
overrides?: {
|
|
25
25
|
javascript?: Rules;
|
|
26
26
|
perfectionist?: Rules;
|
|
27
|
-
react?: Rules;
|
|
28
|
-
reactCompiler?: Rules;
|
|
29
|
-
reactHooks?: Rules;
|
|
30
|
-
svelte?: Rules;
|
|
31
|
-
tailwind?: Rules;
|
|
32
27
|
typescript?: Rules;
|
|
33
28
|
unicorn?: Rules;
|
|
34
29
|
vue?: Rules;
|
|
@@ -56,16 +51,6 @@ export declare function defineConfig(options: ConfigOptions): Promise<Partial<Co
|
|
|
56
51
|
declare interface FeaturesObject {
|
|
57
52
|
/** @default true */
|
|
58
53
|
perfectionist?: boolean;
|
|
59
|
-
/** @default false */
|
|
60
|
-
react?: boolean;
|
|
61
|
-
/** @default false */
|
|
62
|
-
reactCompiler?: boolean;
|
|
63
|
-
/** @default false */
|
|
64
|
-
reactHooks?: boolean;
|
|
65
|
-
/** @default false */
|
|
66
|
-
svelte?: boolean;
|
|
67
|
-
/** @default false */
|
|
68
|
-
tailwind?: boolean;
|
|
69
54
|
/** @default true */
|
|
70
55
|
unicorn?: boolean;
|
|
71
56
|
/** @default false */
|
package/dist/index.js
CHANGED
|
@@ -5,7 +5,6 @@ var Glob = /* @__PURE__ */ ((Glob2) => {
|
|
|
5
5
|
Glob2["All"] = "**/*.?([cm])[jt]s?(x)";
|
|
6
6
|
Glob2["Html"] = "**/*.html";
|
|
7
7
|
Glob2["Javascript"] = "**/*.?([cm])js?(x)";
|
|
8
|
-
Glob2["Svelte"] = "**/*.svelte";
|
|
9
8
|
Glob2["Typescript"] = "**/*.?([cm])ts?(x)";
|
|
10
9
|
Glob2["Vue"] = "**/*.vue";
|
|
11
10
|
return Glob2;
|
|
@@ -17,7 +16,6 @@ var GlobIgnore = /* @__PURE__ */ ((GlobIgnore2) => {
|
|
|
17
16
|
GlobIgnore2["Log"] = "**/log?(s)";
|
|
18
17
|
GlobIgnore2["NodeModules"] = "**/node_modules";
|
|
19
18
|
GlobIgnore2["Out"] = "**/out";
|
|
20
|
-
GlobIgnore2["SvelteKit"] = "**/.svelte-kit";
|
|
21
19
|
GlobIgnore2["Target"] = "**/target";
|
|
22
20
|
GlobIgnore2["Temp"] = "**/?(.)temp";
|
|
23
21
|
return GlobIgnore2;
|
|
@@ -36,16 +34,6 @@ function isEnabled(config, feature) {
|
|
|
36
34
|
switch (feature) {
|
|
37
35
|
case "perfectionist":
|
|
38
36
|
return config?.perfectionist ?? true;
|
|
39
|
-
case "react":
|
|
40
|
-
return config?.react ?? false;
|
|
41
|
-
case "reactCompiler":
|
|
42
|
-
return config?.reactCompiler ?? config?.react ?? false;
|
|
43
|
-
case "reactHooks":
|
|
44
|
-
return config?.reactHooks ?? config?.react ?? false;
|
|
45
|
-
case "svelte":
|
|
46
|
-
return config?.svelte ?? false;
|
|
47
|
-
case "tailwind":
|
|
48
|
-
return config?.tailwind ?? false;
|
|
49
37
|
case "unicorn":
|
|
50
38
|
return config?.unicorn ?? true;
|
|
51
39
|
case "vue":
|
|
@@ -291,118 +279,6 @@ async function vue(options) {
|
|
|
291
279
|
];
|
|
292
280
|
}
|
|
293
281
|
|
|
294
|
-
async function react(options) {
|
|
295
|
-
if (!isEnabled(options.features, "react")) return [];
|
|
296
|
-
const plugin = await interopDefault(import('eslint-plugin-react'));
|
|
297
|
-
return [
|
|
298
|
-
{
|
|
299
|
-
plugins: { react: plugin },
|
|
300
|
-
rules: {
|
|
301
|
-
"react/button-has-type": "error",
|
|
302
|
-
"react/function-component-definition": "off",
|
|
303
|
-
"react/hook-use-state": ["error", { allowDestructuredState: true }],
|
|
304
|
-
"react/jsx-boolean-value": ["error", "never", { assumeUndefinedIsFalse: true }],
|
|
305
|
-
"react/jsx-key": [
|
|
306
|
-
"error",
|
|
307
|
-
{
|
|
308
|
-
checkFragmentShorthand: true,
|
|
309
|
-
checkKeyMustBeforeSpread: false,
|
|
310
|
-
warnOnDuplicates: true
|
|
311
|
-
}
|
|
312
|
-
],
|
|
313
|
-
"react/jsx-no-script-url": "error",
|
|
314
|
-
"react/jsx-no-useless-fragment": "error",
|
|
315
|
-
"react/jsx-pascal-case": [
|
|
316
|
-
"error",
|
|
317
|
-
{
|
|
318
|
-
allowAllCaps: false,
|
|
319
|
-
allowNamespace: true,
|
|
320
|
-
allowLeadingUnderscore: false
|
|
321
|
-
}
|
|
322
|
-
],
|
|
323
|
-
"react/jsx-props-no-spread-multi": "error",
|
|
324
|
-
"react/no-access-state-in-setstate": "error",
|
|
325
|
-
"react/no-array-index-key": "error",
|
|
326
|
-
"react/no-danger": "error",
|
|
327
|
-
"react/no-deprecated": "error",
|
|
328
|
-
"react/no-direct-mutation-state": "error",
|
|
329
|
-
"react/no-find-dom-node": "error",
|
|
330
|
-
"react/no-is-mounted": "error",
|
|
331
|
-
"react/no-render-return-value": "error",
|
|
332
|
-
"react/no-unsafe": "error",
|
|
333
|
-
...options.overrides?.react
|
|
334
|
-
}
|
|
335
|
-
},
|
|
336
|
-
{
|
|
337
|
-
settings: {
|
|
338
|
-
react: {
|
|
339
|
-
version: options.reactVersion ?? "19.0"
|
|
340
|
-
}
|
|
341
|
-
}
|
|
342
|
-
}
|
|
343
|
-
];
|
|
344
|
-
}
|
|
345
|
-
|
|
346
|
-
async function svelte(options) {
|
|
347
|
-
if (!isEnabled(options.features, "svelte")) return [];
|
|
348
|
-
const [sveltePlugin, svelteParser, tsParser] = await Promise.all([
|
|
349
|
-
interopDefault(import('eslint-plugin-svelte')),
|
|
350
|
-
interopDefault(import('svelte-eslint-parser')),
|
|
351
|
-
interopDefault(import('@typescript-eslint/parser'))
|
|
352
|
-
]);
|
|
353
|
-
const rules = {
|
|
354
|
-
"svelte/block-lang": ["error", { script: "ts" }],
|
|
355
|
-
"svelte/button-has-type": "error",
|
|
356
|
-
"svelte/infinite-reactive-loop": "error",
|
|
357
|
-
"svelte/no-at-debug-tags": "off",
|
|
358
|
-
"svelte/no-at-html-tags": "error",
|
|
359
|
-
"svelte/no-dom-manipulating": "error",
|
|
360
|
-
"svelte/no-dupe-else-if-blocks": "error",
|
|
361
|
-
"svelte/no-dupe-on-directives": "error",
|
|
362
|
-
"svelte/no-dupe-style-properties": "error",
|
|
363
|
-
"svelte/no-dupe-use-directives": "error",
|
|
364
|
-
"svelte/no-export-load-in-svelte-module-in-kit-pages": "error",
|
|
365
|
-
"svelte/no-ignored-unsubscribe": "error",
|
|
366
|
-
"svelte/no-immutable-reactive-statements": "error",
|
|
367
|
-
"svelte/no-inline-styles": "error",
|
|
368
|
-
"svelte/no-inspect": "off",
|
|
369
|
-
"svelte/no-not-function-handler": "error",
|
|
370
|
-
"svelte/no-object-in-text-mustaches": "error",
|
|
371
|
-
"svelte/no-reactive-functions": "error",
|
|
372
|
-
"svelte/no-reactive-reassign": "error",
|
|
373
|
-
"svelte/no-shorthand-style-property-overrides": "error",
|
|
374
|
-
"svelte/no-store-async": "error",
|
|
375
|
-
"svelte/no-target-blank": "error",
|
|
376
|
-
"svelte/no-unknown-style-directive-property": "error",
|
|
377
|
-
"svelte/no-unnecessary-state-wrap": "error",
|
|
378
|
-
"svelte/no-unused-props": "error",
|
|
379
|
-
"svelte/no-unused-svelte-ignore": "error",
|
|
380
|
-
"svelte/no-useless-mustaches": "error",
|
|
381
|
-
"svelte/require-each-key": "error",
|
|
382
|
-
"svelte/require-store-reactive-access": "error",
|
|
383
|
-
"svelte/require-stores-init": "error",
|
|
384
|
-
"svelte/valid-each-key": "error",
|
|
385
|
-
...options.overrides?.svelte
|
|
386
|
-
};
|
|
387
|
-
return [
|
|
388
|
-
{
|
|
389
|
-
plugins: { svelte: sveltePlugin },
|
|
390
|
-
rules
|
|
391
|
-
},
|
|
392
|
-
{
|
|
393
|
-
files: [Glob.Svelte],
|
|
394
|
-
languageOptions: {
|
|
395
|
-
parser: svelteParser,
|
|
396
|
-
parserOptions: {
|
|
397
|
-
parser: tsParser,
|
|
398
|
-
project: options.project,
|
|
399
|
-
extraFileExtensions: [".svelte"]
|
|
400
|
-
}
|
|
401
|
-
}
|
|
402
|
-
}
|
|
403
|
-
];
|
|
404
|
-
}
|
|
405
|
-
|
|
406
282
|
async function unicorn(options) {
|
|
407
283
|
if (!isEnabled(options.features, "unicorn")) return {};
|
|
408
284
|
const plugin = await interopDefault(import('eslint-plugin-unicorn'));
|
|
@@ -458,39 +334,16 @@ async function unicorn(options) {
|
|
|
458
334
|
};
|
|
459
335
|
}
|
|
460
336
|
|
|
461
|
-
async function tailwind(options) {
|
|
462
|
-
if (!isEnabled(options.features, "tailwind")) return {};
|
|
463
|
-
const plugin = await interopDefault(import('eslint-plugin-tailwindcss'));
|
|
464
|
-
const callees = ["classnames", "clsx", "cn", "ctl", "cva", "tv"];
|
|
465
|
-
const rules = {
|
|
466
|
-
"tailwindcss/enforces-shorthand": ["error", { callees }],
|
|
467
|
-
"tailwindcss/no-contradicting-classname": ["error", { callees }],
|
|
468
|
-
...options.overrides?.tailwind
|
|
469
|
-
};
|
|
470
|
-
return {
|
|
471
|
-
plugins: { tailwindcss: plugin },
|
|
472
|
-
rules
|
|
473
|
-
};
|
|
474
|
-
}
|
|
475
|
-
|
|
476
337
|
function javascript(options) {
|
|
477
338
|
const files = [Glob.All];
|
|
478
339
|
if (isEnabled(options.features, "vue")) {
|
|
479
340
|
files.push(Glob.Vue);
|
|
480
341
|
}
|
|
481
|
-
if (isEnabled(options.features, "svelte")) {
|
|
482
|
-
files.push(Glob.Svelte);
|
|
483
|
-
}
|
|
484
342
|
return {
|
|
485
343
|
files,
|
|
486
344
|
languageOptions: {
|
|
487
345
|
ecmaVersion: "latest",
|
|
488
346
|
sourceType: "module",
|
|
489
|
-
parserOptions: {
|
|
490
|
-
ecmaFeatures: {
|
|
491
|
-
jsx: isEnabled(options.features, "react")
|
|
492
|
-
}
|
|
493
|
-
},
|
|
494
347
|
globals: {
|
|
495
348
|
...globals.browser,
|
|
496
349
|
...globals.es2021,
|
|
@@ -645,16 +498,10 @@ async function typescript(options) {
|
|
|
645
498
|
if (isEnabled(options.features, "vue")) {
|
|
646
499
|
files.push(Glob.Vue);
|
|
647
500
|
}
|
|
648
|
-
if (isEnabled(options.features, "svelte")) {
|
|
649
|
-
files.push(Glob.Svelte);
|
|
650
|
-
}
|
|
651
501
|
const extraFileExtensions = [];
|
|
652
502
|
if (isEnabled(options.features, "vue")) {
|
|
653
503
|
extraFileExtensions.push(".vue");
|
|
654
504
|
}
|
|
655
|
-
if (isEnabled(options.features, "svelte")) {
|
|
656
|
-
extraFileExtensions.push(".svelte");
|
|
657
|
-
}
|
|
658
505
|
const rules = {
|
|
659
506
|
"@typescript-eslint/adjacent-overload-signatures": "error",
|
|
660
507
|
"no-array-constructor": "off",
|
|
@@ -917,17 +764,14 @@ async function typescript(options) {
|
|
|
917
764
|
parserOptions: {
|
|
918
765
|
project: options.project,
|
|
919
766
|
tsconfigRootDir: process.cwd(),
|
|
920
|
-
extraFileExtensions
|
|
921
|
-
ecmaFeatures: {
|
|
922
|
-
jsx: isEnabled(options.features, "react")
|
|
923
|
-
}
|
|
767
|
+
extraFileExtensions
|
|
924
768
|
}
|
|
925
769
|
},
|
|
926
770
|
plugins: { "@typescript-eslint": tsPlugin },
|
|
927
771
|
rules
|
|
928
772
|
},
|
|
929
773
|
{
|
|
930
|
-
files: options.moduleBoundaryTypesFiles ?? ["*.ts"
|
|
774
|
+
files: options.moduleBoundaryTypesFiles ?? ["*.ts"],
|
|
931
775
|
rules: {
|
|
932
776
|
"@typescript-eslint/explicit-module-boundary-types": "error"
|
|
933
777
|
}
|
|
@@ -935,19 +779,6 @@ async function typescript(options) {
|
|
|
935
779
|
];
|
|
936
780
|
}
|
|
937
781
|
|
|
938
|
-
async function reactHooks(options) {
|
|
939
|
-
if (!isEnabled(options.features, "reactHooks")) return {};
|
|
940
|
-
const plugin = await interopDefault(import('eslint-plugin-react-hooks'));
|
|
941
|
-
return {
|
|
942
|
-
plugins: { "react-hooks": plugin },
|
|
943
|
-
rules: {
|
|
944
|
-
"react-hooks/rules-of-hooks": "error",
|
|
945
|
-
"react-hooks/exhaustive-deps": "error",
|
|
946
|
-
...options.overrides?.reactHooks
|
|
947
|
-
}
|
|
948
|
-
};
|
|
949
|
-
}
|
|
950
|
-
|
|
951
782
|
async function perfectionist(options) {
|
|
952
783
|
if (!isEnabled(options.features, "perfectionist")) return {};
|
|
953
784
|
const plugin = await interopDefault(import('eslint-plugin-perfectionist'));
|
|
@@ -1048,18 +879,6 @@ async function perfectionist(options) {
|
|
|
1048
879
|
};
|
|
1049
880
|
}
|
|
1050
881
|
|
|
1051
|
-
async function reactCompiler(options) {
|
|
1052
|
-
if (!isEnabled(options.features, "reactCompiler")) return {};
|
|
1053
|
-
const plugin = await interopDefault(import('eslint-plugin-react-compiler'));
|
|
1054
|
-
return {
|
|
1055
|
-
plugins: { "react-compiler": plugin },
|
|
1056
|
-
rules: {
|
|
1057
|
-
"react-compiler/react-compiler": "error",
|
|
1058
|
-
...options.overrides?.reactCompiler
|
|
1059
|
-
}
|
|
1060
|
-
};
|
|
1061
|
-
}
|
|
1062
|
-
|
|
1063
882
|
async function defineConfig(options) {
|
|
1064
883
|
const ignores = {
|
|
1065
884
|
ignores: [...getIgnores(), ...options.ignores ?? []]
|
|
@@ -1068,13 +887,8 @@ async function defineConfig(options) {
|
|
|
1068
887
|
javascript(options),
|
|
1069
888
|
...await typescript(options),
|
|
1070
889
|
...await vue(options),
|
|
1071
|
-
...await svelte(options),
|
|
1072
|
-
...await react(options),
|
|
1073
|
-
reactHooks(options),
|
|
1074
|
-
reactCompiler(options),
|
|
1075
890
|
perfectionist(options),
|
|
1076
891
|
unicorn(options),
|
|
1077
|
-
tailwind(options),
|
|
1078
892
|
ignores
|
|
1079
893
|
]);
|
|
1080
894
|
return objects;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tb-dev/eslint-config",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "7.0.1",
|
|
4
4
|
"description": "ESLint config",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -18,60 +18,44 @@
|
|
|
18
18
|
"eslint",
|
|
19
19
|
"eslint-config",
|
|
20
20
|
"typescript",
|
|
21
|
-
"react",
|
|
22
|
-
"svelte",
|
|
23
21
|
"vue"
|
|
24
22
|
],
|
|
25
23
|
"dependencies": {
|
|
26
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
27
|
-
"@typescript-eslint/parser": "^8.
|
|
28
|
-
"eslint-plugin-perfectionist": "^4.
|
|
29
|
-
"eslint-plugin-react": "^7.37.4",
|
|
30
|
-
"eslint-plugin-react-compiler": "=19.0.0-beta-3229e95-20250315",
|
|
31
|
-
"eslint-plugin-react-hooks": "^5.2.0",
|
|
32
|
-
"eslint-plugin-svelte": "^3.3.3",
|
|
33
|
-
"eslint-plugin-tailwindcss": "^3.18.0",
|
|
24
|
+
"@typescript-eslint/eslint-plugin": "^8.30.1",
|
|
25
|
+
"@typescript-eslint/parser": "^8.30.1",
|
|
26
|
+
"eslint-plugin-perfectionist": "^4.11.0",
|
|
34
27
|
"eslint-plugin-unicorn": "^58.0.0",
|
|
35
28
|
"eslint-plugin-vue": "^10.0.0",
|
|
36
29
|
"globals": "^16.0.0",
|
|
37
|
-
"
|
|
38
|
-
"svelte-eslint-parser": "^1.1.1",
|
|
39
|
-
"vue-eslint-parser": "^10.1.1"
|
|
30
|
+
"vue-eslint-parser": "^10.1.3"
|
|
40
31
|
},
|
|
41
32
|
"devDependencies": {
|
|
42
|
-
"@types/node": "^22.
|
|
43
|
-
"eslint": "^9.
|
|
33
|
+
"@types/node": "^22.14.1",
|
|
34
|
+
"eslint": "^9.25.0",
|
|
44
35
|
"prettier": "^3.5.3",
|
|
45
36
|
"tslib": "^2.8.1",
|
|
46
|
-
"typescript": "^5.8.
|
|
47
|
-
"vite": "^6.2
|
|
37
|
+
"typescript": "^5.8.3",
|
|
38
|
+
"vite": "^6.3.2",
|
|
48
39
|
"vite-plugin-dts": "^4.5.3"
|
|
49
40
|
},
|
|
50
|
-
"peerDependencies": {
|
|
51
|
-
"eslint": "^9.23.0",
|
|
52
|
-
"typescript": "^5.8.2"
|
|
53
|
-
},
|
|
54
41
|
"engines": {
|
|
55
42
|
"node": ">=22"
|
|
56
43
|
},
|
|
57
44
|
"files": [
|
|
58
45
|
"dist/**/*"
|
|
59
46
|
],
|
|
60
|
-
"main": "./dist/index.
|
|
61
|
-
"module": "./dist/index.js",
|
|
47
|
+
"main": "./dist/index.js",
|
|
62
48
|
"types": "./dist/index.d.ts",
|
|
63
49
|
"exports": {
|
|
64
50
|
".": {
|
|
65
51
|
"types": "./dist/index.d.ts",
|
|
66
|
-
"import": "./dist/index.js"
|
|
67
|
-
"require": "./dist/index.cjs"
|
|
52
|
+
"import": "./dist/index.js"
|
|
68
53
|
}
|
|
69
54
|
},
|
|
70
55
|
"scripts": {
|
|
71
56
|
"build": "vite build",
|
|
72
57
|
"format": "prettier . --write",
|
|
73
58
|
"lint": "eslint . --config eslint.config.js",
|
|
74
|
-
"lint-fix": "eslint . --config eslint.config.js --fix",
|
|
75
59
|
"release": "pnpm run build && pnpm publish",
|
|
76
60
|
"type-check": "tsc --noEmit",
|
|
77
61
|
"update": "miho update major -t"
|