@so1ve/eslint-config 3.9.0 → 3.10.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/dist/index.js CHANGED
@@ -1,4 +1,3 @@
1
- import { __toDynamicImportESM } from "./chunk-RDQt0V5E.js";
2
1
  import pluginComments from "@eslint-community/eslint-plugin-eslint-comments";
3
2
  import pluginSo1ve from "@so1ve/eslint-plugin";
4
3
  import pluginSortImports from "@so1ve/eslint-plugin-sort-imports";
@@ -17,22 +16,6 @@ import fs from "node:fs";
17
16
  import { FlatConfigComposer } from "eslint-flat-config-utils";
18
17
  import { isPackageExists } from "local-pkg";
19
18
 
20
- //#region src/configs/comments.ts
21
- const comments = () => [{
22
- name: "so1ve/comments/setup",
23
- plugins: { "eslint-comments": pluginComments }
24
- }, {
25
- name: "so1ve/comments/rules",
26
- rules: {
27
- "eslint-comments/no-aggregating-enable": "error",
28
- "eslint-comments/no-duplicate-disable": "error",
29
- "eslint-comments/no-unused-enable": "error",
30
- "eslint-comments/disable-enable-pair": "off",
31
- "eslint-comments/no-unlimited-disable": "off"
32
- }
33
- }];
34
-
35
- //#endregion
36
19
  //#region src/globs.ts
37
20
  const GLOB_SRC_EXT = "?([cm])[jt]s?(x)";
38
21
  const GLOB_SRC = `**/*.${GLOB_SRC_EXT}`;
@@ -142,14 +125,70 @@ async function interopDefault(m) {
142
125
  return resolved.default ?? resolved;
143
126
  }
144
127
 
128
+ //#endregion
129
+ //#region src/configs/astro.ts
130
+ async function astro({ overrides = {} } = {}) {
131
+ const [pluginAstro, parserAstro, parserTs] = await Promise.all([
132
+ interopDefault(import("eslint-plugin-astro")),
133
+ interopDefault(import("astro-eslint-parser")),
134
+ interopDefault(import("@typescript-eslint/parser"))
135
+ ]);
136
+ return [{
137
+ name: "antfu/astro/setup",
138
+ plugins: { astro: pluginAstro }
139
+ }, {
140
+ files: [GLOB_ASTRO],
141
+ languageOptions: {
142
+ globals: pluginAstro.environments.astro.globals,
143
+ parser: parserAstro,
144
+ parserOptions: {
145
+ extraFileExtensions: [".astro"],
146
+ parser: parserTs
147
+ },
148
+ sourceType: "module"
149
+ },
150
+ name: "antfu/astro/rules",
151
+ processor: "astro/client-side-ts",
152
+ rules: {
153
+ "antfu/no-top-level-await": "off",
154
+ "astro/missing-client-only-directive-value": "error",
155
+ "astro/no-conflict-set-directives": "error",
156
+ "astro/no-deprecated-astro-canonicalurl": "error",
157
+ "astro/no-deprecated-astro-fetchcontent": "error",
158
+ "astro/no-deprecated-astro-resolve": "error",
159
+ "astro/no-deprecated-getentrybyslug": "error",
160
+ "astro/no-set-html-directive": "off",
161
+ "astro/no-unused-define-vars-in-style": "error",
162
+ "astro/semi": "off",
163
+ "astro/valid-compile": "error",
164
+ ...overrides
165
+ }
166
+ }];
167
+ }
168
+
169
+ //#endregion
170
+ //#region src/configs/comments.ts
171
+ const comments = () => [{
172
+ name: "so1ve/comments/setup",
173
+ plugins: { "eslint-comments": pluginComments }
174
+ }, {
175
+ name: "so1ve/comments/rules",
176
+ rules: {
177
+ "eslint-comments/no-aggregating-enable": "error",
178
+ "eslint-comments/no-duplicate-disable": "error",
179
+ "eslint-comments/no-unused-enable": "error",
180
+ "eslint-comments/disable-enable-pair": "off",
181
+ "eslint-comments/no-unlimited-disable": "off"
182
+ }
183
+ }];
184
+
145
185
  //#endregion
