@sxzz/eslint-config 7.6.0 → 7.7.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 +7 -0
- package/dist/index.d.mts +10 -7
- package/dist/index.mjs +16 -4
- package/package.json +19 -20
package/README.md
CHANGED
|
@@ -26,6 +26,13 @@ npm i -D @sxzz/eslint-config
|
|
|
26
26
|
|
|
27
27
|
Require Node.js >= 20.0.0, and ESLint >= 9.5.0.
|
|
28
28
|
|
|
29
|
+
### Optional Dependencies
|
|
30
|
+
|
|
31
|
+
| Feature | Optional Dependency |
|
|
32
|
+
| ------- | ------------------- |
|
|
33
|
+
| Astro | `eslint-plugin-astro` |
|
|
34
|
+
| UnoCSS | `@unocss/eslint-plugin` |
|
|
35
|
+
|
|
29
36
|
## Usage
|
|
30
37
|
|
|
31
38
|
```js
|
package/dist/index.d.mts
CHANGED
|
@@ -3586,7 +3586,7 @@ interface Rules {
|
|
|
3586
3586
|
*/
|
|
3587
3587
|
"quotes"?: Linter.RuleEntry<Quotes>;
|
|
3588
3588
|
/**
|
|
3589
|
-
* Enforce the
|
|
3589
|
+
* Enforce the use of the radix argument when using `parseInt()`
|
|
3590
3590
|
* @see https://eslint.org/docs/latest/rules/radix
|
|
3591
3591
|
*/
|
|
3592
3592
|
"radix"?: Linter.RuleEntry<Radix>;
|
|
@@ -7221,6 +7221,7 @@ type AntfuConsistentListNewline = [] | [{
|
|
|
7221
7221
|
ExportNamedDeclaration?: boolean;
|
|
7222
7222
|
FunctionDeclaration?: boolean;
|
|
7223
7223
|
FunctionExpression?: boolean;
|
|
7224
|
+
IfStatement?: boolean;
|
|
7224
7225
|
ImportDeclaration?: boolean;
|
|
7225
7226
|
JSONArrayExpression?: boolean;
|
|
7226
7227
|
JSONObjectExpression?: boolean;
|
|
@@ -8781,6 +8782,7 @@ type MaxParams = [] | [(number | {
|
|
|
8781
8782
|
maximum?: number;
|
|
8782
8783
|
max?: number;
|
|
8783
8784
|
countVoidThis?: boolean;
|
|
8785
|
+
countThis?: ("never" | "except-void" | "always");
|
|
8784
8786
|
})];
|
|
8785
8787
|
type MaxStatements = [] | [(number | {
|
|
8786
8788
|
maximum?: number;
|
|
@@ -9480,7 +9482,7 @@ type PerfectionistSortArrayIncludes = {
|
|
|
9480
9482
|
pattern: string;
|
|
9481
9483
|
flags?: string;
|
|
9482
9484
|
} | string));
|
|
9483
|
-
selector?:
|
|
9485
|
+
selector?: "literal";
|
|
9484
9486
|
}, ...({
|
|
9485
9487
|
elementNamePattern?: (({
|
|
9486
9488
|
pattern: string;
|
|
@@ -9489,7 +9491,7 @@ type PerfectionistSortArrayIncludes = {
|
|
|
9489
9491
|
pattern: string;
|
|
9490
9492
|
flags?: string;
|
|
9491
9493
|
} | string));
|
|
9492
|
-
selector?:
|
|
9494
|
+
selector?: "literal";
|
|
9493
9495
|
})[]];
|
|
9494
9496
|
} | {
|
|
9495
9497
|
fallbackSort?: {
|
|
@@ -9507,7 +9509,7 @@ type PerfectionistSortArrayIncludes = {
|
|
|
9507
9509
|
pattern: string;
|
|
9508
9510
|
flags?: string;
|
|
9509
9511
|
} | string));
|
|
9510
|
-
selector?:
|
|
9512
|
+
selector?: "literal";
|
|
9511
9513
|
})[];
|
|
9512
9514
|
newlinesInside?: (("ignore" | number) | "newlinesBetween");
|
|
9513
9515
|
groups?: (string | [string, ...(string)[]] | {
|
|
@@ -9674,6 +9676,7 @@ type PerfectionistSortClasses = [] | [{
|
|
|
9674
9676
|
order?: ("asc" | "desc");
|
|
9675
9677
|
})[];
|
|
9676
9678
|
newlinesBetween?: ("ignore" | number);
|
|
9679
|
+
useExperimentalDependencyDetection?: boolean;
|
|
9677
9680
|
ignoreCallbackDependenciesPatterns?: (({
|
|
9678
9681
|
pattern: string;
|
|
9679
9682
|
flags?: string;
|
|
@@ -11560,7 +11563,7 @@ type PerfectionistSortSets = {
|
|
|
11560
11563
|
pattern: string;
|
|
11561
11564
|
flags?: string;
|
|
11562
11565
|
} | string));
|
|
11563
|
-
selector?:
|
|
11566
|
+
selector?: "literal";
|
|
11564
11567
|
}, ...({
|
|
11565
11568
|
elementNamePattern?: (({
|
|
11566
11569
|
pattern: string;
|
|
@@ -11569,7 +11572,7 @@ type PerfectionistSortSets = {
|
|
|
11569
11572
|
pattern: string;
|
|
11570
11573
|
flags?: string;
|
|
11571
11574
|
} | string));
|
|
11572
|
-
selector?:
|
|
11575
|
+
selector?: "literal";
|
|
11573
11576
|
})[]];
|
|
11574
11577
|
} | {
|
|
11575
11578
|
fallbackSort?: {
|
|
@@ -11587,7 +11590,7 @@ type PerfectionistSortSets = {
|
|
|
11587
11590
|
pattern: string;
|
|
11588
11591
|
flags?: string;
|
|
11589
11592
|
} | string));
|
|
11590
|
-
selector?:
|
|
11593
|
+
selector?: "literal";
|
|
11591
11594
|
})[];
|
|
11592
11595
|
newlinesInside?: (("ignore" | number) | "newlinesBetween");
|
|
11593
11596
|
groups?: (string | [string, ...(string)[]] | {
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { createRequire as __cjs_createRequire } from "node:module";
|
|
2
2
|
const __cjs_require = __cjs_createRequire(import.meta.url);
|
|
3
|
+
import { createRequire } from "node:module";
|
|
3
4
|
import baselineJs from "eslint-plugin-baseline-js";
|
|
4
5
|
import pluginAntfu from "eslint-plugin-antfu";
|
|
5
6
|
import pluginSxzz from "eslint-plugin-sxzz";
|
|
@@ -30,9 +31,12 @@ const {
|
|
|
30
31
|
defineConfig
|
|
31
32
|
} = __cjs_require("eslint/config");
|
|
32
33
|
import process from "node:process";
|
|
33
|
-
import { isPackageExists } from "local-pkg";
|
|
34
34
|
import { FlatConfigComposer } from "eslint-flat-config-utils";
|
|
35
35
|
|
|
36
|
+
//#region \0rolldown/runtime.js
|
|
37
|
+
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
38
|
+
|
|
39
|
+
//#endregion
|
|
36
40
|
//#region src/utils.ts
|
|
37
41
|
async function importWithError(pkg) {
|
|
38
42
|
try {
|
|
@@ -45,7 +49,7 @@ async function importWithError(pkg) {
|
|
|
45
49
|
//#endregion
|
|
46
50
|
//#region src/configs/astro.ts
|
|
47
51
|
const astro = async () => {
|
|
48
|
-
return (await importWithError("eslint-plugin-astro")).
|
|
52
|
+
return (await importWithError("eslint-plugin-astro")).configs.recommended.map((config) => ({
|
|
49
53
|
...config,
|
|
50
54
|
name: `sxzz/${config.name || "anonymous"}`
|
|
51
55
|
}));
|
|
@@ -820,9 +824,8 @@ const unicorn = () => [{
|
|
|
820
824
|
//#endregion
|
|
821
825
|
//#region src/configs/unocss.ts
|
|
822
826
|
const unocss = async () => {
|
|
823
|
-
const { default: unocss } = await importWithError("@unocss/eslint-plugin");
|
|
824
827
|
return [{
|
|
825
|
-
...unocss.configs.flat,
|
|
828
|
+
...(await importWithError("@unocss/eslint-plugin")).configs.flat,
|
|
826
829
|
name: "sxzz/unocss"
|
|
827
830
|
}];
|
|
828
831
|
};
|
|
@@ -934,6 +937,15 @@ const yml = () => [...yamlConfigs.map((config) => ({
|
|
|
934
937
|
|
|
935
938
|
//#endregion
|
|
936
939
|
//#region src/env.ts
|
|
940
|
+
const cwd = process.cwd();
|
|
941
|
+
function isPackageExists(name) {
|
|
942
|
+
try {
|
|
943
|
+
__require.resolve(name, { paths: [cwd] });
|
|
944
|
+
return true;
|
|
945
|
+
} catch {
|
|
946
|
+
return false;
|
|
947
|
+
}
|
|
948
|
+
}
|
|
937
949
|
const hasTypeScript = () => isPackageExists("typescript");
|
|
938
950
|
const hasVue = () => isPackageExists("vue") || isPackageExists("nuxt") || isPackageExists("vitepress") || isPackageExists("@slidev/cli");
|
|
939
951
|
const hasAstro = () => isPackageExists("astro");
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sxzz/eslint-config",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "7.
|
|
4
|
+
"version": "7.7.0",
|
|
5
5
|
"description": "ESLint config for @sxzz.",
|
|
6
6
|
"author": "Kevin Deng <sxzz@sxzz.moe>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"peerDependencies": {
|
|
32
32
|
"@unocss/eslint-plugin": ">=65.0.0",
|
|
33
33
|
"eslint": "^9.5.0",
|
|
34
|
-
"eslint-plugin-astro": "
|
|
34
|
+
"eslint-plugin-astro": "^1.5.0"
|
|
35
35
|
},
|
|
36
36
|
"peerDependenciesMeta": {
|
|
37
37
|
"@unocss/eslint-plugin": {
|
|
@@ -43,50 +43,49 @@
|
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
45
|
"@eslint-community/eslint-plugin-eslint-comments": "^4.6.0",
|
|
46
|
-
"@eslint/js": "^
|
|
46
|
+
"@eslint/js": "^10.0.1",
|
|
47
47
|
"@eslint/markdown": "^7.5.1",
|
|
48
48
|
"eslint-config-flat-gitignore": "^2.1.0",
|
|
49
49
|
"eslint-config-prettier": "^10.1.8",
|
|
50
|
-
"eslint-flat-config-utils": "^3.0.
|
|
51
|
-
"eslint-plugin-antfu": "^3.
|
|
50
|
+
"eslint-flat-config-utils": "^3.0.1",
|
|
51
|
+
"eslint-plugin-antfu": "^3.2.0",
|
|
52
52
|
"eslint-plugin-baseline-js": "^0.5.0",
|
|
53
53
|
"eslint-plugin-command": "^3.4.0",
|
|
54
54
|
"eslint-plugin-de-morgan": "^2.0.0",
|
|
55
|
-
"eslint-plugin-importer": "^0.
|
|
56
|
-
"eslint-plugin-jsdoc": "^62.5.
|
|
57
|
-
"eslint-plugin-jsonc": "^2.21.
|
|
55
|
+
"eslint-plugin-importer": "^0.3.0",
|
|
56
|
+
"eslint-plugin-jsdoc": "^62.5.4",
|
|
57
|
+
"eslint-plugin-jsonc": "^2.21.1",
|
|
58
58
|
"eslint-plugin-n": "^17.23.2",
|
|
59
|
-
"eslint-plugin-perfectionist": "^5.
|
|
59
|
+
"eslint-plugin-perfectionist": "^5.5.0",
|
|
60
60
|
"eslint-plugin-pnpm": "^1.5.0",
|
|
61
61
|
"eslint-plugin-prettier": "^5.5.5",
|
|
62
62
|
"eslint-plugin-regexp": "^3.0.0",
|
|
63
63
|
"eslint-plugin-sxzz": "^0.4.2",
|
|
64
64
|
"eslint-plugin-unicorn": "^62.0.0",
|
|
65
|
-
"eslint-plugin-unused-imports": "^4.
|
|
65
|
+
"eslint-plugin-unused-imports": "^4.4.1",
|
|
66
66
|
"eslint-plugin-vue": "^10.7.0",
|
|
67
|
-
"eslint-plugin-yml": "^3.
|
|
67
|
+
"eslint-plugin-yml": "^3.1.2",
|
|
68
68
|
"globals": "^17.3.0",
|
|
69
69
|
"jsonc-eslint-parser": "^2.4.2",
|
|
70
|
-
"local-pkg": "^1.1.2",
|
|
71
70
|
"typescript-eslint": "^8.54.0",
|
|
72
71
|
"vue-eslint-parser": "^10.2.0"
|
|
73
72
|
},
|
|
74
73
|
"devDependencies": {
|
|
75
74
|
"@eslint/config-inspector": "^1.4.2",
|
|
76
|
-
"@sxzz/prettier-config": "^2.3.
|
|
77
|
-
"@types/node": "^25.2.
|
|
78
|
-
"@typescript/native-preview": "7.0.0-dev.
|
|
75
|
+
"@sxzz/prettier-config": "^2.3.1",
|
|
76
|
+
"@types/node": "^25.2.2",
|
|
77
|
+
"@typescript/native-preview": "7.0.0-dev.20260209.1",
|
|
79
78
|
"@unocss/eslint-plugin": "^66.6.0",
|
|
80
|
-
"bumpp": "^10.4.
|
|
81
|
-
"eslint": "^
|
|
79
|
+
"bumpp": "^10.4.1",
|
|
80
|
+
"eslint": "^10.0.0",
|
|
82
81
|
"eslint-plugin-astro": "^1.5.0",
|
|
83
82
|
"eslint-typegen": "^2.3.0",
|
|
84
83
|
"prettier": "^3.8.1",
|
|
85
84
|
"rolldown-plugin-require-cjs": "^0.3.3",
|
|
86
|
-
"tsdown": "^0.20.
|
|
87
|
-
"tsdown-preset-sxzz": "^0.3.
|
|
85
|
+
"tsdown": "^0.20.3",
|
|
86
|
+
"tsdown-preset-sxzz": "^0.3.2",
|
|
88
87
|
"typescript": "^5.9.3",
|
|
89
|
-
"unrun": "^0.2.
|
|
88
|
+
"unrun": "^0.2.27"
|
|
90
89
|
},
|
|
91
90
|
"resolutions": {
|
|
92
91
|
"@types/eslint": "-"
|