@cany748/eslint-config 4.0.1 → 4.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/dist/{index.d.ts → index.d.mts} +351 -160
- package/dist/{index.js → index.mjs} +23 -11
- package/package.json +29 -29
|
@@ -181,8 +181,7 @@ const parserPlain = {
|
|
|
181
181
|
* Combine array and non-array configs into a single array.
|
|
182
182
|
*/
|
|
183
183
|
async function combine(...configs$1) {
|
|
184
|
-
|
|
185
|
-
return resolved.flat();
|
|
184
|
+
return (await Promise.all(configs$1)).flat();
|
|
186
185
|
}
|
|
187
186
|
function toArray(value) {
|
|
188
187
|
return Array.isArray(value) ? value : [value];
|
|
@@ -254,7 +253,12 @@ function formatters(options = true) {
|
|
|
254
253
|
//#endregion
|
|
255
254
|
//#region src/configs/ignores.ts
|
|
256
255
|
function ignores(userIgnores = []) {
|
|
257
|
-
|
|
256
|
+
let ignores$1 = [...GLOB_EXCLUDE];
|
|
257
|
+
ignores$1 = typeof userIgnores === "function" ? userIgnores(ignores$1) : [...ignores$1, ...userIgnores];
|
|
258
|
+
return [{
|
|
259
|
+
ignores: ignores$1,
|
|
260
|
+
name: "ignores"
|
|
261
|
+
}];
|
|
258
262
|
}
|
|
259
263
|
|
|
260
264
|
//#endregion
|
|
@@ -286,7 +290,7 @@ function javascript(options = {}) {
|
|
|
286
290
|
const { isInEditor = false, overrides = {} } = options;
|
|
287
291
|
return [{
|
|
288
292
|
languageOptions: {
|
|
289
|
-
ecmaVersion:
|
|
293
|
+
ecmaVersion: "latest",
|
|
290
294
|
globals: {
|
|
291
295
|
...globals.browser,
|
|
292
296
|
...globals.es2021,
|
|
@@ -297,7 +301,7 @@ function javascript(options = {}) {
|
|
|
297
301
|
},
|
|
298
302
|
parserOptions: {
|
|
299
303
|
ecmaFeatures: { jsx: true },
|
|
300
|
-
ecmaVersion:
|
|
304
|
+
ecmaVersion: "latest",
|
|
301
305
|
sourceType: "module"
|
|
302
306
|
},
|
|
303
307
|
sourceType: "module"
|
|
@@ -667,6 +671,14 @@ function sortPackageJson() {
|
|
|
667
671
|
order: { type: "asc" },
|
|
668
672
|
pathPattern: "^(?:resolutions|overrides|pnpm.overrides)$"
|
|
669
673
|
},
|
|
674
|
+
{
|
|
675
|
+
order: { type: "asc" },
|
|
676
|
+
pathPattern: String.raw`^workspaces\.catalog$`
|
|
677
|
+
},
|
|
678
|
+
{
|
|
679
|
+
order: { type: "asc" },
|
|
680
|
+
pathPattern: String.raw`^workspaces\.catalogs\.[^.]+$`
|
|
681
|
+
},
|
|
670
682
|
{
|
|
671
683
|
order: [
|
|
672
684
|
"types",
|
|
@@ -702,7 +714,7 @@ function sortPackageJson() {
|
|
|
702
714
|
*/
|
|
703
715
|
function sortTsconfig() {
|
|
704
716
|
return [{
|
|
705
|
-
files: ["**/
|
|
717
|
+
files: ["**/[jt]sconfig.json", "**/[jt]sconfig.*.json"],
|
|
706
718
|
name: "sort/tsconfig-json",
|
|
707
719
|
rules: { "jsonc/sort-keys": [
|
|
708
720
|
"error",
|
|
@@ -977,7 +989,8 @@ function unicorn() {
|
|
|
977
989
|
"unicorn/prefer-string-replace-all": "off",
|
|
978
990
|
"unicorn/prefer-structured-clone": "off",
|
|
979
991
|
"unicorn/prefer-top-level-await": "off",
|
|
980
|
-
"unicorn/prevent-abbreviations": "off"
|
|
992
|
+
"unicorn/prevent-abbreviations": "off",
|
|
993
|
+
"unicorn/prefer-global-this": "off"
|
|
981
994
|
}
|
|
982
995
|
}];
|
|
983
996
|
}
|
|
@@ -985,9 +998,8 @@ function unicorn() {
|
|
|
985
998
|
//#endregion
|
|
986
999
|
//#region src/configs/unocss.ts
|
|
987
1000
|
async function unocss() {
|
|
988
|
-
const pluginUnoCSS = await interopDefault(import("@unocss/eslint-plugin"));
|
|
989
1001
|
return [{
|
|
990
|
-
...
|
|
1002
|
+
...(await interopDefault(import("@unocss/eslint-plugin"))).configs.flat,
|
|
991
1003
|
name: "unocss"
|
|
992
1004
|
}];
|
|
993
1005
|
}
|
|
@@ -1116,7 +1128,7 @@ const VuePackages = [
|
|
|
1116
1128
|
* The merged ESLint configurations.
|
|
1117
1129
|
*/
|
|
1118
1130
|
const factoryConfig = function(options = {}, ...userConfigs) {
|
|
1119
|
-
const { componentExts = [], formatters: enableFormatters = true, gitignore: enableGitignore = true, jsonc: enableJSONC = true, regexp: enableRegexp = true, test: enableTest = true, typescript: enableTypeScript = isPackageExists("typescript"), unocss: enableUnoCSS = isPackageExists("unocss"), vue: enableVue = VuePackages.some((i) => isPackageExists(i)) } = options;
|
|
1131
|
+
const { componentExts = [], formatters: enableFormatters = true, gitignore: enableGitignore = true, ignores: userIgnores = [], jsonc: enableJSONC = true, regexp: enableRegexp = true, test: enableTest = true, typescript: enableTypeScript = isPackageExists("typescript"), unocss: enableUnoCSS = isPackageExists("unocss"), vue: enableVue = VuePackages.some((i) => isPackageExists(i)) } = options;
|
|
1120
1132
|
let isInEditor = options.isInEditor;
|
|
1121
1133
|
if (isInEditor == null) {
|
|
1122
1134
|
isInEditor = isInEditorEnv();
|
|
@@ -1125,7 +1137,7 @@ const factoryConfig = function(options = {}, ...userConfigs) {
|
|
|
1125
1137
|
const configs$1 = [];
|
|
1126
1138
|
if (enableGitignore) if (typeof enableGitignore === "boolean") configs$1.push(interopDefault(import("eslint-config-flat-gitignore")).then((r) => [r({ strict: false })]));
|
|
1127
1139
|
else configs$1.push(interopDefault(import("eslint-config-flat-gitignore")).then((r) => [r(enableGitignore)]));
|
|
1128
|
-
configs$1.push(comments(), ignores(
|
|
1140
|
+
configs$1.push(comments(), ignores(userIgnores), imports(), javascript({
|
|
1129
1141
|
isInEditor,
|
|
1130
1142
|
overrides: options.javascript?.overrides
|
|
1131
1143
|
}), node(), unicorn());
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cany748/eslint-config",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "4.0
|
|
4
|
+
"version": "4.2.0",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./dist/index.js"
|
|
7
7
|
},
|
|
@@ -11,9 +11,9 @@
|
|
|
11
11
|
"dist"
|
|
12
12
|
],
|
|
13
13
|
"peerDependencies": {
|
|
14
|
-
"@unocss/eslint-plugin": "^66.
|
|
15
|
-
"eslint-plugin-vue": "^10.
|
|
16
|
-
"typescript-eslint": "^8.
|
|
14
|
+
"@unocss/eslint-plugin": "^66.5.10",
|
|
15
|
+
"eslint-plugin-vue": "^10.6.2",
|
|
16
|
+
"typescript-eslint": "^8.49.0"
|
|
17
17
|
},
|
|
18
18
|
"peerDependenciesMeta": {
|
|
19
19
|
"@unocss/eslint-plugin": {
|
|
@@ -28,36 +28,36 @@
|
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"@eslint-community/eslint-plugin-eslint-comments": "^4.5.0",
|
|
31
|
-
"@vitest/eslint-plugin": "^1.
|
|
32
|
-
"eslint": "^9.
|
|
31
|
+
"@vitest/eslint-plugin": "^1.5.2",
|
|
32
|
+
"eslint": "^9.39.2",
|
|
33
33
|
"eslint-config-flat-gitignore": "^2.1.0",
|
|
34
|
-
"eslint-config-prettier": "^10.1.
|
|
35
|
-
"eslint-flat-config-utils": "^2.1.
|
|
34
|
+
"eslint-config-prettier": "^10.1.8",
|
|
35
|
+
"eslint-flat-config-utils": "^2.1.4",
|
|
36
36
|
"eslint-plugin-import-x": "^4.16.1",
|
|
37
|
-
"eslint-plugin-jsonc": "^2.
|
|
38
|
-
"eslint-plugin-n": "^17.
|
|
37
|
+
"eslint-plugin-jsonc": "^2.21.0",
|
|
38
|
+
"eslint-plugin-n": "^17.23.1",
|
|
39
39
|
"eslint-plugin-no-only-tests": "^3.3.0",
|
|
40
|
-
"eslint-plugin-prettier": "^5.5.
|
|
41
|
-
"eslint-plugin-regexp": "^2.
|
|
42
|
-
"eslint-plugin-unicorn": "^
|
|
43
|
-
"eslint-plugin-unused-imports": "^4.
|
|
44
|
-
"globals": "^16.
|
|
45
|
-
"jiti": "^2.
|
|
46
|
-
"jsonc-eslint-parser": "^2.4.
|
|
47
|
-
"local-pkg": "^1.1.
|
|
48
|
-
"prettier": "^3.
|
|
40
|
+
"eslint-plugin-prettier": "^5.5.4",
|
|
41
|
+
"eslint-plugin-regexp": "^2.10.0",
|
|
42
|
+
"eslint-plugin-unicorn": "^62.0.0",
|
|
43
|
+
"eslint-plugin-unused-imports": "^4.3.0",
|
|
44
|
+
"globals": "^16.5.0",
|
|
45
|
+
"jiti": "^2.6.1",
|
|
46
|
+
"jsonc-eslint-parser": "^2.4.2",
|
|
47
|
+
"local-pkg": "^1.1.2",
|
|
48
|
+
"prettier": "^3.7.4"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
|
-
"@types/node": "^
|
|
52
|
-
"@unocss/eslint-plugin": "^66.
|
|
53
|
-
"bumpp": "^10.2
|
|
54
|
-
"eslint-plugin-vue": "10.2
|
|
55
|
-
"eslint-typegen": "^2.
|
|
56
|
-
"lint-staged": "^16.
|
|
57
|
-
"simple-git-hooks": "^2.13.
|
|
58
|
-
"tsdown": "^0.
|
|
59
|
-
"typescript": "^5.
|
|
60
|
-
"typescript-eslint": "^8.
|
|
51
|
+
"@types/node": "^25.0.2",
|
|
52
|
+
"@unocss/eslint-plugin": "^66.5.10",
|
|
53
|
+
"bumpp": "^10.3.2",
|
|
54
|
+
"eslint-plugin-vue": "^10.6.2",
|
|
55
|
+
"eslint-typegen": "^2.3.0",
|
|
56
|
+
"lint-staged": "^16.2.7",
|
|
57
|
+
"simple-git-hooks": "^2.13.1",
|
|
58
|
+
"tsdown": "^0.17.4",
|
|
59
|
+
"typescript": "^5.9.3",
|
|
60
|
+
"typescript-eslint": "^8.49.0"
|
|
61
61
|
},
|
|
62
62
|
"simple-git-hooks": {
|
|
63
63
|
"pre-commit": "pnpm lint-staged"
|