@lincy/eslint-config 6.1.0 → 6.2.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.
@@ -994,31 +994,109 @@ async function pnpm(options = {}) {
994
994
  interopDefault(import("yaml-eslint-parser")),
995
995
  interopDefault(import("jsonc-eslint-parser"))
996
996
  ]);
997
- return [{
998
- files: ["package.json", "**/package.json"],
999
- languageOptions: { parser: jsoncParser },
1000
- name: "eslint/pnpm/package-json",
1001
- plugins: { pnpm: pluginPnpm },
1002
- rules: {
1003
- "pnpm/json-enforce-catalog": ["error", { autofix: !options.isInEditor }],
1004
- "pnpm/json-prefer-workspace-settings": ["error", { autofix: !options.isInEditor }],
1005
- "pnpm/json-valid-catalog": ["error", { autofix: !options.isInEditor }]
1006
- }
1007
- }, {
1008
- files: ["pnpm-workspace.yaml"],
1009
- languageOptions: { parser: yamlParser },
1010
- name: "eslint/pnpm/pnpm-workspace-yaml",
1011
- plugins: { pnpm: pluginPnpm },
1012
- rules: {
1013
- "pnpm/yaml-enforce-settings": ["error", { settings: {
1014
- catalogMode: "prefer",
1015
- cleanupUnusedCatalogs: true,
1016
- shellEmulator: true
1017
- } }],
1018
- "pnpm/yaml-no-duplicate-catalog-item": "error",
1019
- "pnpm/yaml-no-unused-catalog-item": "error"
997
+ return [
998
+ {
999
+ files: ["package.json", "**/package.json"],
1000
+ languageOptions: { parser: jsoncParser },
1001
+ name: "eslint/pnpm/package-json",
1002
+ plugins: { pnpm: pluginPnpm },
1003
+ rules: {
1004
+ "pnpm/json-enforce-catalog": ["error", { autofix: !options.isInEditor }],
1005
+ "pnpm/json-prefer-workspace-settings": ["error", { autofix: !options.isInEditor }],
1006
+ "pnpm/json-valid-catalog": ["error", { autofix: !options.isInEditor }]
1007
+ }
1008
+ },
1009
+ {
1010
+ files: ["pnpm-workspace.yaml"],
1011
+ languageOptions: { parser: yamlParser },
1012
+ name: "eslint/pnpm/pnpm-workspace-yaml",
1013
+ plugins: { pnpm: pluginPnpm },
1014
+ rules: {
1015
+ "pnpm/yaml-enforce-settings": ["error", { settings: {
1016
+ catalogMode: "prefer",
1017
+ shellEmulator: true
1018
+ } }],
1019
+ "pnpm/yaml-no-duplicate-catalog-item": "error",
1020
+ "pnpm/yaml-no-unused-catalog-item": "error"
1021
+ }
1022
+ },
1023
+ {
1024
+ files: ["pnpm-workspace.yaml"],
1025
+ name: "eslint/yaml/pnpm-workspace",
1026
+ rules: { "yaml/sort-keys": [
1027
+ "error",
1028
+ {
1029
+ order: [
1030
+ ...[
1031
+ "cacheDir",
1032
+ "catalogMode",
1033
+ "cleanupUnusedCatalogs",
1034
+ "dedupeDirectDeps",
1035
+ "deployAllFiles",
1036
+ "enablePrePostScripts",
1037
+ "engineStrict",
1038
+ "extendNodePath",
1039
+ "hoist",
1040
+ "hoistPattern",
1041
+ "hoistWorkspacePackages",
1042
+ "ignoreCompatibilityDb",
1043
+ "ignoreDepScripts",
1044
+ "ignoreScripts",
1045
+ "ignoreWorkspaceRootCheck",
1046
+ "managePackageManagerVersions",
1047
+ "minimumReleaseAge",
1048
+ "minimumReleaseAgeExclude",
1049
+ "modulesDir",
1050
+ "nodeLinker",
1051
+ "nodeVersion",
1052
+ "optimisticRepeatInstall",
1053
+ "packageManagerStrict",
1054
+ "packageManagerStrictVersion",
1055
+ "preferSymlinkedExecutables",
1056
+ "preferWorkspacePackages",
1057
+ "publicHoistPattern",
1058
+ "registrySupportsTimeField",
1059
+ "requiredScripts",
1060
+ "resolutionMode",
1061
+ "savePrefix",
1062
+ "scriptShell",
1063
+ "shamefullyHoist",
1064
+ "shellEmulator",
1065
+ "stateDir",
1066
+ "supportedArchitectures",
1067
+ "symlink",
1068
+ "tag",
1069
+ "trustPolicy",
1070
+ "trustPolicyExclude",
1071
+ "updateNotifier"
1072
+ ],
1073
+ "packages",
1074
+ "overrides",
1075
+ "patchedDependencies",
1076
+ "catalog",
1077
+ "catalogs",
1078
+ ...[
1079
+ "allowedDeprecatedVersions",
1080
+ "allowNonAppliedPatches",
1081
+ "configDependencies",
1082
+ "ignoredBuiltDependencies",
1083
+ "ignoredOptionalDependencies",
1084
+ "neverBuiltDependencies",
1085
+ "onlyBuiltDependencies",
1086
+ "onlyBuiltDependenciesFile",
1087
+ "packageExtensions",
1088
+ "peerDependencyRules"
1089
+ ]
1090
+ ],
1091
+ pathPattern: "^$"
1092
+ },
1093
+ {
1094
+ order: { type: "asc" },
1095
+ pathPattern: ".*"
1096
+ }
1097
+ ] }
1020
1098
  }
1021
- }];
1099
+ ];
1022
1100
  }
