@sxzz/eslint-config 3.7.1 → 3.7.3

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.cjs CHANGED
@@ -58,6 +58,7 @@ __export(src_exports, {
58
58
  configPrettier: () => configPrettier,
59
59
  getVueVersion: () => getVueVersion,
60
60
  hasTypeScript: () => hasTypeScript,
61
+ hasUnocss: () => hasUnocss,
61
62
  hasVue: () => hasVue,
62
63
  ignores: () => ignores,
63
64
  imports: () => imports,
@@ -84,6 +85,7 @@ __export(src_exports, {
84
85
  pluginYml: () => pluginYml,
85
86
  presetBasic: () => basic,
86
87
  presetJavaScript: () => presetJavaScript,
88
+ presetJsonc: () => presetJsonc,
87
89
  presetLangsExtensions: () => presetLangsExtensions,
88
90
  prettier: () => prettier,
89
91
  reactivityTransform: () => reactivityTransform,
@@ -272,6 +274,7 @@ var import_local_pkg = require("local-pkg");
272
274
  var isInEditor = (import_node_process.default.env.VSCODE_PID || import_node_process.default.env.JETBRAINS_IDE) && !import_node_process.default.env.CI;
273
275
  var hasTypeScript = (0, import_local_pkg.isPackageExists)("typescript");
274
276
  var hasVue = (0, import_local_pkg.isPackageExists)("vue") || (0, import_local_pkg.isPackageExists)("nuxt") || (0, import_local_pkg.isPackageExists)("vitepress") || (0, import_local_pkg.isPackageExists)("@slidev/cli");
277
+ var hasUnocss = (0, import_local_pkg.isPackageExists)("unocss") || (0, import_local_pkg.isPackageExists)("@unocss/webpack");
275
278
 
276
279
  // src/configs/javascript.ts
277
280
  var javascript = [
@@ -1016,28 +1019,25 @@ var presetJavaScript = [
1016
1019
  ...imports,
1017
1020
  ...unicorn
1018
1021
  ];
1019
- var presetLangsExtensions = [
1020
- ...markdown,
1021
- ...yml,
1022
- ...jsonc,
1023
- ...sortPackageJson,
1024
- ...sortTsconfig
1022
+ var presetJsonc = [...jsonc, ...sortPackageJson, ...sortTsconfig];
1023
+ var presetLangsExtensions = [...markdown, ...yml, ...presetJsonc];
1024
+ var basic = [...presetJavaScript, ...typescript];
1025
+ var all = [
1026
+ ...basic,
1027
+ ...presetLangsExtensions,
1028
+ ...sortKeys,
1029
+ ...vue,
1030
+ ...unocss,
1031
+ ...prettier
1025
1032
  ];
1026
- var basic = [
1027
- ...presetJavaScript,
1028
- ...typescript,
1029
- ...presetLangsExtensions
1030
- ];
1031
- var all = [...basic, ...sortKeys, ...vue, ...unocss, ...prettier];
1032
1033
  function sxzz(config = [], {
1033
- vue: enableVue = true,
1034
+ vue: enableVue = hasVue,
1034
1035
  prettier: enablePrettier = true,
1035
1036
  markdown: enableMarkdown = true,
1036
1037
  sortKeys: enableSortKeys = true,
1037
- unocss: enableUnocss = false
1038
+ unocss: enableUnocss = hasUnocss
1038
1039
  } = {}) {
1039
- const configs = [];
1040
- configs.push(...basic);
1040
+ const configs = [...basic, ...yml, ...presetJsonc];
1041
1041
  if (enableSortKeys) {
1042
1042
  configs.push(...sortKeys);
1043
1043
  }
@@ -1088,6 +1088,7 @@ function sxzz(config = [], {
1088
1088
  configPrettier,
1089
1089
  getVueVersion,
1090
1090
  hasTypeScript,
1091
+ hasUnocss,
1091
1092
  hasVue,
1092
1093
  ignores,
1093
1094
  imports,
@@ -1114,6 +1115,7 @@ function sxzz(config = [], {
1114
1115
  pluginYml,
1115
1116
  presetBasic,
1116
1117
  presetJavaScript,
1118
+ presetJsonc,
1117
1119
  presetLangsExtensions,
1118
1120
  prettier,
1119
1121
  reactivityTransform,
package/dist/index.d.cts CHANGED
@@ -52,6 +52,7 @@ declare const yml: FlatESLintConfigItem[];
52
52
  declare const isInEditor: boolean | "" | undefined;
53
53
  declare const hasTypeScript: boolean;
54
54
  declare const hasVue: boolean;
55
+ declare const hasUnocss: boolean;
55
56
 
56
57
  declare const GLOB_SRC_EXT = "?([cm])[jt]s?(x)";
57
58
  declare const GLOB_SRC = "**/*.?([cm])[jt]s?(x)";
@@ -87,6 +88,7 @@ declare const pluginPrettier: any;
87
88
  declare const configPrettier: any;
88
89
 
89
90
  declare const presetJavaScript: FlatESLintConfigItem[];
91
+ declare const presetJsonc: FlatESLintConfigItem[];
90
92
  declare const presetLangsExtensions: FlatESLintConfigItem[];
91
93
  declare const basic: FlatESLintConfigItem[];
92
94
 
@@ -99,4 +101,4 @@ declare function sxzz(config?: FlatESLintConfigItem | FlatESLintConfigItem[], {
99
101
  sortKeys: boolean;
100
102
  }>): FlatESLintConfigItem[];
101
103
 
102
- export { GLOB_ALL_SRC, GLOB_CSS, GLOB_DIST, GLOB_EXCLUDE, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LESS, GLOB_LOCKFILE, GLOB_MARKDOWN, GLOB_NODE_MODULES, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_TS, GLOB_TSX, GLOB_VUE, GLOB_YAML, all, basic, comments, configPrettier, getVueVersion, hasTypeScript, hasVue, ignores, imports, isInEditor, javascript, jsonc, markdown, pluginAntfu, pluginComments, pluginMarkdown, pluginPrettier, pluginTypeScript, pluginUnicorn, pluginUnocss, pluginVue, basic as presetBasic, presetJavaScript, presetLangsExtensions, prettier, reactivityTransform, sortKeys, sortPackageJson, sortTsconfig, sxzz, typescript, unicorn, unocss, vue, yml };
104
+ export { GLOB_ALL_SRC, GLOB_CSS, GLOB_DIST, GLOB_EXCLUDE, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LESS, GLOB_LOCKFILE, GLOB_MARKDOWN, GLOB_NODE_MODULES, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_TS, GLOB_TSX, GLOB_VUE, GLOB_YAML, all, basic, comments, configPrettier, getVueVersion, hasTypeScript, hasUnocss, hasVue, ignores, imports, isInEditor, javascript, jsonc, markdown, pluginAntfu, pluginComments, pluginMarkdown, pluginPrettier, pluginTypeScript, pluginUnicorn, pluginUnocss, pluginVue, basic as presetBasic, presetJavaScript, presetJsonc, presetLangsExtensions, prettier, reactivityTransform, sortKeys, sortPackageJson, sortTsconfig, sxzz, typescript, unicorn, unocss, vue, yml };
package/dist/index.d.ts CHANGED
@@ -52,6 +52,7 @@ declare const yml: FlatESLintConfigItem[];
52
52
  declare const isInEditor: boolean | "" | undefined;
53
53
  declare const hasTypeScript: boolean;
54
54
  declare const hasVue: boolean;
55
+ declare const hasUnocss: boolean;
55
56
 
56
57
  declare const GLOB_SRC_EXT = "?([cm])[jt]s?(x)";
57
58
  declare const GLOB_SRC = "**/*.?([cm])[jt]s?(x)";
@@ -87,6 +88,7 @@ declare const pluginPrettier: any;
87
88
  declare const configPrettier: any;
88
89
 
89
90
  declare const presetJavaScript: FlatESLintConfigItem[];
91
+ declare const presetJsonc: FlatESLintConfigItem[];
90
92
  declare const presetLangsExtensions: FlatESLintConfigItem[];
91
93
  declare const basic: FlatESLintConfigItem[];
92
94
 
@@ -99,4 +101,4 @@ declare function sxzz(config?: FlatESLintConfigItem | FlatESLintConfigItem[], {
99
101
  sortKeys: boolean;
100
102
  }>): FlatESLintConfigItem[];
101
103
 
102
- export { GLOB_ALL_SRC, GLOB_CSS, GLOB_DIST, GLOB_EXCLUDE, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LESS, GLOB_LOCKFILE, GLOB_MARKDOWN, GLOB_NODE_MODULES, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_TS, GLOB_TSX, GLOB_VUE, GLOB_YAML, all, basic, comments, configPrettier, getVueVersion, hasTypeScript, hasVue, ignores, imports, isInEditor, javascript, jsonc, markdown, pluginAntfu, pluginComments, pluginMarkdown, pluginPrettier, pluginTypeScript, pluginUnicorn, pluginUnocss, pluginVue, basic as presetBasic, presetJavaScript, presetLangsExtensions, prettier, reactivityTransform, sortKeys, sortPackageJson, sortTsconfig, sxzz, typescript, unicorn, unocss, vue, yml };
104
+ export { GLOB_ALL_SRC, GLOB_CSS, GLOB_DIST, GLOB_EXCLUDE, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LESS, GLOB_LOCKFILE, GLOB_MARKDOWN, GLOB_NODE_MODULES, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_TS, GLOB_TSX, GLOB_VUE, GLOB_YAML, all, basic, comments, configPrettier, getVueVersion, hasTypeScript, hasUnocss, hasVue, ignores, imports, isInEditor, javascript, jsonc, markdown, pluginAntfu, pluginComments, pluginMarkdown, pluginPrettier, pluginTypeScript, pluginUnicorn, pluginUnocss, pluginVue, basic as presetBasic, presetJavaScript, presetJsonc, presetLangsExtensions, prettier, reactivityTransform, sortKeys, sortPackageJson, sortTsconfig, sxzz, typescript, unicorn, unocss, vue, yml };
package/dist/index.js CHANGED
@@ -171,6 +171,7 @@ import { isPackageExists } from "local-pkg";
171
171
  var isInEditor = (process2.env.VSCODE_PID || process2.env.JETBRAINS_IDE) && !process2.env.CI;
172
172
  var hasTypeScript = isPackageExists("typescript");
173
173
  var hasVue = isPackageExists("vue") || isPackageExists("nuxt") || isPackageExists("vitepress") || isPackageExists("@slidev/cli");
174
+ var hasUnocss = isPackageExists("unocss") || isPackageExists("@unocss/webpack");
174
175
 
175
176
  // src/configs/javascript.ts
176
177
  var javascript = [
@@ -915,28 +916,25 @@ var presetJavaScript = [
915
916
  ...imports,
916
917
  ...unicorn
917
918
  ];
918
- var presetLangsExtensions = [
919
- ...markdown,
920
- ...yml,
921
- ...jsonc,
922
- ...sortPackageJson,
923
- ...sortTsconfig
919
+ var presetJsonc = [...jsonc, ...sortPackageJson, ...sortTsconfig];
920
+ var presetLangsExtensions = [...markdown, ...yml, ...presetJsonc];
921
+ var basic = [...presetJavaScript, ...typescript];
922
+ var all = [
923
+ ...basic,
924
+ ...presetLangsExtensions,
925
+ ...sortKeys,
926
+ ...vue,
927
+ ...unocss,
928
+ ...prettier
924
929
  ];
925
- var basic = [
926
- ...presetJavaScript,
927
- ...typescript,
928
- ...presetLangsExtensions
929
- ];
930
- var all = [...basic, ...sortKeys, ...vue, ...unocss, ...prettier];
931
930
  function sxzz(config = [], {
932
- vue: enableVue = true,
931
+ vue: enableVue = hasVue,
933
932
  prettier: enablePrettier = true,
934
933
  markdown: enableMarkdown = true,
935
934
  sortKeys: enableSortKeys = true,
936
- unocss: enableUnocss = false
935
+ unocss: enableUnocss = hasUnocss
937
936
  } = {}) {
938
- const configs = [];
939
- configs.push(...basic);
937
+ const configs = [...basic, ...yml, ...presetJsonc];
940
938
  if (enableSortKeys) {
941
939
  configs.push(...sortKeys);
942
940
  }
@@ -986,6 +984,7 @@ export {
986
984
  configPrettier,
987
985
  getVueVersion,
988
986
  hasTypeScript,
987
+ hasUnocss,
989
988
  hasVue,
990
989
  ignores,
991
990
  imports,
@@ -1012,6 +1011,7 @@ export {
1012
1011
  pluginYml,
1013
1012
  basic as presetBasic,
1014
1013
  presetJavaScript,
1014
+ presetJsonc,
1015
1015
  presetLangsExtensions,
1016
1016
  prettier,
1017
1017
  reactivityTransform,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sxzz/eslint-config",
3
- "version": "3.7.1",
3
+ "version": "3.7.3",
4
4
  "packageManager": "pnpm@8.10.0",
5
5
  "description": "ESLint config for @sxzz.",
6
6
  "type": "module",