146
186
  //#region src/configs/formatting.ts
147
187
  async function formatting(options) {
148
- const pluginStylistic = await interopDefault(import("@stylistic/eslint-plugin"));
149
188
  return [
150
189
  {
151
190
  name: "so1ve/formatting/setup",
152
- plugins: { style: pluginStylistic }
191
+ plugins: { style: await interopDefault(import("@stylistic/eslint-plugin")) }
153
192
  },
154
193
  {
155
194
  name: "so1ve/formatting/rules",
@@ -162,6 +201,7 @@ async function formatting(options) {
162
201
  "so1ve/function-style": "error",
163
202
  "style/quote-props": ["error", "consistent-as-needed"],
164
203
  "style/curly-newline": ["error", { minElements: 1 }],
204
+ "style/no-extra-parens": ["error", "functions"],
165
205
  "style/padding-line-between-statements": ["error", {
166
206
  blankLine: "always",
167
207
  prev: "*",
@@ -171,6 +211,21 @@ async function formatting(options) {
171
211
  "error",
172
212
  "always",
173
213
  { exceptAfterSingleLine: true }
214
+ ],
215
+ "style/spaced-comment": [
216
+ "error",
217
+ "always",
218
+ {
219
+ line: {
220
+ markers: ["/"],
221
+ exceptions: ["/", "#"]
222
+ },
223
+ block: {
224
+ markers: ["!"],
225
+ exceptions: ["*"],
226
+ balanced: true
227
+ }
228
+ }
174
229
  ]
175
230
  }
176
231
  },
@@ -527,7 +582,6 @@ async function javascript({ overrides } = {}) {
527
582
  "no-extend-native": "error",
528
583
  "no-extra-bind": "error",
529
584
  "no-extra-boolean-cast": "error",
530
- "no-extra-parens": ["error", "functions"],
531
585
  "no-fallthrough": "error",
532
586
  "no-func-assign": "error",
533
587
  "no-global-assign": "error",
@@ -544,8 +598,8 @@ async function javascript({ overrides } = {}) {
544
598
  "no-loss-of-precision": "error",
545
599
  "no-misleading-character-class": "error",
546
600
  "no-new-func": "error",
547
- "no-new-object": "error",
548
- "no-new-symbol": "error",
601
+ "no-object-constructor": "error",
602
+ "no-new-native-nonconstructor": "error",
549
603
  "no-new-wrappers": "error",
550
604
  "no-prototype-builtins": "error",
551
605
  "no-useless-catch": "error",
@@ -680,21 +734,6 @@ async function javascript({ overrides } = {}) {
680
734
  "prefer-promise-reject-errors": "error",
681
735
  "prefer-regex-literals": ["error", { disallowRedundantWrapping: true }],
682
736
  "yoda": ["error", "never"],
683
- "spaced-comment": [
684
- "error",
685
- "always",
686
- {
687
- line: {
688
- markers: ["/"],
689
- exceptions: ["/", "#"]
690
- },
691
- block: {
692
- markers: ["!"],
693
- exceptions: ["*"],
694
- balanced: true
695
- }
696
- }
697
- ],
698
737
  "array-callback-return": "error",
699
738
  "block-scoped-var": "error",
700
739
  "no-unused-expressions": ["error", {
@@ -974,7 +1013,7 @@ async function toml({ overrides } = {}) {
974
1013
  rules: {
975
1014
  ...pluginToml.configs.recommended.rules,
976
1015
  "no-irregular-whitespace": "off",
977
- "spaced-comment": "off",
1016
+ "style/spaced-comment": "off",
978
1017
  ...overrides
979
1018
  }
980
1019
  }];
@@ -1030,6 +1069,7 @@ const typescript = async ({ componentExts = [], parserOptions, overrides } = {})
1030
1069
  ...b
1031
1070
  }), {}), { "@typescript-eslint": "ts" }),
1032
1071
  "import/named": "off",
1072
+ "so1ve/prefer-ts-expect-error": "error",
1033
1073
  "ts/comma-dangle": "off",
1034
1074
  "ts/brace-style": "off",
1035
1075
  "ts/comma-spacing": "off",
@@ -1037,7 +1077,6 @@ const typescript = async ({ componentExts = [], parserOptions, overrides } = {})
1037
1077
  "ts/indent": "off",
1038
1078
  "ts/keyword-spacing": "off",
1039
1079
  "ts/member-delimiter-style": "off",
1040
- "ts/no-extra-parens": "off",
1041
1080
  "ts/no-extra-semi": "off",
1042
1081
  "ts/quotes": "off",
1043
1082
  "ts/semi": "off",
@@ -1086,7 +1125,6 @@ const typescript = async ({ componentExts = [], parserOptions, overrides } = {})
1086
1125
  }],
1087
1126
  "ts/consistent-type-definitions": ["error", "interface"],
1088
1127
  "ts/consistent-indexed-object-style": ["error", "record"],
1089
- "ts/prefer-ts-expect-error": "error",
1090
1128
  "ts/prefer-for-of": "error",
1091
1129
  "ts/no-duplicate-enum-values": "error",
1092
1130
  "ts/no-non-null-asserted-nullish-coalescing": "error",
@@ -1113,8 +1151,6 @@ const typescript = async ({ componentExts = [], parserOptions, overrides } = {})
1113
1151
  "space-before-function-paren": "off",
1114
1152
  "no-dupe-class-members": "off",
1115
1153
  "ts/no-dupe-class-members": "error",
1116
- "no-loss-of-precision": "off",
1117
- "ts/no-loss-of-precision": "error",
1118
1154
  "so1ve/no-inline-type-import": "error",
1119
1155
  "ts/camelcase": "off",
1120
1156
  "ts/explicit-function-return-type": "off",
@@ -1237,7 +1273,7 @@ const unicorn = () => [{
1237
1273
  "unicorn/error-message": "error",
1238
1274
  "unicorn/escape-case": "error",
1239
1275
  "unicorn/explicit-length-check": "error",
1240
- "unicorn/no-instanceof-array": "error",
1276
+ "unicorn/no-instanceof-builtins": "error",
1241
1277
  "unicorn/no-new-buffer": "error",
1242
1278
  "unicorn/no-new-array": "error",
1243
1279
  "unicorn/no-array-for-each": "error",
@@ -1435,7 +1471,6 @@ async function vue({ overrides, typescript: typescript$1 } = {}) {
1435
1471
  "vue/no-multiple-template-root": "off",
1436
1472
  "vue/multiline-html-element-content-newline": "off",
1437
1473
  "vue/singleline-html-element-content-newline": "off",
1438
- "vue/no-extra-parens": "off",
1439
1474
  "vue/array-bracket-spacing": "off",
1440
1475
  "vue/arrow-spacing": "off",
1441
1476
  "vue/block-spacing": "off",
@@ -1473,48 +1508,7 @@ async function yaml({ overrides } = {}) {
1473
1508
  ...renameRules(pluginYaml.configs.prettier.rules, { yml: "yaml" }),
1474
1509
  ...renameRules(pluginYaml.configs.recommended.rules, { yml: "yaml" }),
1475
1510
  "yaml/no-empty-document": "off",
1476
- "spaced-comment": "off",
1477
- ...overrides
1478
- }
1479
- }];
1480
- }
1481
-
1482
- //#endregion
1483
- //#region src/configs/astro.ts
1484
- async function astro({ overrides = {} } = {}) {
1485
- const [pluginAstro, parserAstro, parserTs] = await Promise.all([
1486
- interopDefault(import("eslint-plugin-astro")),
1487
- interopDefault(import("astro-eslint-parser")),
1488
- interopDefault(import("./dist-CNSADWmJ.js").then(__toDynamicImportESM(1)))
1489
- ]);
1490
- return [{
1491
- name: "antfu/astro/setup",
1492
- plugins: { astro: pluginAstro }
1493
- }, {
1494
- files: [GLOB_ASTRO],
1495
- languageOptions: {
1496
- globals: pluginAstro.environments.astro.globals,
1497
- parser: parserAstro,
1498
- parserOptions: {
1499
- extraFileExtensions: [".astro"],
1500
- parser: parserTs
1501
- },
1502
- sourceType: "module"
1503
- },
1504
- name: "antfu/astro/rules",
1505
- processor: "astro/client-side-ts",
1506
- rules: {
1507
- "antfu/no-top-level-await": "off",
1508
- "astro/missing-client-only-directive-value": "error",
1509
- "astro/no-conflict-set-directives": "error",
1510
- "astro/no-deprecated-astro-canonicalurl": "error",
1511
- "astro/no-deprecated-astro-fetchcontent": "error",
1512
- "astro/no-deprecated-astro-resolve": "error",
1513
- "astro/no-deprecated-getentrybyslug": "error",
1514
- "astro/no-set-html-directive": "off",
1515
- "astro/no-unused-define-vars-in-style": "error",
1516
- "astro/semi": "off",
1517
- "astro/valid-compile": "error",
1511
+ "style/spaced-comment": "off",
1518
1512
  ...overrides
1519
1513
  }
1520
1514
  }];
@@ -1586,8 +1580,7 @@ function so1ve(options = {}, ...userConfigs) {
1586
1580
  return acc;
1587
1581
  }, {});
1588
1582
  if (Object.keys(fusedConfig).length > 0) configs.push([fusedConfig]);
1589
- const composer = new FlatConfigComposer().append(...configs, ...userConfigs).renamePlugins(defaultPluginRenaming);
1590
- return composer;
1583
+ return new FlatConfigComposer().append(...configs, ...userConfigs).renamePlugins(defaultPluginRenaming);
1591
1584
  }
1592
1585
  const resolveSubOptions = (options, key) => typeof options[key] === "boolean" ? {} : options[key] ?? {};
1593
1586
  function getOverrides(options, key) {
@@ -1599,4 +1592,4 @@ function getOverrides(options, key) {
1599
1592
  }
1600
1593
 
1601
1594
  //#endregion
1602
- export { GLOB_ALL_SRC, GLOB_ASTRO, GLOB_ASTRO_TS, 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 };
1595
+ export { GLOB_ALL_SRC, GLOB_ASTRO, GLOB_ASTRO_TS, 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, astro, 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.9.0",
3
+ "version": "3.10.0",
4
4
  "author": "Ray <i@mk1.io> (https://github.com/so1ve/)",
5
5
  "type": "module",
6
6
  "description": "Ray's eslint config.",
@@ -33,54 +33,53 @@
33
33
  },
34
34
  "dependencies": {
35
35
  "@eslint-community/eslint-plugin-eslint-comments": "^4.5.0",
36
- "@html-eslint/eslint-plugin": "^0.45.0",
37
- "@html-eslint/parser": "^0.45.0",
38
- "@stylistic/eslint-plugin": "^5.2.3",
39
- "@unocss/eslint-config": "^66.4.2",
40
- "@vitest/eslint-plugin": "^1.3.4",
36
+ "@html-eslint/eslint-plugin": "^0.47.0",
37
+ "@html-eslint/parser": "^0.47.0",
38
+ "@stylistic/eslint-plugin": "^5.4.0",
39
+ "@typescript-eslint/parser": "^8.46.1",
40
+ "@typescript-eslint/utils": "^8.46.1",
41
+ "@unocss/eslint-config": "^66.5.3",
42
+ "@vitest/eslint-plugin": "^1.3.19",
41
43
  "astro-eslint-parser": "^1.2.2",
42
44
  "eslint-config-flat-gitignore": "^2.1.0",
43
- "eslint-flat-config-utils": "^2.1.1",
45
+ "eslint-flat-config-utils": "^2.1.4",
44
46
  "eslint-import-resolver-typescript": "^4.4.4",
45
47
  "eslint-mdx": "^3.6.2",
46
- "eslint-plugin-array-func": "^5.0.2",
48
+ "eslint-plugin-array-func": "^5.1.0",
47
49
  "eslint-plugin-astro": "^1.3.1",
48
50
  "eslint-plugin-case-police": "^2.0.0",
49
51
  "eslint-plugin-html": "^8.1.3",
50
52
  "eslint-plugin-import-x": "^4.16.1",
51
53
  "eslint-plugin-jest-formatting": "^3.1.0",
52
- "eslint-plugin-jsonc": "^2.20.1",
54
+ "eslint-plugin-jsonc": "^2.21.0",
53
55
  "eslint-plugin-mdx": "^3.6.2",
54
- "eslint-plugin-n": "^17.21.3",
55
- "eslint-plugin-no-await-in-promise": "^3.0.0",
56
+ "eslint-plugin-n": "^17.23.1",
57
+ "eslint-plugin-no-await-in-promise": "^3.0.1",
56
58
  "eslint-plugin-no-explicit-type-exports": "^0.12.1",
57
59
  "eslint-plugin-no-only-tests": "^3.3.0",
58
60
  "eslint-plugin-only-error": "^1.0.2",
59
- "eslint-plugin-pnpm": "^1.1.1",
61
+ "eslint-plugin-pnpm": "^1.2.0",
60
62
  "eslint-plugin-promise": "^7.2.1",
61
63
  "eslint-plugin-regexp": "^2.10.0",
62
64
  "eslint-plugin-solid": "^0.14.5",
63
65
  "eslint-plugin-toml": "^0.12.0",
64
- "eslint-plugin-unicorn": "^60.0.0",
66
+ "eslint-plugin-unicorn": "^61.0.2",
65
67
  "eslint-plugin-unused-imports": "^4.2.0",
66
- "eslint-plugin-vue": "^10.4.0",
67
- "eslint-plugin-yml": "^1.18.0",
68
- "globals": "^16.3.0",
69
- "jsonc-eslint-parser": "^2.4.0",
68
+ "eslint-plugin-vue": "^10.5.0",
69
+ "eslint-plugin-yml": "^1.19.0",
70
+ "globals": "^16.4.0",
71
+ "jsonc-eslint-parser": "^2.4.1",
70
72
  "local-pkg": "^1.1.2",
71
73
  "toml-eslint-parser": "^0.10.0",
72
- "typescript-eslint": "^8.40.0",
74
+ "typescript-eslint": "^8.46.1",
73
75
  "vue-eslint-parser": "^10.2.0",
74
76
  "yaml-eslint-parser": "^1.3.0",
75
- "@so1ve/eslint-plugin": "3.9.0",
76
- "@so1ve/eslint-plugin-sort-imports": "3.9.0"
77
- },
78
- "devDependencies": {
79
- "@typescript-eslint/utils": "^8.40.0"
77
+ "@so1ve/eslint-plugin": "3.10.0",
78
+ "@so1ve/eslint-plugin-sort-imports": "3.10.0"
80
79
  },
81
80
  "peerDependencies": {
82
- "eslint": "^9",
83
- "prettier": "^3"
81
+ "eslint": "^9.37.0",
82
+ "prettier": "^3.6.2"
84
83
  },
85
84
  "scripts": {
86
85
  "build": "tsdown && nr typegen",
@@ -1,31 +0,0 @@
1
- import { createRequire } from "node:module";
2
-
3
- //#region rolldown:runtime
4
- var __create = Object.create;
5
- var __defProp = Object.defineProperty;
6
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
7
- var __getOwnPropNames = Object.getOwnPropertyNames;
8
- var __getProtoOf = Object.getPrototypeOf;
9
- var __hasOwnProp = Object.prototype.hasOwnProperty;
10
- var __commonJS = (cb, mod) => function() {
11
- return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
12
- };
13
- var __copyProps = (to, from, except, desc) => {
14
- if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
15
- key = keys[i];
16
- if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
17
- get: ((k) => from[k]).bind(null, key),
18
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
19
- });
20
- }
21
- return to;
22
- };
23
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
24
- value: mod,
25
- enumerable: true
26
- }) : target, mod));
27
- var __toDynamicImportESM = (isNodeMode) => (mod) => __toESM(mod.default, isNodeMode);
28
- var __require = /* @__PURE__ */ createRequire(import.meta.url);
29
-
30
- //#endregion
31
- export { __commonJS, __require, __toDynamicImportESM };