1023
1101
 
1024
1102
  //#endregion
@@ -1037,8 +1115,9 @@ const ReactRouterPackages = [
1037
1115
  "@react-router/dev"
1038
1116
  ];
1039
1117
  const NextJsPackages = ["next"];
1118
+ const ReactCompilerPackages = ["babel-plugin-react-compiler"];
1040
1119
  async function react(options = {}) {
1041
- const { files = [GLOB_SRC], filesTypeAware = [GLOB_TS, GLOB_TSX], ignoresTypeAware = [`${GLOB_MARKDOWN}/**`], overrides = {}, tsconfigPath } = options;
1120
+ const { files = [GLOB_SRC], filesTypeAware = [GLOB_TS, GLOB_TSX], ignoresTypeAware = [`${GLOB_MARKDOWN}/**`], overrides = {}, reactCompiler = ReactCompilerPackages.some((i) => isPackageExists(i)), tsconfigPath } = options;
1042
1121
  await ensurePackages([
1043
1122
  "@eslint-react/eslint-plugin",
1044
1123
  "eslint-plugin-react-hooks",
@@ -1092,6 +1171,8 @@ async function react(options = {}) {
1092
1171
  "react-dom/no-unsafe-target-blank": "warn",
1093
1172
  "react-dom/no-use-form-state": "error",
1094
1173
  "react-dom/no-void-elements-with-children": "error",
1174
+ "react-hooks/exhaustive-deps": "warn",
1175
+ "react-hooks/rules-of-hooks": "error",
1095
1176
  "react/jsx-no-comment-textnodes": "warn",
1096
1177
  "react/jsx-no-duplicate-props": "warn",
1097
1178
  "react/jsx-uses-vars": "warn",
@@ -1132,7 +1213,23 @@ async function react(options = {}) {
1132
1213
  "react/no-use-context": "warn",
1133
1214
  "react/no-useless-forward-ref": "warn",
1134
1215
  "react/prefer-use-state-lazy-initialization": "warn",
1135
- ...pluginReactHooks.configs.recommended.rules,
1216
+ ...reactCompiler ? {
1217
+ "react-hooks/component-hook-factories": "error",
1218
+ "react-hooks/config": "error",
1219
+ "react-hooks/error-boundaries": "error",
1220
+ "react-hooks/gating": "error",
1221
+ "react-hooks/globals": "error",
1222
+ "react-hooks/immutability": "error",
1223
+ "react-hooks/incompatible-library": "warn",
1224
+ "react-hooks/preserve-manual-memoization": "error",
1225
+ "react-hooks/purity": "error",
1226
+ "react-hooks/refs": "error",
1227
+ "react-hooks/set-state-in-effect": "error",
1228
+ "react-hooks/set-state-in-render": "error",
1229
+ "react-hooks/static-components": "error",
1230
+ "react-hooks/unsupported-syntax": "warn",
1231
+ "react-hooks/use-memo": "error"
1232
+ } : {},
1136
1233
  "react-hooks-extra/no-direct-set-state-in-use-effect": "warn",
1137
1234
  "react-refresh/only-export-components": ["warn", {
1138
1235
  allowConstantExport: isAllowConstantExport,
@@ -1645,7 +1742,7 @@ async function typescript(options = {}) {
1645
1742
  }] : [],
1646
1743
  ...erasableOnly ? [{
1647
1744
  name: "eslint/typescript/erasable-syntax-only",
1648
- plugins: { "erasable-syntax-only": await interopDefault(import("./lib-CEKTiw7V.js")) },
1745
+ plugins: { "erasable-syntax-only": await interopDefault(import("eslint-plugin-erasable-syntax-only")) },
1649
1746
  rules: {
1650
1747
  "erasable-syntax-only/enums": "error",
1651
1748
  "erasable-syntax-only/import-aliases": "error",
@@ -1921,120 +2018,41 @@ async function yaml(options = {}) {
1921
2018
  const { files = [GLOB_YAML], overrides = {}, stylistic: stylistic$1 = true } = options;
1922
2019
  const { quotes = "single" } = typeof stylistic$1 === "boolean" ? {} : stylistic$1;
1923
2020
  const [pluginYaml, parserYaml] = await Promise.all([interopDefault(import("eslint-plugin-yml")), interopDefault(import("yaml-eslint-parser"))]);
1924
- return [
1925
- {
1926
- name: "eslint/yaml/setup",
1927
- plugins: { yaml: pluginYaml }
1928
- },
1929
- {
1930
- files,
1931
- languageOptions: { parser: parserYaml },
1932
- name: "eslint/yaml/rules",
1933
- rules: {
1934
- "style/spaced-comment": "off",
1935
- "yaml/block-mapping": "error",
1936
- "yaml/block-sequence": "error",
1937
- "yaml/no-empty-key": "error",
1938
- "yaml/no-empty-sequence-entry": "error",
1939
- "yaml/no-irregular-whitespace": "error",
1940
- "yaml/plain-scalar": "error",
1941
- "yaml/vue-custom-block/no-parsing-error": "error",
1942
- ...stylistic$1 ? {
1943
- "yaml/block-mapping-question-indicator-newline": "error",
1944
- "yaml/block-sequence-hyphen-indicator-newline": "error",
1945
- "yaml/flow-mapping-curly-newline": "error",
1946
- "yaml/flow-mapping-curly-spacing": "error",
1947
- "yaml/flow-sequence-bracket-newline": "error",
1948
- "yaml/flow-sequence-bracket-spacing": "error",
1949
- "yaml/indent": ["error", 2],
1950
- "yaml/key-spacing": "error",
1951
- "yaml/no-tab-indent": "error",
1952
- "yaml/quotes": ["error", {
1953
- avoidEscape: true,
1954
- prefer: quotes === "backtick" ? "single" : quotes
1955
- }],
1956
- "yaml/spaced-comment": "error"
1957
- } : {},
1958
- ...overrides
1959
- }
1960
- },
1961
- {
1962
- files: ["pnpm-workspace.yaml"],
1963
- name: "eslint/yaml/pnpm-workspace",
1964
- rules: { "yaml/sort-keys": [
1965
- "error",
1966
- {
1967
- order: [
1968
- ...[
1969
- "cacheDir",
1970
- "catalogMode",
1971
- "cleanupUnusedCatalogs",
1972
- "dedupeDirectDeps",
1973
- "deployAllFiles",
1974
- "enablePrePostScripts",
1975
- "engineStrict",
1976
- "extendNodePath",
1977
- "hoist",
1978
- "hoistPattern",
1979
- "hoistWorkspacePackages",
1980
- "ignoreCompatibilityDb",
1981
- "ignoreDepScripts",
1982
- "ignoreScripts",
1983
- "ignoreWorkspaceRootCheck",
1984
- "managePackageManagerVersions",
1985
- "minimumReleaseAge",
1986
- "minimumReleaseAgeExclude",
1987
- "modulesDir",
1988
- "nodeLinker",
1989
- "nodeVersion",
1990
- "optimisticRepeatInstall",
1991
- "packageManagerStrict",
1992
- "packageManagerStrictVersion",
1993
- "preferSymlinkedExecutables",
1994
- "preferWorkspacePackages",
1995
- "publicHoistPattern",
1996
- "registrySupportsTimeField",
1997
- "requiredScrpts",
1998
- "resolutionMode",
1999
- "savePrefix",
2000
- "scriptShell",
2001
- "shamefullyHoist",
2002
- "shellEmulator",
2003
- "stateDir",
2004
- "supportedArchitectures",
2005
- "symlink",
2006
- "tag",
2007
- "trustPolicy",
2008
- "trustPolicyExclude",
2009
- "updateNotifier"
2010
- ],
2011
- "packages",
2012
- "overrides",
2013
- "patchedDependencies",
2014
- "catalog",
2015
- "catalogs",
2016
- ...[
2017
- "allowedDeprecatedVersions",
2018
- "allowNonAppliedPatches",
2019
- "configDependencies",
2020
- "ignoredBuiltDependencies",
2021
- "ignoredOptionalDependencies",
2022
- "neverBuiltDependencies",
2023
- "onlyBuiltDependencies",
2024
- "onlyBuiltDependenciesFile",
2025
- "packageExtensions",
2026
- "peerDependencyRules"
2027
- ]
2028
- ],
2029
- pathPattern: "^$"
2030
- },
2031
- {
2032
- order: { type: "asc" },
2033
- pathPattern: ".*"
2034
- }
2035
- ] }
2021
+ return [{
2022
+ name: "eslint/yaml/setup",
2023
+ plugins: { yaml: pluginYaml }
2024
+ }, {
2025
+ files,
2026
+ languageOptions: { parser: parserYaml },
2027
+ name: "eslint/yaml/rules",
2028
+ rules: {
2029
+ "style/spaced-comment": "off",
2030
+ "yaml/block-mapping": "error",
2031
+ "yaml/block-sequence": "error",
2032
+ "yaml/no-empty-key": "error",
2033
+ "yaml/no-empty-sequence-entry": "error",
2034
+ "yaml/no-irregular-whitespace": "error",
2035
+ "yaml/plain-scalar": "error",
2036
+ "yaml/vue-custom-block/no-parsing-error": "error",
2037
+ ...stylistic$1 ? {
2038
+ "yaml/block-mapping-question-indicator-newline": "error",
2039
+ "yaml/block-sequence-hyphen-indicator-newline": "error",
2040
+ "yaml/flow-mapping-curly-newline": "error",
2041
+ "yaml/flow-mapping-curly-spacing": "error",
2042
+ "yaml/flow-sequence-bracket-newline": "error",
2043
+ "yaml/flow-sequence-bracket-spacing": "error",
2044
+ "yaml/indent": ["error", 2],
2045
+ "yaml/key-spacing": "error",
2046
+ "yaml/no-tab-indent": "error",
2047
+ "yaml/quotes": ["error", {
2048
+ avoidEscape: true,
2049
+ prefer: quotes === "backtick" ? "single" : quotes
2050
+ }],
2051
+ "yaml/spaced-comment": "error"
2052
+ } : {},
2053
+ ...overrides
2036
2054
  }
2037
- ];
2055
+ }];
2038
2056
  }
2039
2057
 
2040
2058
  //#endregion
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@lincy/eslint-config",
3
3
  "type": "module",
4
- "version": "6.1.0",
4
+ "version": "6.2.0",
5
5
  "description": "LinCenYing's ESLint config",
6
6
  "author": "LinCenYing <lincenying@gmail.com> (https://github.com/lincenying/)",
7
7
  "license": "MIT",
@@ -11,13 +11,14 @@
11
11
  ],
12
12
  "exports": {
13
13
  ".": {
14
- "import": "./dist/index.js",
15
- "require": "./dist/index.cjs"
16
- }
14
+ "require": "./dist/index.cjs",
15
+ "import": "./dist/index.mjs"
16
+ },
17
+ "./package.json": "./package.json"
17
18
  },
18
19
  "main": "./dist/index.cjs",
19
- "module": "./dist/index.js",
20
- "types": "./dist/index.d.ts",
20
+ "module": "./dist/index.mjs",
21
+ "types": "./dist/index.d.cts",
21
22
  "files": [
22
23
  "dist"
23
24
  ],
@@ -60,21 +61,22 @@
60
61
  "@eslint-community/eslint-plugin-eslint-comments": "^4.5.0",
61
62
  "@eslint/markdown": "^7.5.1",
62
63
  "@stylistic/eslint-plugin": "^5.6.1",
63
- "@typescript-eslint/eslint-plugin": "^8.48.1",
64
- "@typescript-eslint/parser": "^8.48.1",
65
- "@vitest/eslint-plugin": "^1.5.1",
64
+ "@typescript-eslint/eslint-plugin": "^8.49.0",
65
+ "@typescript-eslint/parser": "^8.49.0",
66
+ "@vitest/eslint-plugin": "^1.5.2",
66
67
  "eslint-config-flat-gitignore": "^2.1.0",
67
68
  "eslint-flat-config-utils": "^2.1.4",
68
69
  "eslint-merge-processors": "^2.0.0",
69
70
  "eslint-parser-plain": "^0.1.1",
70
71
  "eslint-plugin-antfu": "^3.1.1",
72
+ "eslint-plugin-erasable-syntax-only": "^0.4.0",
71
73
  "eslint-plugin-import-lite": "^0.3.0",
72
- "eslint-plugin-jsdoc": "^61.4.1",
74
+ "eslint-plugin-jsdoc": "^61.5.0",
73
75
  "eslint-plugin-jsonc": "^2.21.0",
74
76
  "eslint-plugin-n": "^17.23.1",
75
77
  "eslint-plugin-no-only-tests": "^3.3.0",
76
78
  "eslint-plugin-perfectionist": "^4.15.1",
77
- "eslint-plugin-pnpm": "^1.4.0",
79
+ "eslint-plugin-pnpm": "^1.4.2",
78
80
  "eslint-plugin-regexp": "^2.10.0",
79
81
  "eslint-plugin-toml": "^0.12.0",
80
82
  "eslint-plugin-unicorn": "^62.0.0",
@@ -83,9 +85,9 @@
83
85
  "eslint-plugin-yml": "^1.19.0",
84
86
  "eslint-processor-vue-blocks": "^2.0.0",
85
87
  "globals": "^16.5.0",
86
- "jsonc-eslint-parser": "^2.4.1",
88
+ "jsonc-eslint-parser": "^2.4.2",
87
89
  "local-pkg": "^1.1.2",
88
- "toml-eslint-parser": "^0.10.0",
90
+ "toml-eslint-parser": "^0.10.1",
89
91
  "vue-eslint-parser": "^10.2.0",
90
92
  "yaml-eslint-parser": "^1.3.2"
91
93
  },
@@ -93,15 +95,14 @@
93
95
  "@antfu/ni": "^28.0.0",
94
96
  "@eslint-react/eslint-plugin": "^2.3.12",
95
97
  "@eslint/config-inspector": "^1.4.2",
96
- "@next/eslint-plugin-next": "^16.0.7",
98
+ "@next/eslint-plugin-next": "^16.0.8",
97
99
  "@prettier/plugin-xml": "^3.4.2",
98
100
  "@stylistic/eslint-plugin-migrate": "^4.4.1",
99
- "@types/node": "^24.10.1",
101
+ "@types/node": "^24.10.2",
100
102
  "@types/react": "^19.2.7",
101
103
  "@unocss/eslint-plugin": "^66.5.10",
102
104
  "bumpp": "^10.3.2",
103
105
  "eslint": "^9.39.1",
104
- "eslint-plugin-erasable-syntax-only": "^0.4.0",
105
106
  "eslint-plugin-format": "^1.1.0",
106
107
  "eslint-plugin-react-hooks": "^7.0.1",
107
108
  "eslint-plugin-react-refresh": "^0.4.24",
@@ -114,11 +115,17 @@
114
115
  "react": "^19.2.1",
115
116
  "simple-open-url": "^3.0.1",
116
117
  "tinyglobby": "^0.2.15",
117
- "tsdown": "^0.15.12",
118
+ "tsdown": "^0.17.2",
118
119
  "typescript": "^5.9.3",
119
120
  "vitest": "^4.0.15",
120
121
  "vue": "^3.5.25",
121
- "@lincy/eslint-config": "6.1.0"
122
+ "@lincy/eslint-config": "6.2.0"
123
+ },
124
+ "resolutions": {
125
+ "@eslint-community/eslint-utils": "catalog:peer",
126
+ "@typescript-eslint/utils": "catalog:peer",
127
+ "eslint": "catalog:peer",
128
+ "tsx": "catalog:peer"
122
129
  },
123
130
  "simple-git-hooks[-del]": {
124
131
  "pre-commit": "npx lint-staged"
@@ -1,39 +0,0 @@
1
- //#region rolldown:runtime
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __commonJS = (cb, mod) => function() {
9
- return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
10
- };
11
- var __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
13
- key = keys[i];
14
- if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
15
- get: ((k) => from[k]).bind(null, key),
16
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
17
- });
18
- }
19
- return to;
20
- };
21
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
22
- value: mod,
23
- enumerable: true
24
- }) : target, mod));
25
-
26
- //#endregion
27
-
28
- Object.defineProperty(exports, '__commonJS', {
29
- enumerable: true,
30
- get: function () {
31
- return __commonJS;
32
- }
33
- });
34
- Object.defineProperty(exports, '__toESM', {
35
- enumerable: true,
36
- get: function () {
37
- return __toESM;
38
- }
39
- });