@so1ve/eslint-config 3.7.0 → 3.8.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.
Files changed (3) hide show
  1. package/dist/index.d.ts +13353 -2
  2. package/dist/index.js +45 -21
  3. package/package.json +6 -5
package/dist/index.js CHANGED
@@ -312,9 +312,11 @@ async function formatting(options) {
312
312
  //#endregion
313
313
  //#region src/configs/html.ts
314
314
  async function html() {
315
- const parserHtml = await interopDefault(import("@html-eslint/parser"));
316
- const pluginHtml = await interopDefault(import("@html-eslint/eslint-plugin"));
317
- const pluginHtmlJsSupport = await interopDefault(import("eslint-plugin-html"));
315
+ const [parserHtml, pluginHtml, pluginHtmlJsSupport] = await Promise.all([
316
+ interopDefault(import("@html-eslint/parser")),
317
+ interopDefault(import("@html-eslint/eslint-plugin")),
318
+ interopDefault(import("eslint-plugin-html"))
319
+ ]);
318
320
  return [{
319
321
  name: "so1ve/html/setup",
320
322
  plugins: {
@@ -401,12 +403,9 @@ const imports = (options = {}) => [
401
403
  "import/no-mutable-exports": "error",
402
404
  "import/no-useless-path-segments": ["error", { noUselessIndex: true }],
403
405
  "import/no-named-as-default": "error",
404
- "import/no-unresolved": "off",
405
- "import/no-absolute-path": "off",
406
406
  "import/no-duplicates": "error",
407
407
  "import/no-named-default": "error",
408
- "import/no-webpack-loader-syntax": "error",
409
- "import/no-named-as-default-member": "off"
408
+ "import/no-webpack-loader-syntax": "error"
410
409
  }
411
410
  },
412
411
  {
@@ -759,8 +758,7 @@ async function javascript({ overrides } = {}) {
759
758
  //#endregion
760
759
  //#region src/configs/jsonc.ts
761
760
  async function jsonc() {
762
- const parserJsonc = await interopDefault(import("jsonc-eslint-parser"));
763
- const pluginJsonc = await interopDefault(import("eslint-plugin-jsonc"));
761
+ const [parserJsonc, pluginJsonc] = await Promise.all([interopDefault(import("jsonc-eslint-parser")), interopDefault(import("eslint-plugin-jsonc"))]);
764
762
  return [{
765
763
  name: "so1ve/jsonc/setup",
766
764
  plugins: { jsonc: pluginJsonc }
@@ -846,6 +844,33 @@ const onlyError = () => [{
846
844
  plugins: { "only-error": pluginOnlyError }
847
845
  }];
848
846
 
847
+ //#endregion
848
+ //#region src/configs/pnpm.ts
849
+ async function pnpm() {
850
+ const [pluginPnpm, yamlParser, jsoncParser] = await Promise.all([
851
+ interopDefault(import("eslint-plugin-pnpm")),
852
+ interopDefault(import("yaml-eslint-parser")),
853
+ interopDefault(import("jsonc-eslint-parser"))
854
+ ]);
855
+ return [{
856
+ files: ["package.json", "**/package.json"],
857
+ languageOptions: { parser: jsoncParser },
858
+ name: "so1ve/pnpm/package-json",
859
+ plugins: { pnpm: pluginPnpm },
860
+ rules: {
861
+ "pnpm/json-enforce-catalog": "error",
862
+ "pnpm/json-prefer-workspace-settings": "error",
863
+ "pnpm/json-valid-catalog": "error"
864
+ }
865
+ }, {
866
+ files: ["pnpm-workspace.yaml"],
867
+ languageOptions: { parser: yamlParser },
868
+ name: "so1ve/pnpm/pnpm-workspace-yaml",
869
+ plugins: { pnpm: pluginPnpm },
870
+ rules: { "pnpm/yaml-no-unused-catalog-item": "error" }
871
+ }];
872
+ }
873
+
849
874
  //#endregion
850
875
  //#region src/configs/promise.ts
851
876
  const promise = () => [{
@@ -893,9 +918,11 @@ const sortImports = () => [{
893
918
  //#endregion
894
919
  //#region src/configs/test.ts
895
920
  async function test({ overrides } = {}) {
896
- const pluginNoOnlyTests = await interopDefault(import("eslint-plugin-no-only-tests"));
897
- const pluginVitest = await interopDefault(import("@vitest/eslint-plugin"));
898
- const pluginJestFormatting = await interopDefault(import("eslint-plugin-jest-formatting"));
921
+ const [pluginNoOnlyTests, pluginVitest, pluginJestFormatting] = await Promise.all([
922
+ interopDefault(import("eslint-plugin-no-only-tests")),
923
+ interopDefault(import("@vitest/eslint-plugin")),
924
+ interopDefault(import("eslint-plugin-jest-formatting"))
925
+ ]);
899
926
  return [{
900
927
  name: "so1ve/test/setup",
901
928
  plugins: {
@@ -933,8 +960,7 @@ async function test({ overrides } = {}) {
933
960
  //#endregion
934
961
  //#region src/configs/toml.ts
935
962
  async function toml({ overrides } = {}) {
936
- const parserToml = await interopDefault(import("toml-eslint-parser"));
937
- const pluginToml = await interopDefault(import("eslint-plugin-toml"));
963
+ const [parserToml, pluginToml] = await Promise.all([interopDefault(import("toml-eslint-parser")), interopDefault(import("eslint-plugin-toml"))]);
938
964
  return [{
939
965
  name: "so1ve/toml/setup",
940
966
  plugins: { toml: pluginToml }
@@ -1248,8 +1274,7 @@ const unicorn = () => [{
1248
1274
  //#endregion
1249
1275
  //#region src/configs/vue.ts
1250
1276
  async function vue({ overrides, typescript: typescript$1 } = {}) {
1251
- const parserVue = await interopDefault(import("vue-eslint-parser"));
1252
- const pluginVue = await interopDefault(import("eslint-plugin-vue"));
1277
+ const [parserVue, pluginVue] = await Promise.all([interopDefault(import("vue-eslint-parser")), interopDefault(import("eslint-plugin-vue"))]);
1253
1278
  return [{
1254
1279
  name: "so1ve/vue/setup",
1255
1280
  plugins: { vue: pluginVue }
@@ -1370,7 +1395,6 @@ async function vue({ overrides, typescript: typescript$1 } = {}) {
1370
1395
  "table",
1371
1396
  "time"
1372
1397
  ] }],
1373
- "vue/camelcase": "error",
1374
1398
  "vue/v-for-delimiter-style": ["error", "in"],
1375
1399
  "vue/attributes-order": ["error", {
1376
1400
  order: [
@@ -1435,8 +1459,7 @@ async function vue({ overrides, typescript: typescript$1 } = {}) {
1435
1459
  //#endregion
1436
1460
  //#region src/configs/yaml.ts
1437
1461
  async function yaml({ overrides } = {}) {
1438
- const parserYaml = await interopDefault(import("yaml-eslint-parser"));
1439
- const pluginYaml = await interopDefault(import("eslint-plugin-yml"));
1462
+ const [parserYaml, pluginYaml] = await Promise.all([interopDefault(import("yaml-eslint-parser")), interopDefault(import("eslint-plugin-yml"))]);
1440
1463
  return [{
1441
1464
  name: "so1ve/yaml/setup",
1442
1465
  plugins: { yaml: pluginYaml }
@@ -1484,12 +1507,13 @@ const defaultPluginRenaming = {
1484
1507
  * Construct an array of ESLint flat config items.
1485
1508
  */
1486
1509
  function so1ve(options = {}, ...userConfigs) {
1487
- const { vue: enableVue = VuePackages.some((i) => isPackageExists(i)), solid: enableSolid = isPackageExists("solid-js"), typescript: enableTypeScript = isPackageExists("typescript"), gitignore: enableGitignore = true, componentExts = [] } = options;
1510
+ const { vue: enableVue = VuePackages.some((i) => isPackageExists(i)), solid: enableSolid = isPackageExists("solid-js"), typescript: enableTypeScript = isPackageExists("typescript"), gitignore: enableGitignore = true, pnpm: enableCatalogs = false, componentExts = [] } = options;
1488
1511
  const configs = [];
1489
1512
  if (enableGitignore) if (typeof enableGitignore === "boolean") {
1490
1513
  if (fs.existsSync(".gitignore")) configs.push(interopDefault(import("eslint-config-flat-gitignore")).then((r) => [r()]));
1491
1514
  } else configs.push(interopDefault(import("eslint-config-flat-gitignore")).then((r) => [r(enableGitignore)]));
1492
1515
  configs.push(ignores(), javascript({ overrides: getOverrides(options, "javascript") }), comments(), node(), onlyError(), promise(), sortImports(), imports(), unicorn());
1516
+ if (enableCatalogs) configs.push(pnpm());
1493
1517
  if (enableVue) componentExts.push("vue");
1494
1518
  if (options.html ?? true) configs.push(html());
1495
1519
  if (enableTypeScript) configs.push(typescript({
@@ -1531,4 +1555,4 @@ function getOverrides(options, key) {
1531
1555
  }
1532
1556
 
1533
1557
  //#endregion
1534
- export { GLOB_ALL_SRC, GLOB_CSS, GLOB_DTS, GLOB_ESLINTRC, GLOB_EXCLUDE, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LESS, GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_PACKAGEJSON, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_TESTS, GLOB_TOML, GLOB_TS, GLOB_TSCONFIG, GLOB_TSX, GLOB_VUE, GLOB_YAML, comments, defaultPluginRenaming, formatting, getOverrides, html, ignores, imports, interopDefault, javascript, jsonc, mdx, node, onlyError, promise, renameRules, resolveSubOptions, so1ve, solid, sortImports, test, toml, typescript, unicorn, vue, yaml };
1558
+ export { GLOB_ALL_SRC, GLOB_CSS, GLOB_DTS, GLOB_ESLINTRC, GLOB_EXCLUDE, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LESS, GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_PACKAGEJSON, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_TESTS, GLOB_TOML, GLOB_TS, GLOB_TSCONFIG, GLOB_TSX, GLOB_VUE, GLOB_YAML, comments, defaultPluginRenaming, formatting, getOverrides, html, ignores, imports, interopDefault, javascript, jsonc, mdx, node, onlyError, pnpm, promise, renameRules, resolveSubOptions, so1ve, solid, sortImports, test, toml, typescript, unicorn, vue, yaml };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@so1ve/eslint-config",
3
- "version": "3.7.0",
3
+ "version": "3.8.0",
4
4
  "author": "Ray <i@mk1.io> (https://github.com/so1ve/)",
5
5
  "type": "module",
6
6
  "description": "Ray's eslint config.",
@@ -54,6 +54,7 @@
54
54
  "eslint-plugin-no-explicit-type-exports": "^0.12.1",
55
55
  "eslint-plugin-no-only-tests": "^3.3.0",
56
56
  "eslint-plugin-only-error": "^1.0.2",
57
+ "eslint-plugin-pnpm": "^1.0.0",
57
58
  "eslint-plugin-promise": "^7.2.1",
58
59
  "eslint-plugin-regexp": "^2.9.0",
59
60
  "eslint-plugin-solid": "^0.14.5",
@@ -69,15 +70,15 @@
69
70
  "typescript-eslint": "^8.34.0",
70
71
  "vue-eslint-parser": "^10.1.3",
71
72
  "yaml-eslint-parser": "^1.3.0",
72
- "@so1ve/eslint-plugin-sort-imports": "3.7.0",
73
- "@so1ve/eslint-plugin": "3.7.0"
73
+ "@so1ve/eslint-plugin": "3.8.0",
74
+ "@so1ve/eslint-plugin-sort-imports": "3.8.0"
74
75
  },
75
76
  "devDependencies": {
76
77
  "@typescript-eslint/utils": "^8.34.0"
77
78
  },
78
79
  "peerDependencies": {
79
- "eslint": ">=8.40.0",
80
- "prettier": "^3.0.0"
80
+ "eslint": "^9",
81
+ "prettier": "^3"
81
82
  },
82
83
  "scripts": {
83
84
  "build": "tsdown && nr typegen",