@sxzz/eslint-config 3.3.1 → 3.4.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/index.cjs +31 -13
- package/index.js +1 -0
- package/package.json +11 -10
- package/src/js.js +4 -1
- package/src/presets.js +10 -4
- package/src/unocss.js +13 -0
- package/src/vue.js +0 -5
package/index.cjs
CHANGED
|
@@ -50,6 +50,7 @@ __export(eslint_config_exports, {
|
|
|
50
50
|
typescript: () => typescript,
|
|
51
51
|
unicorn: () => unicorn,
|
|
52
52
|
unicornPlugin: () => import_eslint_plugin_unicorn.default,
|
|
53
|
+
unocss: () => unocss,
|
|
53
54
|
vue: () => vue,
|
|
54
55
|
vueParser: () => import_vue_eslint_parser.default,
|
|
55
56
|
vuePlugin: () => import_eslint_plugin_vue.default,
|
|
@@ -303,7 +304,10 @@ var unicorn = [
|
|
|
303
304
|
"unicorn/explicit-length-check": "error",
|
|
304
305
|
"unicorn/filename-case": [
|
|
305
306
|
"error",
|
|
306
|
-
{
|
|
307
|
+
{
|
|
308
|
+
cases: { kebabCase: true, pascalCase: true },
|
|
309
|
+
ignore: [/^[A-Z]+\..*$/]
|
|
310
|
+
}
|
|
307
311
|
],
|
|
308
312
|
"unicorn/new-for-builtins": "error",
|
|
309
313
|
"unicorn/no-array-callback-reference": "error",
|
|
@@ -556,11 +560,24 @@ var typescript = [
|
|
|
556
560
|
}
|
|
557
561
|
];
|
|
558
562
|
|
|
563
|
+
// src/unocss.js
|
|
564
|
+
var import_eslint_plugin3 = __toESM(require("@unocss/eslint-plugin"), 1);
|
|
565
|
+
var unocss = [
|
|
566
|
+
{
|
|
567
|
+
plugins: {
|
|
568
|
+
"@unocss": import_eslint_plugin3.default
|
|
569
|
+
},
|
|
570
|
+
rules: {
|
|
571
|
+
...import_eslint_plugin3.default.configs.recommended.rules
|
|
572
|
+
}
|
|
573
|
+
}
|
|
574
|
+
];
|
|
575
|
+
|
|
559
576
|
// src/vue.js
|
|
560
577
|
var import_local_pkg = require("local-pkg");
|
|
561
578
|
var import_vue_eslint_parser = __toESM(require("vue-eslint-parser"), 1);
|
|
562
579
|
var import_eslint_plugin_vue = __toESM(require("eslint-plugin-vue"), 1);
|
|
563
|
-
var
|
|
580
|
+
var import_eslint_plugin4 = __toESM(require("@typescript-eslint/eslint-plugin"), 1);
|
|
564
581
|
function getVueVersion() {
|
|
565
582
|
const pkg = (0, import_local_pkg.getPackageInfoSync)("vue", { paths: [process.cwd()] });
|
|
566
583
|
if (pkg && typeof pkg.version === "string" && !Number.isNaN(+pkg.version[0])) {
|
|
@@ -628,11 +645,7 @@ var vueCustomRules = {
|
|
|
628
645
|
}
|
|
629
646
|
],
|
|
630
647
|
"vue/no-loss-of-precision": "error",
|
|
631
|
-
"vue/no-empty-pattern": "error"
|
|
632
|
-
"unicorn/filename-case": [
|
|
633
|
-
"error",
|
|
634
|
-
{ cases: { kebabCase: true, pascalCase: true } }
|
|
635
|
-
]
|
|
648
|
+
"vue/no-empty-pattern": "error"
|
|
636
649
|
};
|
|
637
650
|
var vue3Rules = {
|
|
638
651
|
...import_eslint_plugin_vue.default.configs.base.rules,
|
|
@@ -651,7 +664,7 @@ var vue = [
|
|
|
651
664
|
files: [GLOB_VUE],
|
|
652
665
|
plugins: {
|
|
653
666
|
vue: import_eslint_plugin_vue.default,
|
|
654
|
-
"@typescript-eslint":
|
|
667
|
+
"@typescript-eslint": import_eslint_plugin4.default
|
|
655
668
|
},
|
|
656
669
|
languageOptions: {
|
|
657
670
|
parser: import_vue_eslint_parser.default,
|
|
@@ -715,21 +728,25 @@ var basic = [
|
|
|
715
728
|
...yml,
|
|
716
729
|
...eslintComments
|
|
717
730
|
];
|
|
718
|
-
var all = [...vue, ...
|
|
731
|
+
var all = [...basic, ...vue, ...unocss, ...prettier];
|
|
719
732
|
function sxzz(config = [], {
|
|
720
733
|
vue: enableVue = true,
|
|
721
734
|
prettier: enablePrettier = true,
|
|
722
|
-
markdown: enableMarkdown = true
|
|
735
|
+
markdown: enableMarkdown = true,
|
|
736
|
+
unocss: enableUnocss = false
|
|
723
737
|
} = {}) {
|
|
724
738
|
const configs3 = [];
|
|
725
739
|
configs3.push(...basic);
|
|
726
|
-
if (enableVue
|
|
740
|
+
if (enableVue) {
|
|
727
741
|
configs3.push(...vue);
|
|
728
742
|
}
|
|
729
|
-
if (enableMarkdown
|
|
743
|
+
if (enableMarkdown) {
|
|
730
744
|
configs3.push(...markdown);
|
|
731
745
|
}
|
|
732
|
-
if (
|
|
746
|
+
if (enableUnocss) {
|
|
747
|
+
configs3.push(...unocss);
|
|
748
|
+
}
|
|
749
|
+
if (enablePrettier) {
|
|
733
750
|
configs3.push(...prettier);
|
|
734
751
|
}
|
|
735
752
|
if (Object.keys(config).length > 0) {
|
|
@@ -759,6 +776,7 @@ function sxzz(config = [], {
|
|
|
759
776
|
typescript,
|
|
760
777
|
unicorn,
|
|
761
778
|
unicornPlugin,
|
|
779
|
+
unocss,
|
|
762
780
|
vue,
|
|
763
781
|
vueParser,
|
|
764
782
|
vuePlugin,
|
package/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sxzz/eslint-config",
|
|
3
|
-
"version": "3.
|
|
4
|
-
"packageManager": "pnpm@8.6.
|
|
3
|
+
"version": "3.4.0",
|
|
4
|
+
"packageManager": "pnpm@8.6.12",
|
|
5
5
|
"description": "ESLint config for @sxzz.",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"license": "MIT",
|
|
@@ -32,11 +32,12 @@
|
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@eslint/js": "^8.46.0",
|
|
35
|
-
"@typescript-eslint/eslint-plugin": "^6.2.
|
|
36
|
-
"@typescript-eslint/parser": "^6.2.
|
|
37
|
-
"eslint-
|
|
38
|
-
"eslint-
|
|
39
|
-
"eslint-
|
|
35
|
+
"@typescript-eslint/eslint-plugin": "^6.2.1",
|
|
36
|
+
"@typescript-eslint/parser": "^6.2.1",
|
|
37
|
+
"@unocss/eslint-plugin": "^0.55.0",
|
|
38
|
+
"eslint-config-prettier": "^9.0.0",
|
|
39
|
+
"eslint-define-config": "^1.23.0",
|
|
40
|
+
"eslint-plugin-antfu": "^0.40.2",
|
|
40
41
|
"eslint-plugin-eslint-comments": "^3.2.0",
|
|
41
42
|
"eslint-plugin-import": "^2.28.0",
|
|
42
43
|
"eslint-plugin-jsonc": "^2.9.0",
|
|
@@ -48,16 +49,16 @@
|
|
|
48
49
|
"globals": "^13.20.0",
|
|
49
50
|
"jsonc-eslint-parser": "^2.3.0",
|
|
50
51
|
"local-pkg": "^0.4.3",
|
|
51
|
-
"prettier": "^3.0.
|
|
52
|
+
"prettier": "^3.0.1",
|
|
52
53
|
"vue-eslint-parser": "^9.3.1",
|
|
53
54
|
"yaml-eslint-parser": "^1.2.2"
|
|
54
55
|
},
|
|
55
56
|
"devDependencies": {
|
|
56
57
|
"@sxzz/prettier-config": "^1.0.4",
|
|
57
|
-
"@types/node": "^20.4.
|
|
58
|
+
"@types/node": "^20.4.8",
|
|
58
59
|
"bumpp": "^9.1.1",
|
|
59
60
|
"eslint": "^8.46.0",
|
|
60
|
-
"tsup": "^7.
|
|
61
|
+
"tsup": "^7.2.0",
|
|
61
62
|
"typescript": "^5.1.6"
|
|
62
63
|
},
|
|
63
64
|
"engines": {
|
package/src/js.js
CHANGED
|
@@ -186,7 +186,10 @@ export const unicorn = [
|
|
|
186
186
|
'unicorn/explicit-length-check': 'error',
|
|
187
187
|
'unicorn/filename-case': [
|
|
188
188
|
'error',
|
|
189
|
-
{
|
|
189
|
+
{
|
|
190
|
+
cases: { kebabCase: true, pascalCase: true },
|
|
191
|
+
ignore: [/^[A-Z]+\..*$/],
|
|
192
|
+
},
|
|
190
193
|
],
|
|
191
194
|
'unicorn/new-for-builtins': 'error',
|
|
192
195
|
'unicorn/no-array-callback-reference': 'error',
|
package/src/presets.js
CHANGED
|
@@ -7,6 +7,7 @@ import { markdown } from './markdown.js'
|
|
|
7
7
|
import { prettier } from './prettier.js'
|
|
8
8
|
import { GLOB_EXCLUDE } from './shared.js'
|
|
9
9
|
import { typescript } from './typescript.js'
|
|
10
|
+
import { unocss } from './unocss.js'
|
|
10
11
|
import { vue } from './vue.js'
|
|
11
12
|
import { yml } from './yml.js'
|
|
12
13
|
|
|
@@ -30,12 +31,13 @@ export const basic = [
|
|
|
30
31
|
]
|
|
31
32
|
|
|
32
33
|
/** @type { FlatESLintConfigItem[] } */
|
|
33
|
-
export const all = [...vue, ...
|
|
34
|
+
export const all = [...basic, ...vue, ...unocss, ...prettier]
|
|
34
35
|
|
|
35
36
|
/** @type {(config?: FlatESLintConfigItem | FlatESLintConfigItem[], enables?: Partial<{
|
|
36
37
|
* vue: boolean
|
|
37
38
|
* prettier: boolean
|
|
38
39
|
* markdown: boolean
|
|
40
|
+
* unocss: boolean
|
|
39
41
|
* }>) => FlatESLintConfigItem[]} */
|
|
40
42
|
export function sxzz(
|
|
41
43
|
config = [],
|
|
@@ -43,17 +45,21 @@ export function sxzz(
|
|
|
43
45
|
vue: enableVue = true,
|
|
44
46
|
prettier: enablePrettier = true,
|
|
45
47
|
markdown: enableMarkdown = true,
|
|
48
|
+
unocss: enableUnocss = false,
|
|
46
49
|
} = {}
|
|
47
50
|
) {
|
|
48
51
|
const configs = []
|
|
49
52
|
configs.push(...basic)
|
|
50
|
-
if (enableVue
|
|
53
|
+
if (enableVue) {
|
|
51
54
|
configs.push(...vue)
|
|
52
55
|
}
|
|
53
|
-
if (enableMarkdown
|
|
56
|
+
if (enableMarkdown) {
|
|
54
57
|
configs.push(...markdown)
|
|
55
58
|
}
|
|
56
|
-
if (
|
|
59
|
+
if (enableUnocss) {
|
|
60
|
+
configs.push(...unocss)
|
|
61
|
+
}
|
|
62
|
+
if (enablePrettier) {
|
|
57
63
|
configs.push(...prettier)
|
|
58
64
|
}
|
|
59
65
|
if (Object.keys(config).length > 0) {
|
package/src/unocss.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import unocssPlugin from '@unocss/eslint-plugin'
|
|
2
|
+
|
|
3
|
+
/** @type {import('eslint-define-config').FlatESLintConfigItem[]} */
|
|
4
|
+
export const unocss = [
|
|
5
|
+
{
|
|
6
|
+
plugins: {
|
|
7
|
+
'@unocss': unocssPlugin,
|
|
8
|
+
},
|
|
9
|
+
rules: {
|
|
10
|
+
...unocssPlugin.configs.recommended.rules,
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
]
|
package/src/vue.js
CHANGED
|
@@ -85,11 +85,6 @@ const vueCustomRules = {
|
|
|
85
85
|
],
|
|
86
86
|
'vue/no-loss-of-precision': 'error',
|
|
87
87
|
'vue/no-empty-pattern': 'error',
|
|
88
|
-
|
|
89
|
-
'unicorn/filename-case': [
|
|
90
|
-
'error',
|
|
91
|
-
{ cases: { kebabCase: true, pascalCase: true } },
|
|
92
|
-
],
|
|
93
88
|
}
|
|
94
89
|
|
|
95
90
|
/** @type {import('eslint-define-config').Rules} */
|