@sxzz/eslint-config 3.3.2 → 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 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,
@@ -559,11 +560,24 @@ var typescript = [
559
560
  }
560
561
  ];
561
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
+
562
576
  // src/vue.js
563
577
  var import_local_pkg = require("local-pkg");
564
578
  var import_vue_eslint_parser = __toESM(require("vue-eslint-parser"), 1);
565
579
  var import_eslint_plugin_vue = __toESM(require("eslint-plugin-vue"), 1);
566
- var import_eslint_plugin3 = __toESM(require("@typescript-eslint/eslint-plugin"), 1);
580
+ var import_eslint_plugin4 = __toESM(require("@typescript-eslint/eslint-plugin"), 1);
567
581
  function getVueVersion() {
568
582
  const pkg = (0, import_local_pkg.getPackageInfoSync)("vue", { paths: [process.cwd()] });
569
583
  if (pkg && typeof pkg.version === "string" && !Number.isNaN(+pkg.version[0])) {
@@ -650,7 +664,7 @@ var vue = [
650
664
  files: [GLOB_VUE],
651
665
  plugins: {
652
666
  vue: import_eslint_plugin_vue.default,
653
- "@typescript-eslint": import_eslint_plugin3.default
667
+ "@typescript-eslint": import_eslint_plugin4.default
654
668
  },
655
669
  languageOptions: {
656
670
  parser: import_vue_eslint_parser.default,
@@ -714,21 +728,25 @@ var basic = [
714
728
  ...yml,
715
729
  ...eslintComments
716
730
  ];
717
- var all = [...vue, ...basic, ...prettier];
731
+ var all = [...basic, ...vue, ...unocss, ...prettier];
718
732
  function sxzz(config = [], {
719
733
  vue: enableVue = true,
720
734
  prettier: enablePrettier = true,
721
- markdown: enableMarkdown = true
735
+ markdown: enableMarkdown = true,
736
+ unocss: enableUnocss = false
722
737
  } = {}) {
723
738
  const configs3 = [];
724
739
  configs3.push(...basic);
725
- if (enableVue !== false) {
740
+ if (enableVue) {
726
741
  configs3.push(...vue);
727
742
  }
728
- if (enableMarkdown !== false) {
743
+ if (enableMarkdown) {
729
744
  configs3.push(...markdown);
730
745
  }
731
- if (enablePrettier !== false) {
746
+ if (enableUnocss) {
747
+ configs3.push(...unocss);
748
+ }
749
+ if (enablePrettier) {
732
750
  configs3.push(...prettier);
733
751
  }
734
752
  if (Object.keys(config).length > 0) {
@@ -758,6 +776,7 @@ function sxzz(config = [], {
758
776
  typescript,
759
777
  unicorn,
760
778
  unicornPlugin,
779
+ unocss,
761
780
  vue,
762
781
  vueParser,
763
782
  vuePlugin,
package/index.js CHANGED
@@ -5,5 +5,6 @@ export * from './src/markdown.js'
5
5
  export * from './src/presets.js'
6
6
  export * from './src/prettier.js'
7
7
  export * from './src/typescript.js'
8
+ export * from './src/unocss.js'
8
9
  export * from './src/vue.js'
9
10
  export * from './src/yml.js'
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sxzz/eslint-config",
3
- "version": "3.3.2",
4
- "packageManager": "pnpm@8.6.11",
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.0",
36
- "@typescript-eslint/parser": "^6.2.0",
37
- "eslint-config-prettier": "^8.9.0",
38
- "eslint-define-config": "^1.22.0",
39
- "eslint-plugin-antfu": "^0.39.8",
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.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.5",
58
+ "@types/node": "^20.4.8",
58
59
  "bumpp": "^9.1.1",
59
60
  "eslint": "^8.46.0",
60
- "tsup": "^7.1.0",
61
+ "tsup": "^7.2.0",
61
62
  "typescript": "^5.1.6"
62
63
  },
63
64
  "engines": {
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, ...basic, ...prettier]
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 !== false) {
53
+ if (enableVue) {
51
54
  configs.push(...vue)
52
55
  }
53
- if (enableMarkdown !== false) {
56
+ if (enableMarkdown) {
54
57
  configs.push(...markdown)
55
58
  }
56
- if (enablePrettier !== false) {
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
+ ]