@lincy/eslint-config 6.4.0 → 6.5.1

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.mjs CHANGED
@@ -14,7 +14,6 @@ import pluginUnicorn from "eslint-plugin-unicorn";
14
14
  import pluginUnusedImports from "eslint-plugin-unused-imports";
15
15
  import globals from "globals";
16
16
  import { mergeProcessors, processorPassThrough } from "eslint-merge-processors";
17
- import * as parserPlain$1 from "eslint-parser-plain";
18
17
  import { configs } from "eslint-plugin-regexp";
19
18
 
20
19
  //#region node_modules/.pnpm/find-up-simple@1.0.1/node_modules/find-up-simple/index.js
@@ -323,7 +322,7 @@ async function stylistic(options = {}) {
323
322
 
324
323
  //#endregion
325
324
  //#region src/configs/formatters.ts
326
- function mergePrettierOptions(options, overrides = {}) {
325
+ function mergePrettierOptions(options, overrides) {
327
326
  return {
328
327
  ...options,
329
328
  ...overrides,
@@ -716,8 +715,11 @@ async function javascript(options = {}) {
716
715
  async function jsdoc(options = {}) {
717
716
  const { overrides = {}, stylistic: stylistic$1 = true } = options;
718
717
  return [{
718
+ name: "eslint/jsdoc/setup",
719
+ plugins: { jsdoc: await interopDefault(import("eslint-plugin-jsdoc")) }
720
+ }, {
721
+ files: [GLOB_SRC],
719
722
  name: "eslint/jsdoc/rules",
720
- plugins: { jsdoc: await interopDefault(import("eslint-plugin-jsdoc")) },
721
723
  rules: {
722
724
  "jsdoc/check-access": "warn",
723
725
  "jsdoc/check-param-names": "warn",
@@ -751,13 +753,12 @@ async function jsonc(options = {}) {
751
753
  GLOB_JSON5,
752
754
  GLOB_JSONC
753
755
  ], overrides = {}, stylistic: stylistic$1 = true } = options;
754
- const [pluginJsonc, parserJsonc] = await Promise.all([interopDefault(import("eslint-plugin-jsonc")), interopDefault(import("jsonc-eslint-parser"))]);
755
756
  return [{
756
757
  name: "eslint/jsonc/setup",
757
- plugins: { jsonc: pluginJsonc }
758
+ plugins: { jsonc: await interopDefault(import("eslint-plugin-jsonc")) }
758
759
  }, {
759
760
  files,
760
- languageOptions: { parser: parserJsonc },
761
+ language: "jsonc/x",
761
762
  name: "eslint/jsonc/rules",
762
763
  rules: {
763
764
  "jsonc/no-bigint-literals": "error",
@@ -822,7 +823,7 @@ async function jsx() {
822
823
  //#endregion
823
824
  //#region src/configs/markdown.ts
824
825
  async function markdown(options = {}) {
825
- const { componentExts = [], files = [GLOB_MARKDOWN], overrides = {} } = options;
826
+ const { componentExts = [], files = [GLOB_MARKDOWN], gfm = true, overrides = {}, overridesMarkdown = {} } = options;
826
827
  const markdown$1 = await interopDefault(import("@eslint/markdown"));
827
828
  return [
828
829
  {
@@ -837,13 +838,37 @@ async function markdown(options = {}) {
837
838
  },
838
839
  {
839
840
  files,
840
- languageOptions: { parser: parserPlain$1 },
841
+ language: gfm ? "markdown/gfm" : "markdown/commonmark",
841
842
  name: "eslint/markdown/parser"
842
843
  },
844
+ {
845
+ files,
846
+ name: "eslint/markdown/rules",
847
+ rules: {
848
+ ...markdown$1.configs.recommended.at(0)?.rules,
849
+ "markdown/no-missing-label-refs": "off",
850
+ ...overridesMarkdown
851
+ }
852
+ },
853
+ {
854
+ files,
855
+ name: "eslint/markdown/disables/markdown",
856
+ rules: {
857
+ "command/command": "off",
858
+ "no-irregular-whitespace": "off",
859
+ "perfectionist/sort-exports": "off",
860
+ "perfectionist/sort-imports": "off",
861
+ "regexp/no-legacy-features": "off",
862
+ "regexp/no-missing-g-flag": "off",
863
+ "regexp/no-useless-dollar-replacements": "off",
864
+ "regexp/no-useless-flag": "off",
865
+ "style/indent": "off"
866
+ }
867
+ },
843
868
  {
844
869
  files: [GLOB_MARKDOWN_CODE, ...componentExts.map((ext) => `${GLOB_MARKDOWN}/**/*.${ext}`)],
845
870
  languageOptions: { parserOptions: { ecmaFeatures: { impliedStrict: true } } },
846
- name: "eslint/markdown/disables",
871
+ name: "eslint/markdown/disables/code",
847
872
  rules: {
848
873
  "antfu/no-top-level-await": "off",
849
874
  "import/newline-after-import": "off",
@@ -1009,45 +1034,48 @@ async function detectCatalogUsage() {
1009
1034
  const yaml$1 = await fs.readFile(workspaceFile, "utf-8");
1010
1035
  return yaml$1.includes("catalog:") || yaml$1.includes("catalogs:");
1011
1036
  }
1012
- async function pnpm(options = {}) {
1013
- const { catalogs = await detectCatalogUsage(), isInEditor = false } = options;
1014
- const [pluginPnpm, yamlParser, jsoncParser] = await Promise.all([
1037
+ async function pnpm(options) {
1038
+ const [pluginPnpm, pluginYaml, yamlParser] = await Promise.all([
1015
1039
  interopDefault(import("eslint-plugin-pnpm")),
1016
- interopDefault(import("yaml-eslint-parser")),
1017
- interopDefault(import("jsonc-eslint-parser"))
1040
+ interopDefault(import("eslint-plugin-yml")),
1041
+ interopDefault(import("yaml-eslint-parser"))
1018
1042
  ]);
1019
- return [
1020
- {
1021
- files: ["package.json", "**/package.json"],
1022
- languageOptions: { parser: jsoncParser },
1023
- name: "eslint/pnpm/package-json",
1024
- plugins: { pnpm: pluginPnpm },
1025
- rules: {
1026
- ...catalogs ? { "pnpm/json-enforce-catalog": ["error", {
1027
- autofix: !isInEditor,
1028
- ignores: ["@types/vscode"]
1029
- }] } : {},
1030
- "pnpm/json-prefer-workspace-settings": ["error", { autofix: isInEditor }],
1031
- "pnpm/json-valid-catalog": ["error", { autofix: isInEditor }]
1032
- }
1033
- },
1034
- {
1043
+ const { catalogs = await detectCatalogUsage(), isInEditor = false, json = true, sort = true, yaml: yaml$1 = true } = options;
1044
+ const configs$1 = [];
1045
+ if (json) configs$1.push({
1046
+ files: ["package.json", "**/package.json"],
1047
+ language: "jsonc/x",
1048
+ name: "eslint/pnpm/package-json",
1049
+ plugins: { pnpm: pluginPnpm },
1050
+ rules: {
1051
+ ...catalogs ? { "pnpm/json-enforce-catalog": ["error", {
1052
+ autofix: !isInEditor,
1053
+ ignores: ["@types/vscode"]
1054
+ }] } : {},
1055
+ "pnpm/json-prefer-workspace-settings": ["error", { autofix: !isInEditor }],
1056
+ "pnpm/json-valid-catalog": ["error", { autofix: !isInEditor }]
1057
+ }
1058
+ });
1059
+ if (yaml$1) {
1060
+ configs$1.push({
1035
1061
  files: ["pnpm-workspace.yaml"],
1036
1062
  languageOptions: { parser: yamlParser },
1037
1063
  name: "eslint/pnpm/pnpm-workspace-yaml",
1038
1064
  plugins: { pnpm: pluginPnpm },
1039
1065
  rules: {
1040
1066
  "pnpm/yaml-enforce-settings": ["error", { settings: {
1041
- catalogMode: "prefer",
1042
- shellEmulator: true
1067
+ shellEmulator: true,
1068
+ trustPolicy: "no-downgrade"
1043
1069
  } }],
1044
1070
  "pnpm/yaml-no-duplicate-catalog-item": "error",
1045
1071
  "pnpm/yaml-no-unused-catalog-item": "error"
1046
1072
  }
1047
- },
1048
- {
1073
+ });
1074
+ if (sort) configs$1.push({
1049
1075
  files: ["pnpm-workspace.yaml"],
1050
- name: "eslint/yaml/pnpm-workspace",
1076
+ languageOptions: { parser: yamlParser },
1077
+ name: "eslint/pnpm/pnpm-workspace-yaml-sort",
1078
+ plugins: { yaml: pluginYaml },
1051
1079
  rules: { "yaml/sort-keys": [
1052
1080
  "error",
1053
1081
  {
@@ -1120,8 +1148,9 @@ async function pnpm(options = {}) {
1120
1148
  pathPattern: ".*"
1121
1149
  }
1122
1150
  ] }
1123
- }
1124
- ];
1151
+ });
1152
+ }
1153
+ return configs$1;
1125
1154
  }
1126
1155
 
1127
1156
  //#endregion
@@ -1149,7 +1178,10 @@ async function react(options = {}) {
1149
1178
  "eslint-plugin-react-refresh"
1150
1179
  ]);
1151
1180
  const isTypeAware = !!tsconfigPath;
1152
- const typeAwareRules = { "react/no-leaked-conditional-rendering": "warn" };
1181
+ const typeAwareRules = {
1182
+ "react/no-implicit-key": "error",
1183
+ "react/no-leaked-conditional-rendering": "warn"
1184
+ };
1153
1185
  const [pluginReact, pluginReactHooks, pluginReactRefresh] = await Promise.all([
1154
1186
  interopDefault(import("@eslint-react/eslint-plugin")),
1155
1187
  interopDefault(import("eslint-plugin-react-hooks")),
@@ -1170,6 +1202,7 @@ async function react(options = {}) {
1170
1202
  "react-hooks-extra": plugins["@eslint-react/hooks-extra"],
1171
1203
  "react-naming-convention": plugins["@eslint-react/naming-convention"],
1172
1204
  "react-refresh": pluginReactRefresh,
1205
+ "react-rsc": plugins["@eslint-react/rsc"],
1173
1206
  "react-web-api": plugins["@eslint-react/web-api"]
1174
1207
  }
1175
1208
  },
@@ -1193,8 +1226,17 @@ async function react(options = {}) {
1193
1226
  "react-dom/no-unsafe-iframe-sandbox": "warn",
1194
1227
  "react-dom/no-use-form-state": "error",
1195
1228
  "react-dom/no-void-elements-with-children": "error",
1229
+ "react-hooks-extra/no-direct-set-state-in-use-effect": "warn",
1196
1230
  "react-hooks/exhaustive-deps": "warn",
1197
1231
  "react-hooks/rules-of-hooks": "error",
1232
+ "react-naming-convention/context-name": "warn",
1233
+ "react-naming-convention/ref-name": "warn",
1234
+ "react-naming-convention/use-state": "warn",
1235
+ "react-rsc/function-definition": "error",
1236
+ "react-web-api/no-leaked-event-listener": "warn",
1237
+ "react-web-api/no-leaked-interval": "warn",
1238
+ "react-web-api/no-leaked-resize-observer": "warn",
1239
+ "react-web-api/no-leaked-timeout": "warn",
1198
1240
  "react/jsx-key-before-spread": "warn",
1199
1241
  "react/jsx-no-comment-textnodes": "warn",
1200
1242
  "react/jsx-no-duplicate-props": "warn",
@@ -1215,9 +1257,7 @@ async function react(options = {}) {
1215
1257
  "react/no-create-ref": "error",
1216
1258
  "react/no-default-props": "error",
1217
1259
  "react/no-direct-mutation-state": "error",
1218
- "react/no-duplicate-key": "error",
1219
1260
  "react/no-forward-ref": "warn",
1220
- "react/no-implicit-key": "warn",
1221
1261
  "react/no-missing-key": "error",
1222
1262
  "react/no-nested-component-definitions": "error",
1223
1263
  "react/no-nested-lazy-component-declarations": "error",
@@ -1231,6 +1271,7 @@ async function react(options = {}) {
1231
1271
  "react/no-unsafe-component-will-mount": "warn",
1232
1272
  "react/no-unsafe-component-will-receive-props": "warn",
1233
1273
  "react/no-unsafe-component-will-update": "warn",
1274
+ "react/no-unused-class-component-members": "warn",
1234
1275
  "react/no-use-context": "warn",
1235
1276
  "react/no-useless-forward-ref": "warn",
1236
1277
  "react/prefer-namespace-import": "error",
@@ -1252,8 +1293,7 @@ async function react(options = {}) {
1252
1293
  "react-hooks/unsupported-syntax": "warn",
1253
1294
  "react-hooks/use-memo": "error"
1254
1295
  } : {},
1255
- "react-hooks-extra/no-direct-set-state-in-use-effect": "warn",
1256
- "react-refresh/only-export-components": ["warn", {
1296
+ "react-refresh/only-export-components": ["error", {
1257
1297
  allowConstantExport: isAllowConstantExport,
1258
1298
  allowExportNames: [...isUsingNext ? [
1259
1299
  "dynamic",
@@ -1263,12 +1303,13 @@ async function react(options = {}) {
1263
1303
  "runtime",
1264
1304
  "preferredRegion",
1265
1305
  "maxDuration",
1266
- "config",
1267
1306
  "generateStaticParams",
1268
1307
  "metadata",
1269
1308
  "generateMetadata",
1270
1309
  "viewport",
1271
- "generateViewport"
1310
+ "generateViewport",
1311
+ "generateImageMetadata",
1312
+ "generateSitemaps"
1272
1313
  ] : [], ...isUsingRemix || isUsingReactRouter ? [
1273
1314
  "meta",
1274
1315
  "links",
@@ -1281,13 +1322,21 @@ async function react(options = {}) {
1281
1322
  "shouldRevalidate"
1282
1323
  ] : []]
1283
1324
  }],
1284
- "react-web-api/no-leaked-event-listener": "warn",
1285
- "react-web-api/no-leaked-interval": "warn",
1286
- "react-web-api/no-leaked-resize-observer": "warn",
1287
- "react-web-api/no-leaked-timeout": "warn",
1288
1325
  ...overrides
1289
1326
  }
1290
1327
  },
1328
+ {
1329
+ files: filesTypeAware,
1330
+ name: "eslint/react/typescript",
1331
+ rules: {
1332
+ "react-dom/no-string-style-prop": "off",
1333
+ "react-dom/no-unknown-property": "off",
1334
+ "react/jsx-no-duplicate-props": "off",
1335
+ "react/jsx-no-undef": "off",
1336
+ "react/jsx-uses-react": "off",
1337
+ "react/jsx-uses-vars": "off"
1338
+ }
1339
+ },
1291
1340
  ...isTypeAware ? [{
1292
1341
  files: filesTypeAware,
1293
1342
  ignores: ignoresTypeAware,
@@ -1611,7 +1660,7 @@ async function toml(options = {}) {
1611
1660
  "toml/array-bracket-newline": "error",
1612
1661
  "toml/array-bracket-spacing": "error",
1613
1662
  "toml/array-element-newline": "error",
1614
- "toml/indent": ["error", indent === "tab" ? 4 : indent],
1663
+ "toml/indent": ["error", typeof indent === "number" ? indent : indent === "tab" ? "tab" : 4],
1615
1664
  "toml/inline-table-curly-spacing": "error",
1616
1665
  "toml/key-spacing": "error",
1617
1666
  "toml/padding-line-between-pairs": "error",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@lincy/eslint-config",
3
3
  "type": "module",
4
- "version": "6.4.0",
4
+ "version": "6.5.1",
5
5
  "description": "LinCenYing's ESLint config",
6
6
  "author": "LinCenYing <lincenying@gmail.com> (https://github.com/lincenying/)",
7
7
  "license": "MIT",
@@ -27,7 +27,7 @@
27
27
  "@next/eslint-plugin-next": ">=15.0.0",
28
28
  "@prettier/plugin-xml": "^3.4.1",
29
29
  "@unocss/eslint-plugin": ">=0.50.0",
30
- "eslint": "^9.10.0",
30
+ "eslint": "^10.0.0",
31
31
  "eslint-plugin-format": ">=0.1.0",
32
32
  "eslint-plugin-react-hooks": "^7.0.0",
33
33
  "eslint-plugin-react-refresh": "^0.4.19"
@@ -57,69 +57,69 @@
57
57
  },
58
58
  "dependencies": {
59
59
  "@antfu/install-pkg": "^1.1.0",
60
- "@clack/prompts": "^0.11.0",
60
+ "@clack/prompts": "^1.0.1",
61
61
  "@eslint-community/eslint-plugin-eslint-comments": "^4.6.0",
62
62
  "@eslint/markdown": "^7.5.1",
63
- "@stylistic/eslint-plugin": "^5.7.0",
64
- "@typescript-eslint/eslint-plugin": "^8.53.0",
65
- "@typescript-eslint/parser": "^8.53.0",
66
- "@vitest/eslint-plugin": "^1.6.6",
67
- "eslint-config-flat-gitignore": "^2.1.0",
68
- "eslint-flat-config-utils": "^2.1.4",
63
+ "@stylistic/eslint-plugin": "^5.9.0",
64
+ "@typescript-eslint/eslint-plugin": "^8.56.1",
65
+ "@typescript-eslint/parser": "^8.56.1",
66
+ "@vitest/eslint-plugin": "^1.6.9",
67
+ "eslint-config-flat-gitignore": "^2.2.1",
68
+ "eslint-flat-config-utils": "^3.0.1",
69
69
  "eslint-merge-processors": "^2.0.0",
70
70
  "eslint-parser-plain": "^0.1.1",
71
- "eslint-plugin-antfu": "^3.1.3",
71
+ "eslint-plugin-antfu": "^3.2.2",
72
72
  "eslint-plugin-erasable-syntax-only": "^0.4.0",
73
- "eslint-plugin-import-lite": "^0.5.0",
74
- "eslint-plugin-jsdoc": "^61.7.1",
75
- "eslint-plugin-jsonc": "^2.21.0",
76
- "eslint-plugin-n": "^17.23.2",
73
+ "eslint-plugin-import-lite": "^0.5.2",
74
+ "eslint-plugin-jsdoc": "^62.7.1",
75
+ "eslint-plugin-jsonc": "^3.1.1",
76
+ "eslint-plugin-n": "^17.24.0",
77
77
  "eslint-plugin-no-only-tests": "^3.3.0",
78
- "eslint-plugin-perfectionist": "^5.3.1",
79
- "eslint-plugin-pnpm": "^1.4.3",
80
- "eslint-plugin-regexp": "^2.10.0",
81
- "eslint-plugin-toml": "^1.0.0",
82
- "eslint-plugin-unicorn": "^62.0.0",
83
- "eslint-plugin-unused-imports": "^4.3.0",
84
- "eslint-plugin-vue": "^10.6.2",
85
- "eslint-plugin-yml": "^1.19.1",
78
+ "eslint-plugin-perfectionist": "^5.6.0",
79
+ "eslint-plugin-pnpm": "^1.6.0",
80
+ "eslint-plugin-regexp": "^3.0.0",
81
+ "eslint-plugin-toml": "^1.3.0",
82
+ "eslint-plugin-unicorn": "^63.0.0",
83
+ "eslint-plugin-unused-imports": "^4.4.1",
84
+ "eslint-plugin-vue": "^10.8.0",
85
+ "eslint-plugin-yml": "^3.3.0",
86
86
  "eslint-processor-vue-blocks": "^2.0.0",
87
- "globals": "^17.0.0",
88
- "jsonc-eslint-parser": "^2.4.2",
87
+ "globals": "^17.3.0",
88
+ "jsonc-eslint-parser": "^3.1.0",
89
89
  "local-pkg": "^1.1.2",
90
- "toml-eslint-parser": "^1.0.1",
91
- "vue-eslint-parser": "^10.2.0",
92
- "yaml-eslint-parser": "^1.3.2"
90
+ "toml-eslint-parser": "^1.0.3",
91
+ "vue-eslint-parser": "^10.4.0",
92
+ "yaml-eslint-parser": "^2.0.0"
93
93
  },
94
94
  "devDependencies": {
95
95
  "@antfu/ni": "^28.2.0",
96
- "@eslint-react/eslint-plugin": "^2.6.0",
96
+ "@eslint-react/eslint-plugin": "^2.13.0",
97
97
  "@eslint/config-inspector": "^1.4.2",
98
- "@next/eslint-plugin-next": "^16.1.1",
98
+ "@next/eslint-plugin-next": "^16.1.6",
99
99
  "@prettier/plugin-xml": "^3.4.2",
100
100
  "@stylistic/eslint-plugin-migrate": "^4.4.1",
101
- "@types/node": "^24.10.8",
102
- "@types/react": "^19.2.8",
103
- "@unocss/eslint-plugin": "^66.5.12",
104
- "bumpp": "^10.4.0",
105
- "eslint": "^9.39.2",
106
- "eslint-plugin-format": "^1.3.1",
101
+ "@types/node": "^25.3.2",
102
+ "@types/react": "^19.2.14",
103
+ "@unocss/eslint-plugin": "^66.6.2",
104
+ "bumpp": "^10.4.1",
105
+ "eslint": "^10.0.2",
106
+ "eslint-plugin-format": "^2.0.1",
107
107
  "eslint-plugin-react-hooks": "^7.0.1",
108
- "eslint-plugin-react-refresh": "^0.4.26",
109
- "eslint-typegen": "^2.3.0",
108
+ "eslint-plugin-react-refresh": "^0.5.2",
109
+ "eslint-typegen": "^2.3.1",
110
110
  "esno": "^4.8.0",
111
111
  "execa": "^9.6.1",
112
112
  "find-up-simple": "^1.0.1",
113
113
  "lint-staged": "^16.2.7",
114
- "prettier": "^3.7.4",
115
- "react": "^19.2.3",
114
+ "prettier": "^3.8.1",
115
+ "react": "^19.2.4",
116
116
  "simple-open-url": "^3.0.1",
117
117
  "tinyglobby": "^0.2.15",
118
- "tsdown": "^0.17.4",
118
+ "tsdown": "^0.18.4",
119
119
  "typescript": "^5.9.3",
120
- "vitest": "^4.0.17",
121
- "vue": "^3.5.26",
122
- "@lincy/eslint-config": "6.4.0"
120
+ "vitest": "^4.0.18",
121
+ "vue": "^3.5.29",
122
+ "@lincy/eslint-config": "6.5.1"
123
123
  },
124
124
  "resolutions": {
125
125
  "@eslint-community/eslint-utils": "catalog:peer",