@sxzz/eslint-config 3.4.0 → 3.5.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/index.cjs +16 -8
- package/package.json +16 -15
- package/src/js.js +14 -1
- package/src/markdown.js +1 -0
- package/src/vue.js +2 -5
package/index.cjs
CHANGED
|
@@ -81,6 +81,7 @@ var import_js = __toESM(require("@eslint/js"), 1);
|
|
|
81
81
|
var import_eslint_plugin_import = __toESM(require("eslint-plugin-import"), 1);
|
|
82
82
|
var import_eslint_plugin_unicorn = __toESM(require("eslint-plugin-unicorn"), 1);
|
|
83
83
|
var import_eslint_plugin_antfu = __toESM(require("eslint-plugin-antfu"), 1);
|
|
84
|
+
var import_eslint_plugin_unused_imports = __toESM(require("eslint-plugin-unused-imports"), 1);
|
|
84
85
|
|
|
85
86
|
// src/shared.js
|
|
86
87
|
var GLOB_SRC_EXT = "?([cm])[jt]s?(x)";
|
|
@@ -136,6 +137,7 @@ var GLOB_EXCLUDE = (
|
|
|
136
137
|
);
|
|
137
138
|
|
|
138
139
|
// src/js.js
|
|
140
|
+
var isInEditor = (process.env.VSCODE_PID || process.env.JETBRAINS_IDE) && !process.env.CI;
|
|
139
141
|
var js = [
|
|
140
142
|
import_js.default.configs.recommended,
|
|
141
143
|
{
|
|
@@ -147,8 +149,11 @@ var js = [
|
|
|
147
149
|
},
|
|
148
150
|
sourceType: "module"
|
|
149
151
|
},
|
|
152
|
+
plugins: {
|
|
153
|
+
"unused-imports": import_eslint_plugin_unused_imports.default
|
|
154
|
+
},
|
|
150
155
|
rules: {
|
|
151
|
-
"no-unused-vars":
|
|
156
|
+
"no-unused-vars": "off",
|
|
152
157
|
"no-constant-condition": "warn",
|
|
153
158
|
"no-debugger": "warn",
|
|
154
159
|
"no-console": ["warn", { allow: ["warn", "error"] }],
|
|
@@ -208,7 +213,12 @@ var js = [
|
|
|
208
213
|
}
|
|
209
214
|
],
|
|
210
215
|
"no-lonely-if": "error",
|
|
211
|
-
"prefer-exponentiation-operator": "error"
|
|
216
|
+
"prefer-exponentiation-operator": "error",
|
|
217
|
+
"unused-imports/no-unused-imports": isInEditor ? "off" : "error",
|
|
218
|
+
[isInEditor ? "no-unused-vars" : "unused-imports/no-unused-vars"]: [
|
|
219
|
+
"error",
|
|
220
|
+
{ args: "after-used", ignoreRestSiblings: true }
|
|
221
|
+
]
|
|
212
222
|
}
|
|
213
223
|
},
|
|
214
224
|
{
|
|
@@ -487,7 +497,8 @@ var markdown = [
|
|
|
487
497
|
"no-restricted-imports": "off",
|
|
488
498
|
"no-undef": "off",
|
|
489
499
|
"no-unused-expressions": "off",
|
|
490
|
-
"no-unused-vars": "off"
|
|
500
|
+
"no-unused-vars": "off",
|
|
501
|
+
"unused-imports/no-unused-vars": "off"
|
|
491
502
|
}
|
|
492
503
|
}
|
|
493
504
|
];
|
|
@@ -603,7 +614,7 @@ var reactivityTransform = [
|
|
|
603
614
|
vue: import_eslint_plugin_vue.default
|
|
604
615
|
},
|
|
605
616
|
rules: {
|
|
606
|
-
"vue/no-setup-props-
|
|
617
|
+
"vue/no-setup-props-reactivity-loss": "off"
|
|
607
618
|
}
|
|
608
619
|
}
|
|
609
620
|
];
|
|
@@ -625,10 +636,7 @@ var vueCustomRules = {
|
|
|
625
636
|
math: "always"
|
|
626
637
|
}
|
|
627
638
|
],
|
|
628
|
-
"vue/
|
|
629
|
-
"error",
|
|
630
|
-
{ order: ["script", "template", "style"] }
|
|
631
|
-
],
|
|
639
|
+
"vue/block-order": ["error", { order: ["script", "template", "style"] }],
|
|
632
640
|
"vue/custom-event-name-casing": ["error", "camelCase"],
|
|
633
641
|
"vue/no-useless-v-bind": "error",
|
|
634
642
|
"vue/no-unused-refs": "error",
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sxzz/eslint-config",
|
|
3
|
-
"version": "3.
|
|
4
|
-
"packageManager": "pnpm@8.
|
|
3
|
+
"version": "3.5.1",
|
|
4
|
+
"packageManager": "pnpm@8.7.0",
|
|
5
5
|
"description": "ESLint config for @sxzz.",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"license": "MIT",
|
|
@@ -31,35 +31,36 @@
|
|
|
31
31
|
"eslint": "^8.0.0"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@eslint/js": "^8.
|
|
35
|
-
"@typescript-eslint/eslint-plugin": "^6.
|
|
36
|
-
"@typescript-eslint/parser": "^6.
|
|
37
|
-
"@unocss/eslint-plugin": "^0.55.
|
|
34
|
+
"@eslint/js": "^8.48.0",
|
|
35
|
+
"@typescript-eslint/eslint-plugin": "^6.4.1",
|
|
36
|
+
"@typescript-eslint/parser": "^6.4.1",
|
|
37
|
+
"@unocss/eslint-plugin": "^0.55.3",
|
|
38
38
|
"eslint-config-prettier": "^9.0.0",
|
|
39
39
|
"eslint-define-config": "^1.23.0",
|
|
40
|
-
"eslint-plugin-antfu": "^0.
|
|
40
|
+
"eslint-plugin-antfu": "^0.41.0",
|
|
41
41
|
"eslint-plugin-eslint-comments": "^3.2.0",
|
|
42
|
-
"eslint-plugin-import": "^2.28.
|
|
42
|
+
"eslint-plugin-import": "^2.28.1",
|
|
43
43
|
"eslint-plugin-jsonc": "^2.9.0",
|
|
44
44
|
"eslint-plugin-markdown": "^3.0.1",
|
|
45
45
|
"eslint-plugin-prettier": "^5.0.0",
|
|
46
46
|
"eslint-plugin-unicorn": "^48.0.1",
|
|
47
|
-
"eslint-plugin-
|
|
47
|
+
"eslint-plugin-unused-imports": "^3.0.0",
|
|
48
|
+
"eslint-plugin-vue": "^9.17.0",
|
|
48
49
|
"eslint-plugin-yml": "^1.8.0",
|
|
49
|
-
"globals": "^13.
|
|
50
|
+
"globals": "^13.21.0",
|
|
50
51
|
"jsonc-eslint-parser": "^2.3.0",
|
|
51
52
|
"local-pkg": "^0.4.3",
|
|
52
|
-
"prettier": "^3.0.
|
|
53
|
+
"prettier": "^3.0.2",
|
|
53
54
|
"vue-eslint-parser": "^9.3.1",
|
|
54
55
|
"yaml-eslint-parser": "^1.2.2"
|
|
55
56
|
},
|
|
56
57
|
"devDependencies": {
|
|
57
58
|
"@sxzz/prettier-config": "^1.0.4",
|
|
58
|
-
"@types/node": "^20.
|
|
59
|
-
"bumpp": "^9.
|
|
60
|
-
"eslint": "^8.
|
|
59
|
+
"@types/node": "^20.5.7",
|
|
60
|
+
"bumpp": "^9.2.0",
|
|
61
|
+
"eslint": "^8.48.0",
|
|
61
62
|
"tsup": "^7.2.0",
|
|
62
|
-
"typescript": "^5.
|
|
63
|
+
"typescript": "^5.2.2"
|
|
63
64
|
},
|
|
64
65
|
"engines": {
|
|
65
66
|
"node": ">=16.14.0"
|
package/src/js.js
CHANGED
|
@@ -3,8 +3,12 @@ import jsConfig from '@eslint/js'
|
|
|
3
3
|
import importPlugin from 'eslint-plugin-import'
|
|
4
4
|
import unicornPlugin from 'eslint-plugin-unicorn'
|
|
5
5
|
import antfuPlugin from 'eslint-plugin-antfu'
|
|
6
|
+
import unusedImportsPlugin from 'eslint-plugin-unused-imports'
|
|
6
7
|
import { GLOB_MARKDOWN, GLOB_SRC, GLOB_SRC_EXT } from './shared.js'
|
|
7
8
|
|
|
9
|
+
const isInEditor =
|
|
10
|
+
(process.env.VSCODE_PID || process.env.JETBRAINS_IDE) && !process.env.CI
|
|
11
|
+
|
|
8
12
|
export { importPlugin, unicornPlugin, antfuPlugin }
|
|
9
13
|
|
|
10
14
|
/** @type {import('eslint-define-config').FlatESLintConfigItem[]} */
|
|
@@ -19,8 +23,11 @@ export const js = [
|
|
|
19
23
|
},
|
|
20
24
|
sourceType: 'module',
|
|
21
25
|
},
|
|
26
|
+
plugins: {
|
|
27
|
+
'unused-imports': unusedImportsPlugin,
|
|
28
|
+
},
|
|
22
29
|
rules: {
|
|
23
|
-
'no-unused-vars':
|
|
30
|
+
'no-unused-vars': 'off',
|
|
24
31
|
'no-constant-condition': 'warn',
|
|
25
32
|
'no-debugger': 'warn',
|
|
26
33
|
'no-console': ['warn', { allow: ['warn', 'error'] }],
|
|
@@ -84,6 +91,12 @@ export const js = [
|
|
|
84
91
|
],
|
|
85
92
|
'no-lonely-if': 'error',
|
|
86
93
|
'prefer-exponentiation-operator': 'error',
|
|
94
|
+
|
|
95
|
+
'unused-imports/no-unused-imports': isInEditor ? 'off' : 'error',
|
|
96
|
+
[isInEditor ? 'no-unused-vars' : 'unused-imports/no-unused-vars']: [
|
|
97
|
+
'error',
|
|
98
|
+
{ args: 'after-used', ignoreRestSiblings: true },
|
|
99
|
+
],
|
|
87
100
|
},
|
|
88
101
|
},
|
|
89
102
|
{
|
package/src/markdown.js
CHANGED
package/src/vue.js
CHANGED
|
@@ -38,7 +38,7 @@ export const reactivityTransform = [
|
|
|
38
38
|
vue: vuePlugin,
|
|
39
39
|
},
|
|
40
40
|
rules: {
|
|
41
|
-
'vue/no-setup-props-
|
|
41
|
+
'vue/no-setup-props-reactivity-loss': 'off',
|
|
42
42
|
},
|
|
43
43
|
},
|
|
44
44
|
]
|
|
@@ -63,10 +63,7 @@ const vueCustomRules = {
|
|
|
63
63
|
math: 'always',
|
|
64
64
|
},
|
|
65
65
|
],
|
|
66
|
-
'vue/
|
|
67
|
-
'error',
|
|
68
|
-
{ order: ['script', 'template', 'style'] },
|
|
69
|
-
],
|
|
66
|
+
'vue/block-order': ['error', { order: ['script', 'template', 'style'] }],
|
|
70
67
|
'vue/custom-event-name-casing': ['error', 'camelCase'],
|
|
71
68
|
'vue/no-useless-v-bind': 'error',
|
|
72
69
|
'vue/no-unused-refs': 'error',
|