@lincy/eslint-config 6.3.3 → 6.5.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.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",
@@ -964,28 +989,27 @@ async function perfectionist(options = {}) {
964
989
  }],
965
990
  "perfectionist/sort-imports": ["error", {
966
991
  groups: [
967
- "type",
968
- "builtin-type",
992
+ "type-import",
969
993
  [
970
- "index-type",
971
- "parent-type",
972
- "sibling-type",
973
- "internal-type"
994
+ "type-parent",
995
+ "type-sibling",
996
+ "type-index",
997
+ "type-internal"
974
998
  ],
975
- "builtin",
976
- "external",
977
- "internal",
999
+ "value-builtin",
1000
+ "value-external",
1001
+ "value-internal",
978
1002
  [
979
- "index",
980
- "parent",
981
- "sibling"
1003
+ "value-parent",
1004
+ "value-sibling",
1005
+ "value-index"
982
1006
  ],
983
1007
  "side-effect",
984
- "object",
1008
+ "ts-equals-import",
985
1009
  "unknown"
986
1010
  ],
987
- internalPattern: ["^~/.*", "^@/.*"],
988
1011
  newlinesBetween: "ignore",
1012
+ newlinesInside: "ignore",
989
1013
  order: "asc",
990
1014
  type: "natural"
991
1015
  }],
@@ -1010,45 +1034,48 @@ async function detectCatalogUsage() {
1010
1034
  const yaml$1 = await fs.readFile(workspaceFile, "utf-8");
1011
1035
  return yaml$1.includes("catalog:") || yaml$1.includes("catalogs:");
1012
1036
  }
1013
- async function pnpm(options = {}) {
1014
- const { catalogs = await detectCatalogUsage(), isInEditor = false } = options;
1015
- const [pluginPnpm, yamlParser, jsoncParser] = await Promise.all([
1037
+ async function pnpm(options) {
1038
+ const [pluginPnpm, pluginYaml, yamlParser] = await Promise.all([
1016
1039
  interopDefault(import("eslint-plugin-pnpm")),
1017
- interopDefault(import("yaml-eslint-parser")),
1018
- interopDefault(import("jsonc-eslint-parser"))
1040
+ interopDefault(import("eslint-plugin-yml")),
1041
+ interopDefault(import("yaml-eslint-parser"))
1019
1042
  ]);
1020
- return [
1021
- {
1022
- files: ["package.json", "**/package.json"],
1023
- languageOptions: { parser: jsoncParser },
1024
- name: "eslint/pnpm/package-json",
1025
- plugins: { pnpm: pluginPnpm },
1026
- rules: {
1027
- ...catalogs ? { "pnpm/json-enforce-catalog": ["error", {
1028
- autofix: !isInEditor,
1029
- ignores: ["@types/vscode"]
1030
- }] } : {},
1031
- "pnpm/json-prefer-workspace-settings": ["error", { autofix: isInEditor }],
1032
- "pnpm/json-valid-catalog": ["error", { autofix: isInEditor }]
1033
- }
1034
- },
1035
- {
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({
1036
1061
  files: ["pnpm-workspace.yaml"],
1037
1062
  languageOptions: { parser: yamlParser },
1038
1063
  name: "eslint/pnpm/pnpm-workspace-yaml",
1039
1064
  plugins: { pnpm: pluginPnpm },
1040
1065
  rules: {
1041
1066
  "pnpm/yaml-enforce-settings": ["error", { settings: {
1042
- catalogMode: "prefer",
1043
- shellEmulator: true
1067
+ shellEmulator: true,
1068
+ trustPolicy: "no-downgrade"
1044
1069
  } }],
1045
1070
  "pnpm/yaml-no-duplicate-catalog-item": "error",
1046
1071
  "pnpm/yaml-no-unused-catalog-item": "error"
1047
1072
  }
1048
- },
1049
- {
1073
+ });
1074
+ if (sort) configs$1.push({
1050
1075
  files: ["pnpm-workspace.yaml"],
1051
- name: "eslint/yaml/pnpm-workspace",
1076
+ languageOptions: { parser: yamlParser },
1077
+ name: "eslint/pnpm/pnpm-workspace-yaml-sort",
1078
+ plugins: { yaml: pluginYaml },
1052
1079
  rules: { "yaml/sort-keys": [
1053
1080
  "error",
1054
1081
  {
@@ -1121,8 +1148,9 @@ async function pnpm(options = {}) {
1121
1148
  pathPattern: ".*"
1122
1149
  }
1123
1150
  ] }
1124
- }
1125
- ];
1151
+ });
1152
+ }
1153
+ return configs$1;
1126
1154
  }
1127
1155
 
1128
1156
  //#endregion
@@ -1150,7 +1178,10 @@ async function react(options = {}) {
1150
1178
  "eslint-plugin-react-refresh"
1151
1179
  ]);
1152
1180
  const isTypeAware = !!tsconfigPath;
1153
- 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
+ };
1154
1185
  const [pluginReact, pluginReactHooks, pluginReactRefresh] = await Promise.all([
1155
1186
  interopDefault(import("@eslint-react/eslint-plugin")),
1156
1187
  interopDefault(import("eslint-plugin-react-hooks")),
@@ -1171,6 +1202,7 @@ async function react(options = {}) {
1171
1202
  "react-hooks-extra": plugins["@eslint-react/hooks-extra"],
1172
1203
  "react-naming-convention": plugins["@eslint-react/naming-convention"],
1173
1204
  "react-refresh": pluginReactRefresh,
1205
+ "react-rsc": plugins["@eslint-react/rsc"],
1174
1206
  "react-web-api": plugins["@eslint-react/web-api"]
1175
1207
  }
1176
1208
  },
@@ -1194,8 +1226,17 @@ async function react(options = {}) {
1194
1226
  "react-dom/no-unsafe-iframe-sandbox": "warn",
1195
1227
  "react-dom/no-use-form-state": "error",
1196
1228
  "react-dom/no-void-elements-with-children": "error",
1229
+ "react-hooks-extra/no-direct-set-state-in-use-effect": "warn",
1197
1230
  "react-hooks/exhaustive-deps": "warn",
1198
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",
1199
1240
  "react/jsx-key-before-spread": "warn",
1200
1241
  "react/jsx-no-comment-textnodes": "warn",
1201
1242
  "react/jsx-no-duplicate-props": "warn",
@@ -1216,9 +1257,7 @@ async function react(options = {}) {
1216
1257
  "react/no-create-ref": "error",
1217
1258
  "react/no-default-props": "error",
1218
1259
  "react/no-direct-mutation-state": "error",
1219
- "react/no-duplicate-key": "error",
1220
1260
  "react/no-forward-ref": "warn",
1221
- "react/no-implicit-key": "warn",
1222
1261
  "react/no-missing-key": "error",
1223
1262
  "react/no-nested-component-definitions": "error",
1224
1263
  "react/no-nested-lazy-component-declarations": "error",
@@ -1232,8 +1271,10 @@ async function react(options = {}) {
1232
1271
  "react/no-unsafe-component-will-mount": "warn",
1233
1272
  "react/no-unsafe-component-will-receive-props": "warn",
1234
1273
  "react/no-unsafe-component-will-update": "warn",
1274
+ "react/no-unused-class-component-members": "warn",
1235
1275
  "react/no-use-context": "warn",
1236
1276
  "react/no-useless-forward-ref": "warn",
1277
+ "react/prefer-namespace-import": "error",
1237
1278
  "react/prefer-use-state-lazy-initialization": "warn",
1238
1279
  ...reactCompiler ? {
1239
1280
  "react-hooks/component-hook-factories": "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.3.3",
4
+ "version": "6.5.0",
5
5
  "description": "LinCenYing's ESLint config",
6
6
  "author": "LinCenYing <lincenying@gmail.com> (https://github.com/lincenying/)",
7
7
  "license": "MIT",
@@ -57,69 +57,69 @@
57
57
  },
58
58
  "dependencies": {
59
59
  "@antfu/install-pkg": "^1.1.0",
60
- "@clack/prompts": "^0.11.0",
61
- "@eslint-community/eslint-plugin-eslint-comments": "^4.5.0",
60
+ "@clack/prompts": "^1.0.1",
61
+ "@eslint-community/eslint-plugin-eslint-comments": "^4.6.0",
62
62
  "@eslint/markdown": "^7.5.1",
63
- "@stylistic/eslint-plugin": "^5.6.1",
64
- "@typescript-eslint/eslint-plugin": "^8.50.0",
65
- "@typescript-eslint/parser": "^8.50.0",
66
- "@vitest/eslint-plugin": "^1.5.4",
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.1",
71
+ "eslint-plugin-antfu": "^3.2.2",
72
72
  "eslint-plugin-erasable-syntax-only": "^0.4.0",
73
- "eslint-plugin-import-lite": "^0.3.1",
74
- "eslint-plugin-jsdoc": "^61.5.0",
75
- "eslint-plugin-jsonc": "^2.21.0",
76
- "eslint-plugin-n": "^17.23.1",
73
+ "eslint-plugin-import-lite": "^0.5.2",
74
+ "eslint-plugin-jsdoc": "^62.7.1",
75
+ "eslint-plugin-jsonc": "^3.1.0",
76
+ "eslint-plugin-n": "^17.24.0",
77
77
  "eslint-plugin-no-only-tests": "^3.3.0",
78
- "eslint-plugin-perfectionist": "^4.15.1",
79
- "eslint-plugin-pnpm": "^1.4.3",
80
- "eslint-plugin-regexp": "^2.10.0",
81
- "eslint-plugin-toml": "^0.12.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": "^16.5.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": "^0.10.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
- "@antfu/ni": "^28.0.0",
96
- "@eslint-react/eslint-plugin": "^2.3.13",
95
+ "@antfu/ni": "^28.2.0",
96
+ "@eslint-react/eslint-plugin": "^2.13.0",
97
97
  "@eslint/config-inspector": "^1.4.2",
98
- "@next/eslint-plugin-next": "^16.1.0",
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.4",
102
- "@types/react": "^19.2.7",
103
- "@unocss/eslint-plugin": "^66.5.10",
104
- "bumpp": "^10.3.2",
105
- "eslint": "^9.39.2",
106
- "eslint-plugin-format": "^1.1.0",
101
+ "@types/node": "^25.3.0",
102
+ "@types/react": "^19.2.14",
103
+ "@unocss/eslint-plugin": "^66.6.0",
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.16",
121
- "vue": "^3.5.26",
122
- "@lincy/eslint-config": "6.3.3"
120
+ "vitest": "^4.0.18",
121
+ "vue": "^3.5.29",
122
+ "@lincy/eslint-config": "6.5.0"
123
123
  },
124
124
  "resolutions": {
125
125
  "@eslint-community/eslint-utils": "catalog:peer",