@antfu/eslint-config 3.13.0 → 3.15.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/README.md CHANGED
@@ -730,7 +730,11 @@ export default antfu({
730
730
 
731
731
  ### Editor Specific Disables
732
732
 
733
- Some rules are disabled when inside ESLint IDE integrations, namely [`unused-imports/no-unused-imports`](https://www.npmjs.com/package/eslint-plugin-unused-imports) [`test/no-only-tests`](https://github.com/levibuzolic/eslint-plugin-no-only-tests)
733
+ Some rules are disabled when inside ESLint IDE integrations, namely:
734
+
735
+ - [`prefer-const`](https://eslint.org/docs/rules/prefer-const)
736
+ - [`unused-imports/no-unused-imports`](https://www.npmjs.com/package/eslint-plugin-unused-imports)
737
+ - [`test/no-only-tests`](https://github.com/levibuzolic/eslint-plugin-no-only-tests)
734
738
 
735
739
  This is to prevent unused imports from getting removed by the IDE during refactoring to get a better developer experience. Those rules will be applied when you run ESLint in the terminal or [Lint Staged](#lint-staged). If you don't want this behavior, you can disable them:
736
740
 
package/dist/cli.cjs CHANGED
@@ -41,7 +41,7 @@ var import_picocolors = __toESM(require("picocolors"), 1);
41
41
  var package_default = {
42
42
  name: "@antfu/eslint-config",
43
43
  type: "module",
44
- version: "3.13.0",
44
+ version: "3.15.0",
45
45
  packageManager: "pnpm@10.0.0",
46
46
  description: "Anthony's ESLint config",
47
47
  author: "Anthony Fu <anthonyfu117@hotmail.com> (https://github.com/antfu/)",
@@ -70,7 +70,7 @@ var package_default = {
70
70
  dev: "npx @eslint/config-inspector --config eslint.config.ts",
71
71
  "build:inspector": "pnpm build && npx @eslint/config-inspector build",
72
72
  watch: "tsup --format esm,cjs --watch",
73
- lint: "eslint --flag unstable_ts_config .",
73
+ lint: "eslint .",
74
74
  typegen: "tsx scripts/typegen.ts",
75
75
  prepack: "nr build",
76
76
  release: "bumpp && pnpm publish",
@@ -140,17 +140,17 @@ var package_default = {
140
140
  "@clack/prompts": "^0.9.1",
141
141
  "@eslint-community/eslint-plugin-eslint-comments": "^4.4.1",
142
142
  "@eslint/markdown": "^6.2.1",
143
- "@stylistic/eslint-plugin": "^2.12.1",
144
- "@typescript-eslint/eslint-plugin": "^8.19.1",
145
- "@typescript-eslint/parser": "^8.19.1",
146
- "@vitest/eslint-plugin": "^1.1.24",
143
+ "@stylistic/eslint-plugin": "^2.13.0",
144
+ "@typescript-eslint/eslint-plugin": "^8.20.0",
145
+ "@typescript-eslint/parser": "^8.20.0",
146
+ "@vitest/eslint-plugin": "^1.1.25",
147
147
  "eslint-config-flat-gitignore": "^1.0.0",
148
148
  "eslint-flat-config-utils": "^1.0.0",
149
149
  "eslint-merge-processors": "^1.0.0",
150
150
  "eslint-plugin-antfu": "^2.7.0",
151
- "eslint-plugin-command": "^2.0.7",
151
+ "eslint-plugin-command": "^2.1.0",
152
152
  "eslint-plugin-import-x": "^4.6.1",
153
- "eslint-plugin-jsdoc": "^50.6.1",
153
+ "eslint-plugin-jsdoc": "^50.6.2",
154
154
  "eslint-plugin-jsonc": "^2.18.2",
155
155
  "eslint-plugin-n": "^17.15.1",
156
156
  "eslint-plugin-no-only-tests": "^3.3.0",
@@ -176,52 +176,52 @@ var package_default = {
176
176
  "@antfu/eslint-config": "workspace:*",
177
177
  "@antfu/ni": "^23.2.0",
178
178
  "@eslint-react/eslint-plugin": "^1.23.2",
179
- "@eslint/config-inspector": "^0.7.1",
179
+ "@eslint/config-inspector": "^1.0.0",
180
180
  "@prettier/plugin-xml": "^3.4.1",
181
- "@stylistic/eslint-plugin-migrate": "^2.12.1",
181
+ "@stylistic/eslint-plugin-migrate": "^2.13.0",
182
182
  "@types/fs-extra": "^11.0.4",
183
- "@types/node": "^22.10.5",
183
+ "@types/node": "^22.10.7",
184
184
  "@types/prompts": "^2.4.9",
185
185
  "@types/yargs": "^17.0.33",
186
- "@unocss/eslint-plugin": "^0.65.4",
186
+ "@unocss/eslint-plugin": "^65.4.2",
187
187
  "astro-eslint-parser": "^1.1.0",
188
- bumpp: "^9.10.0",
189
- eslint: "^9.17.0",
188
+ bumpp: "^9.10.1",
189
+ eslint: "^9.18.0",
190
190
  "eslint-plugin-astro": "^1.3.1",
191
191
  "eslint-plugin-format": "^1.0.1",
192
192
  "eslint-plugin-react-hooks": "^5.1.0",
193
- "eslint-plugin-react-refresh": "^0.4.16",
193
+ "eslint-plugin-react-refresh": "^0.4.18",
194
194
  "eslint-plugin-solid": "^0.14.5",
195
195
  "eslint-plugin-svelte": "^2.46.1",
196
- "eslint-typegen": "^0.3.2",
196
+ "eslint-typegen": "^1.0.0",
197
197
  execa: "^9.5.2",
198
198
  "fast-glob": "^3.3.3",
199
- "fs-extra": "^11.2.0",
199
+ "fs-extra": "^11.3.0",
200
200
  jiti: "^2.4.2",
201
- "lint-staged": "^15.3.0",
201
+ "lint-staged": "^15.4.1",
202
202
  "prettier-plugin-astro": "^0.14.1",
203
203
  "prettier-plugin-slidev": "^1.0.5",
204
204
  rimraf: "^6.0.1",
205
205
  "simple-git-hooks": "^2.11.1",
206
- svelte: "^5.17.1",
206
+ svelte: "^5.19.0",
207
207
  "svelte-eslint-parser": "^0.43.0",
208
208
  tsup: "^8.3.5",
209
209
  tsx: "^4.19.2",
210
210
  typescript: "^5.7.3",
211
- vitest: "^2.1.8",
211
+ vitest: "^3.0.2",
212
212
  vue: "^3.5.13"
213
213
  },
214
214
  resolutions: {
215
215
  "@eslint-community/eslint-utils": "^4.4.1",
216
- "@typescript-eslint/utils": "^8.19.1",
217
- eslint: "^9.17.0",
216
+ "@typescript-eslint/utils": "^8.20.0",
217
+ eslint: "^9.18.0",
218
218
  tsx: "^4.19.2"
219
219
  },
220
220
  "simple-git-hooks": {
221
221
  "pre-commit": "npx lint-staged"
222
222
  },
223
223
  "lint-staged": {
224
- "*": "eslint --flag unstable_ts_config --fix"
224
+ "*": "eslint --fix"
225
225
  }
226
226
  };
227
227
 
package/dist/cli.js CHANGED
@@ -12,7 +12,7 @@ import c from "picocolors";
12
12
  var package_default = {
13
13
  name: "@antfu/eslint-config",
14
14
  type: "module",
15
- version: "3.13.0",
15
+ version: "3.15.0",
16
16
  packageManager: "pnpm@10.0.0",
17
17
  description: "Anthony's ESLint config",
18
18
  author: "Anthony Fu <anthonyfu117@hotmail.com> (https://github.com/antfu/)",
@@ -41,7 +41,7 @@ var package_default = {
41
41
  dev: "npx @eslint/config-inspector --config eslint.config.ts",
42
42
  "build:inspector": "pnpm build && npx @eslint/config-inspector build",
43
43
  watch: "tsup --format esm,cjs --watch",
44
- lint: "eslint --flag unstable_ts_config .",
44
+ lint: "eslint .",
45
45
  typegen: "tsx scripts/typegen.ts",
46
46
  prepack: "nr build",
47
47
  release: "bumpp && pnpm publish",
@@ -111,17 +111,17 @@ var package_default = {
111
111
  "@clack/prompts": "^0.9.1",
112
112
  "@eslint-community/eslint-plugin-eslint-comments": "^4.4.1",
113
113
  "@eslint/markdown": "^6.2.1",
114
- "@stylistic/eslint-plugin": "^2.12.1",
115
- "@typescript-eslint/eslint-plugin": "^8.19.1",
116
- "@typescript-eslint/parser": "^8.19.1",
117
- "@vitest/eslint-plugin": "^1.1.24",
114
+ "@stylistic/eslint-plugin": "^2.13.0",
115
+ "@typescript-eslint/eslint-plugin": "^8.20.0",
116
+ "@typescript-eslint/parser": "^8.20.0",
117
+ "@vitest/eslint-plugin": "^1.1.25",
118
118
  "eslint-config-flat-gitignore": "^1.0.0",
119
119
  "eslint-flat-config-utils": "^1.0.0",
120
120
  "eslint-merge-processors": "^1.0.0",
121
121
  "eslint-plugin-antfu": "^2.7.0",
122
- "eslint-plugin-command": "^2.0.7",
122
+ "eslint-plugin-command": "^2.1.0",
123
123
  "eslint-plugin-import-x": "^4.6.1",
124
- "eslint-plugin-jsdoc": "^50.6.1",
124
+ "eslint-plugin-jsdoc": "^50.6.2",
125
125
  "eslint-plugin-jsonc": "^2.18.2",
126
126
  "eslint-plugin-n": "^17.15.1",
127
127
  "eslint-plugin-no-only-tests": "^3.3.0",
@@ -147,52 +147,52 @@ var package_default = {
147
147
  "@antfu/eslint-config": "workspace:*",
148
148
  "@antfu/ni": "^23.2.0",
149
149
  "@eslint-react/eslint-plugin": "^1.23.2",
150
- "@eslint/config-inspector": "^0.7.1",
150
+ "@eslint/config-inspector": "^1.0.0",
151
151
  "@prettier/plugin-xml": "^3.4.1",
152
- "@stylistic/eslint-plugin-migrate": "^2.12.1",
152
+ "@stylistic/eslint-plugin-migrate": "^2.13.0",
153
153
  "@types/fs-extra": "^11.0.4",
154
- "@types/node": "^22.10.5",
154
+ "@types/node": "^22.10.7",
155
155
  "@types/prompts": "^2.4.9",
156
156
  "@types/yargs": "^17.0.33",
157
- "@unocss/eslint-plugin": "^0.65.4",
157
+ "@unocss/eslint-plugin": "^65.4.2",
158
158
  "astro-eslint-parser": "^1.1.0",
159
- bumpp: "^9.10.0",
160
- eslint: "^9.17.0",
159
+ bumpp: "^9.10.1",
160
+ eslint: "^9.18.0",
161
161
  "eslint-plugin-astro": "^1.3.1",
162
162
  "eslint-plugin-format": "^1.0.1",
163
163
  "eslint-plugin-react-hooks": "^5.1.0",
164
- "eslint-plugin-react-refresh": "^0.4.16",
164
+ "eslint-plugin-react-refresh": "^0.4.18",
165
165
  "eslint-plugin-solid": "^0.14.5",
166
166
  "eslint-plugin-svelte": "^2.46.1",
167
- "eslint-typegen": "^0.3.2",
167
+ "eslint-typegen": "^1.0.0",
168
168
  execa: "^9.5.2",
169
169
  "fast-glob": "^3.3.3",
170
- "fs-extra": "^11.2.0",
170
+ "fs-extra": "^11.3.0",
171
171
  jiti: "^2.4.2",
172
- "lint-staged": "^15.3.0",
172
+ "lint-staged": "^15.4.1",
173
173
  "prettier-plugin-astro": "^0.14.1",
174
174
  "prettier-plugin-slidev": "^1.0.5",
175
175
  rimraf: "^6.0.1",
176
176
  "simple-git-hooks": "^2.11.1",
177
- svelte: "^5.17.1",
177
+ svelte: "^5.19.0",
178
178
  "svelte-eslint-parser": "^0.43.0",
179
179
  tsup: "^8.3.5",
180
180
  tsx: "^4.19.2",
181
181
  typescript: "^5.7.3",
182
- vitest: "^2.1.8",
182
+ vitest: "^3.0.2",
183
183
  vue: "^3.5.13"
184
184
  },
185
185
  resolutions: {
186
186
  "@eslint-community/eslint-utils": "^4.4.1",
187
- "@typescript-eslint/utils": "^8.19.1",
188
- eslint: "^9.17.0",
187
+ "@typescript-eslint/utils": "^8.20.0",
188
+ eslint: "^9.18.0",
189
189
  tsx: "^4.19.2"
190
190
  },
191
191
  "simple-git-hooks": {
192
192
  "pre-commit": "npx lint-staged"
193
193
  },
194
194
  "lint-staged": {
195
- "*": "eslint --flag unstable_ts_config --fix"
195
+ "*": "eslint --fix"
196
196
  }
197
197
  };
198
198
 
package/dist/index.cjs CHANGED
@@ -994,7 +994,7 @@ async function javascript(options = {}) {
994
994
  allowUnboundThis: true
995
995
  }
996
996
  ],
997
- "prefer-const": [
997
+ "prefer-const": isInEditor ? "off" : [
998
998
  "error",
999
999
  {
1000
1000
  destructuring: "all",
@@ -1356,7 +1356,8 @@ async function react(options = {}) {
1356
1356
  "react-hooks": pluginReactHooks,
1357
1357
  "react-hooks-extra": plugins["@eslint-react/hooks-extra"],
1358
1358
  "react-naming-convention": plugins["@eslint-react/naming-convention"],
1359
- "react-refresh": pluginReactRefresh
1359
+ "react-refresh": pluginReactRefresh,
1360
+ "react-web-api": plugins["@eslint-react/web-api"]
1360
1361
  }
1361
1362
  },
1362
1363
  {
@@ -1417,6 +1418,11 @@ async function react(options = {}) {
1417
1418
  ]
1418
1419
  }
1419
1420
  ],
1421
+ // recommended rules from @eslint-react/web-api
1422
+ "react-web-api/no-leaked-event-listener": "warn",
1423
+ "react-web-api/no-leaked-interval": "warn",
1424
+ "react-web-api/no-leaked-resize-observer": "warn",
1425
+ "react-web-api/no-leaked-timeout": "warn",
1420
1426
  // recommended rules from @eslint-react
1421
1427
  "react/ensure-forward-ref-using-ref": "warn",
1422
1428
  "react/jsx-no-duplicate-props": "warn",
package/dist/index.d.cts CHANGED
@@ -468,7 +468,7 @@ interface RuleOptions {
468
468
  */
469
469
  'default-case'?: Linter.RuleEntry<DefaultCase>
470
470
  /**
471
- * Enforce `default` clauses in switch statements to be last
471
+ * Enforce `default` clauses in `switch` statements to be last
472
472
  * @see https://eslint.org/docs/latest/rules/default-case-last
473
473
  */
474
474
  'default-case-last'?: Linter.RuleEntry<[]>
@@ -2972,6 +2972,26 @@ interface RuleOptions {
2972
2972
  */
2973
2973
  'react-naming-convention/use-state'?: Linter.RuleEntry<[]>
2974
2974
  'react-refresh/only-export-components'?: Linter.RuleEntry<ReactRefreshOnlyExportComponents>
2975
+ /**
2976
+ * enforce that every 'addEventListener' in a component or custom Hook has a corresponding 'removeEventListener'.
2977
+ * @see https://eslint-react.xyz/docs/rules/web-api-no-leaked-event-listener
2978
+ */
2979
+ 'react-web-api/no-leaked-event-listener'?: Linter.RuleEntry<[]>
2980
+ /**
2981
+ * enforce that every 'setInterval' in a component or custom Hook has a corresponding 'clearInterval'.
2982
+ * @see https://eslint-react.xyz/docs/rules/web-api-no-leaked-interval
2983
+ */
2984
+ 'react-web-api/no-leaked-interval'?: Linter.RuleEntry<[]>
2985
+ /**
2986
+ * enforce cleanup of 'ResizeObserver' instances in components and custom Hooks.
2987
+ * @see https://eslint-react.xyz/docs/rules/web-api-no-leaked-resize-observer
2988
+ */
2989
+ 'react-web-api/no-leaked-resize-observer'?: Linter.RuleEntry<[]>
2990
+ /**
2991
+ * enforce that every 'setTimeout' in a component or custom Hook has a corresponding 'clearTimeout'.
2992
+ * @see https://eslint-react.xyz/docs/rules/web-api-no-leaked-timeout
2993
+ */
2994
+ 'react-web-api/no-leaked-timeout'?: Linter.RuleEntry<[]>
2975
2995
  /**
2976
2996
  * disallow using shorthand boolean attributes
2977
2997
  * @see https://eslint-react.xyz/docs/rules/avoid-shorthand-boolean
@@ -3793,7 +3813,7 @@ interface RuleOptions {
3793
3813
  */
3794
3814
  'solid/style-prop'?: Linter.RuleEntry<SolidStyleProp>
3795
3815
  /**
3796
- * Enforce sorted import declarations within modules
3816
+ * Enforce sorted `import` declarations within modules
3797
3817
  * @see https://eslint.org/docs/latest/rules/sort-imports
3798
3818
  */
3799
3819
  'sort-imports'?: Linter.RuleEntry<SortImports>
@@ -5254,7 +5274,7 @@ interface RuleOptions {
5254
5274
  * Disallow using code marked as `@deprecated`
5255
5275
  * @see https://typescript-eslint.io/rules/no-deprecated
5256
5276
  */
5257
- 'ts/no-deprecated'?: Linter.RuleEntry<[]>
5277
+ 'ts/no-deprecated'?: Linter.RuleEntry<TsNoDeprecated>
5258
5278
  /**
5259
5279
  * Disallow duplicate class members
5260
5280
  * @see https://typescript-eslint.io/rules/no-dupe-class-members
@@ -5372,6 +5392,11 @@ interface RuleOptions {
5372
5392
  * @see https://typescript-eslint.io/rules/no-misused-promises
5373
5393
  */
5374
5394
  'ts/no-misused-promises'?: Linter.RuleEntry<TsNoMisusedPromises>
5395
+ /**
5396
+ * Disallow using the spread operator when it might cause unexpected behavior
5397
+ * @see https://typescript-eslint.io/rules/no-misused-spread
5398
+ */
5399
+ 'ts/no-misused-spread'?: Linter.RuleEntry<TsNoMisusedSpread>
5375
5400
  /**
5376
5401
  * Disallow enums from having both number and string members
5377
5402
  * @see https://typescript-eslint.io/rules/no-mixed-enums
@@ -12120,6 +12145,7 @@ type StyleKeySpacing = []|[({
12120
12145
  mode?: ("strict" | "minimum")
12121
12146
  beforeColon?: boolean
12122
12147
  afterColon?: boolean
12148
+ ignoredNodes?: ("ObjectExpression" | "ObjectPattern" | "ImportDeclaration" | "ExportNamedDeclaration" | "ExportAllDeclaration" | "TSTypeLiteral" | "TSInterfaceBody" | "ClassBody")[]
12123
12149
  } | {
12124
12150
  singleLine?: {
12125
12151
  mode?: ("strict" | "minimum")
@@ -12635,6 +12661,7 @@ type StyleNoExtraParens = ([]|["functions"] | []|["all"]|["all", {
12635
12661
  enforceForNewInMemberExpressions?: boolean
12636
12662
  enforceForFunctionPrototypeMethods?: boolean
12637
12663
  allowParensAfterCommentPattern?: string
12664
+ nestedConditionalExpressions?: boolean
12638
12665
  }])
12639
12666
  // ----- style/no-mixed-operators -----
12640
12667
  type StyleNoMixedOperators = []|[{
@@ -12732,14 +12759,14 @@ type StyleOperatorLinebreak = []|[(("after" | "before" | "none") | null)]|[(("af
12732
12759
  }
12733
12760
  }]
12734
12761
  // ----- style/padded-blocks -----
12735
- type StylePaddedBlocks = []|[(("always" | "never") | {
12736
- blocks?: ("always" | "never")
12737
- switches?: ("always" | "never")
12738
- classes?: ("always" | "never")
12739
- })]|[(("always" | "never") | {
12740
- blocks?: ("always" | "never")
12741
- switches?: ("always" | "never")
12742
- classes?: ("always" | "never")
12762
+ type StylePaddedBlocks = []|[(("always" | "never" | "start" | "end") | {
12763
+ blocks?: ("always" | "never" | "start" | "end")
12764
+ switches?: ("always" | "never" | "start" | "end")
12765
+ classes?: ("always" | "never" | "start" | "end")
12766
+ })]|[(("always" | "never" | "start" | "end") | {
12767
+ blocks?: ("always" | "never" | "start" | "end")
12768
+ switches?: ("always" | "never" | "start" | "end")
12769
+ classes?: ("always" | "never" | "start" | "end")
12743
12770
  }), {
12744
12771
  allowSingleLineBlocks?: boolean
12745
12772
  }]
@@ -13297,6 +13324,8 @@ type TsConsistentTypeAssertions = []|[({
13297
13324
  assertionStyle: "never"
13298
13325
  } | {
13299
13326
 
13327
+ arrayLiteralTypeAssertions?: ("allow" | "allow-as-parameter" | "never")
13328
+
13300
13329
  assertionStyle?: ("as" | "angle-bracket")
13301
13330
 
13302
13331
  objectLiteralTypeAssertions?: ("allow" | "allow-as-parameter" | "never")
@@ -13753,6 +13782,22 @@ type TsNoConfusingVoidExpression = []|[{
13753
13782
 
13754
13783
  ignoreVoidReturningFunctions?: boolean
13755
13784
  }]
13785
+ // ----- ts/no-deprecated -----
13786
+ type TsNoDeprecated = []|[{
13787
+
13788
+ allow?: (string | {
13789
+ from: "file"
13790
+ name: (string | [string, ...(string)[]])
13791
+ path?: string
13792
+ } | {
13793
+ from: "lib"
13794
+ name: (string | [string, ...(string)[]])
13795
+ } | {
13796
+ from: "package"
13797
+ name: (string | [string, ...(string)[]])
13798
+ package: string
13799
+ })[]
13800
+ }]
13756
13801
  // ----- ts/no-duplicate-type-constituents -----
13757
13802
  type TsNoDuplicateTypeConstituents = []|[{
13758
13803
 
@@ -13894,6 +13939,22 @@ type TsNoMisusedPromises = []|[{
13894
13939
  variables?: boolean
13895
13940
  })
13896
13941
  }]
13942
+ // ----- ts/no-misused-spread -----
13943
+ type TsNoMisusedSpread = []|[{
13944
+
13945
+ allow?: (string | {
13946
+ from: "file"
13947
+ name: (string | [string, ...(string)[]])
13948
+ path?: string
13949
+ } | {
13950
+ from: "lib"
13951
+ name: (string | [string, ...(string)[]])
13952
+ } | {
13953
+ from: "package"
13954
+ name: (string | [string, ...(string)[]])
13955
+ package: string
13956
+ })[]
13957
+ }]
13897
13958
  // ----- ts/no-namespace -----
13898
13959
  type TsNoNamespace = []|[{
13899
13960
 
@@ -13969,7 +14030,7 @@ type TsNoShadow = []|[{
13969
14030
 
13970
14031
  builtinGlobals?: boolean
13971
14032
 
13972
- hoist?: ("all" | "functions" | "never")
14033
+ hoist?: ("all" | "functions" | "functions-and-types" | "never" | "types")
13973
14034
 
13974
14035
  ignoreFunctionTypeParameterNameValueShadow?: boolean
13975
14036
 
@@ -14882,6 +14943,7 @@ type VueKeySpacing = []|[({
14882
14943
  mode?: ("strict" | "minimum")
14883
14944
  beforeColon?: boolean
14884
14945
  afterColon?: boolean
14946
+ ignoredNodes?: ("ObjectExpression" | "ObjectPattern" | "ImportDeclaration" | "ExportNamedDeclaration" | "ExportAllDeclaration" | "TSTypeLiteral" | "TSInterfaceBody" | "ClassBody")[]
14885
14947
  } | {
14886
14948
  singleLine?: {
14887
14949
  mode?: ("strict" | "minimum")
@@ -15408,6 +15470,7 @@ type VueNoExtraParens = ([]|["functions"] | []|["all"]|["all", {
15408
15470
  enforceForNewInMemberExpressions?: boolean
15409
15471
  enforceForFunctionPrototypeMethods?: boolean
15410
15472
  allowParensAfterCommentPattern?: string
15473
+ nestedConditionalExpressions?: boolean
15411
15474
  }])
15412
15475
  // ----- vue/no-irregular-whitespace -----
15413
15476
  type VueNoIrregularWhitespace = []|[{
package/dist/index.d.ts CHANGED
@@ -468,7 +468,7 @@ interface RuleOptions {
468
468
  */
469
469
  'default-case'?: Linter.RuleEntry<DefaultCase>
470
470
  /**
471
- * Enforce `default` clauses in switch statements to be last
471
+ * Enforce `default` clauses in `switch` statements to be last
472
472
  * @see https://eslint.org/docs/latest/rules/default-case-last
473
473
  */
474
474
  'default-case-last'?: Linter.RuleEntry<[]>
@@ -2972,6 +2972,26 @@ interface RuleOptions {
2972
2972
  */
2973
2973
  'react-naming-convention/use-state'?: Linter.RuleEntry<[]>
2974
2974
  'react-refresh/only-export-components'?: Linter.RuleEntry<ReactRefreshOnlyExportComponents>
2975
+ /**
2976
+ * enforce that every 'addEventListener' in a component or custom Hook has a corresponding 'removeEventListener'.
2977
+ * @see https://eslint-react.xyz/docs/rules/web-api-no-leaked-event-listener
2978
+ */
2979
+ 'react-web-api/no-leaked-event-listener'?: Linter.RuleEntry<[]>
2980
+ /**
2981
+ * enforce that every 'setInterval' in a component or custom Hook has a corresponding 'clearInterval'.
2982
+ * @see https://eslint-react.xyz/docs/rules/web-api-no-leaked-interval
2983
+ */
2984
+ 'react-web-api/no-leaked-interval'?: Linter.RuleEntry<[]>
2985
+ /**
2986
+ * enforce cleanup of 'ResizeObserver' instances in components and custom Hooks.
2987
+ * @see https://eslint-react.xyz/docs/rules/web-api-no-leaked-resize-observer
2988
+ */
2989
+ 'react-web-api/no-leaked-resize-observer'?: Linter.RuleEntry<[]>
2990
+ /**
2991
+ * enforce that every 'setTimeout' in a component or custom Hook has a corresponding 'clearTimeout'.
2992
+ * @see https://eslint-react.xyz/docs/rules/web-api-no-leaked-timeout
2993
+ */
2994
+ 'react-web-api/no-leaked-timeout'?: Linter.RuleEntry<[]>
2975
2995
  /**
2976
2996
  * disallow using shorthand boolean attributes
2977
2997
  * @see https://eslint-react.xyz/docs/rules/avoid-shorthand-boolean
@@ -3793,7 +3813,7 @@ interface RuleOptions {
3793
3813
  */
3794
3814
  'solid/style-prop'?: Linter.RuleEntry<SolidStyleProp>
3795
3815
  /**
3796
- * Enforce sorted import declarations within modules
3816
+ * Enforce sorted `import` declarations within modules
3797
3817
  * @see https://eslint.org/docs/latest/rules/sort-imports
3798
3818
  */
3799
3819
  'sort-imports'?: Linter.RuleEntry<SortImports>
@@ -5254,7 +5274,7 @@ interface RuleOptions {
5254
5274
  * Disallow using code marked as `@deprecated`
5255
5275
  * @see https://typescript-eslint.io/rules/no-deprecated
5256
5276
  */
5257
- 'ts/no-deprecated'?: Linter.RuleEntry<[]>
5277
+ 'ts/no-deprecated'?: Linter.RuleEntry<TsNoDeprecated>
5258
5278
  /**
5259
5279
  * Disallow duplicate class members
5260
5280
  * @see https://typescript-eslint.io/rules/no-dupe-class-members
@@ -5372,6 +5392,11 @@ interface RuleOptions {
5372
5392
  * @see https://typescript-eslint.io/rules/no-misused-promises
5373
5393
  */
5374
5394
  'ts/no-misused-promises'?: Linter.RuleEntry<TsNoMisusedPromises>
5395
+ /**
5396
+ * Disallow using the spread operator when it might cause unexpected behavior
5397
+ * @see https://typescript-eslint.io/rules/no-misused-spread
5398
+ */
5399
+ 'ts/no-misused-spread'?: Linter.RuleEntry<TsNoMisusedSpread>
5375
5400
  /**
5376
5401
  * Disallow enums from having both number and string members
5377
5402
  * @see https://typescript-eslint.io/rules/no-mixed-enums
@@ -12120,6 +12145,7 @@ type StyleKeySpacing = []|[({
12120
12145
  mode?: ("strict" | "minimum")
12121
12146
  beforeColon?: boolean
12122
12147
  afterColon?: boolean
12148
+ ignoredNodes?: ("ObjectExpression" | "ObjectPattern" | "ImportDeclaration" | "ExportNamedDeclaration" | "ExportAllDeclaration" | "TSTypeLiteral" | "TSInterfaceBody" | "ClassBody")[]
12123
12149
  } | {
12124
12150
  singleLine?: {
12125
12151
  mode?: ("strict" | "minimum")
@@ -12635,6 +12661,7 @@ type StyleNoExtraParens = ([]|["functions"] | []|["all"]|["all", {
12635
12661
  enforceForNewInMemberExpressions?: boolean
12636
12662
  enforceForFunctionPrototypeMethods?: boolean
12637
12663
  allowParensAfterCommentPattern?: string
12664
+ nestedConditionalExpressions?: boolean
12638
12665
  }])
12639
12666
  // ----- style/no-mixed-operators -----
12640
12667
  type StyleNoMixedOperators = []|[{
@@ -12732,14 +12759,14 @@ type StyleOperatorLinebreak = []|[(("after" | "before" | "none") | null)]|[(("af
12732
12759
  }
12733
12760
  }]
12734
12761
  // ----- style/padded-blocks -----
12735
- type StylePaddedBlocks = []|[(("always" | "never") | {
12736
- blocks?: ("always" | "never")
12737
- switches?: ("always" | "never")
12738
- classes?: ("always" | "never")
12739
- })]|[(("always" | "never") | {
12740
- blocks?: ("always" | "never")
12741
- switches?: ("always" | "never")
12742
- classes?: ("always" | "never")
12762
+ type StylePaddedBlocks = []|[(("always" | "never" | "start" | "end") | {
12763
+ blocks?: ("always" | "never" | "start" | "end")
12764
+ switches?: ("always" | "never" | "start" | "end")
12765
+ classes?: ("always" | "never" | "start" | "end")
12766
+ })]|[(("always" | "never" | "start" | "end") | {
12767
+ blocks?: ("always" | "never" | "start" | "end")
12768
+ switches?: ("always" | "never" | "start" | "end")
12769
+ classes?: ("always" | "never" | "start" | "end")
12743
12770
  }), {
12744
12771
  allowSingleLineBlocks?: boolean
12745
12772
  }]
@@ -13297,6 +13324,8 @@ type TsConsistentTypeAssertions = []|[({
13297
13324
  assertionStyle: "never"
13298
13325
  } | {
13299
13326
 
13327
+ arrayLiteralTypeAssertions?: ("allow" | "allow-as-parameter" | "never")
13328
+
13300
13329
  assertionStyle?: ("as" | "angle-bracket")
13301
13330
 
13302
13331
  objectLiteralTypeAssertions?: ("allow" | "allow-as-parameter" | "never")
@@ -13753,6 +13782,22 @@ type TsNoConfusingVoidExpression = []|[{
13753
13782
 
13754
13783
  ignoreVoidReturningFunctions?: boolean
13755
13784
  }]
13785
+ // ----- ts/no-deprecated -----
13786
+ type TsNoDeprecated = []|[{
13787
+
13788
+ allow?: (string | {
13789
+ from: "file"
13790
+ name: (string | [string, ...(string)[]])
13791
+ path?: string
13792
+ } | {
13793
+ from: "lib"
13794
+ name: (string | [string, ...(string)[]])
13795
+ } | {
13796
+ from: "package"
13797
+ name: (string | [string, ...(string)[]])
13798
+ package: string
13799
+ })[]
13800
+ }]
13756
13801
  // ----- ts/no-duplicate-type-constituents -----
13757
13802
  type TsNoDuplicateTypeConstituents = []|[{
13758
13803
 
@@ -13894,6 +13939,22 @@ type TsNoMisusedPromises = []|[{
13894
13939
  variables?: boolean
13895
13940
  })
13896
13941
  }]
13942
+ // ----- ts/no-misused-spread -----
13943
+ type TsNoMisusedSpread = []|[{
13944
+
13945
+ allow?: (string | {
13946
+ from: "file"
13947
+ name: (string | [string, ...(string)[]])
13948
+ path?: string
13949
+ } | {
13950
+ from: "lib"
13951
+ name: (string | [string, ...(string)[]])
13952
+ } | {
13953
+ from: "package"
13954
+ name: (string | [string, ...(string)[]])
13955
+ package: string
13956
+ })[]
13957
+ }]
13897
13958
  // ----- ts/no-namespace -----
13898
13959
  type TsNoNamespace = []|[{
13899
13960
 
@@ -13969,7 +14030,7 @@ type TsNoShadow = []|[{
13969
14030
 
13970
14031
  builtinGlobals?: boolean
13971
14032
 
13972
- hoist?: ("all" | "functions" | "never")
14033
+ hoist?: ("all" | "functions" | "functions-and-types" | "never" | "types")
13973
14034
 
13974
14035
  ignoreFunctionTypeParameterNameValueShadow?: boolean
13975
14036
 
@@ -14882,6 +14943,7 @@ type VueKeySpacing = []|[({
14882
14943
  mode?: ("strict" | "minimum")
14883
14944
  beforeColon?: boolean
14884
14945
  afterColon?: boolean
14946
+ ignoredNodes?: ("ObjectExpression" | "ObjectPattern" | "ImportDeclaration" | "ExportNamedDeclaration" | "ExportAllDeclaration" | "TSTypeLiteral" | "TSInterfaceBody" | "ClassBody")[]
14885
14947
  } | {
14886
14948
  singleLine?: {
14887
14949
  mode?: ("strict" | "minimum")
@@ -15408,6 +15470,7 @@ type VueNoExtraParens = ([]|["functions"] | []|["all"]|["all", {
15408
15470
  enforceForNewInMemberExpressions?: boolean
15409
15471
  enforceForFunctionPrototypeMethods?: boolean
15410
15472
  allowParensAfterCommentPattern?: string
15473
+ nestedConditionalExpressions?: boolean
15411
15474
  }])
15412
15475
  // ----- vue/no-irregular-whitespace -----
15413
15476
  type VueNoIrregularWhitespace = []|[{
package/dist/index.js CHANGED
@@ -881,7 +881,7 @@ async function javascript(options = {}) {
881
881
  allowUnboundThis: true
882
882
  }
883
883
  ],
884
- "prefer-const": [
884
+ "prefer-const": isInEditor ? "off" : [
885
885
  "error",
886
886
  {
887
887
  destructuring: "all",
@@ -1243,7 +1243,8 @@ async function react(options = {}) {
1243
1243
  "react-hooks": pluginReactHooks,
1244
1244
  "react-hooks-extra": plugins["@eslint-react/hooks-extra"],
1245
1245
  "react-naming-convention": plugins["@eslint-react/naming-convention"],
1246
- "react-refresh": pluginReactRefresh
1246
+ "react-refresh": pluginReactRefresh,
1247
+ "react-web-api": plugins["@eslint-react/web-api"]
1247
1248
  }
1248
1249
  },
1249
1250
  {
@@ -1304,6 +1305,11 @@ async function react(options = {}) {
1304
1305
  ]
1305
1306
  }
1306
1307
  ],
1308
+ // recommended rules from @eslint-react/web-api
1309
+ "react-web-api/no-leaked-event-listener": "warn",
1310
+ "react-web-api/no-leaked-interval": "warn",
1311
+ "react-web-api/no-leaked-resize-observer": "warn",
1312
+ "react-web-api/no-leaked-timeout": "warn",
1307
1313
  // recommended rules from @eslint-react
1308
1314
  "react/ensure-forward-ref-using-ref": "warn",
1309
1315
  "react/jsx-no-duplicate-props": "warn",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@antfu/eslint-config",
3
3
  "type": "module",
4
- "version": "3.13.0",
4
+ "version": "3.15.0",
5
5
  "description": "Anthony's ESLint config",
6
6
  "author": "Anthony Fu <anthonyfu117@hotmail.com> (https://github.com/antfu/)",
7
7
  "license": "MIT",
@@ -85,17 +85,17 @@
85
85
  "@clack/prompts": "^0.9.1",
86
86
  "@eslint-community/eslint-plugin-eslint-comments": "^4.4.1",
87
87
  "@eslint/markdown": "^6.2.1",
88
- "@stylistic/eslint-plugin": "^2.12.1",
89
- "@typescript-eslint/eslint-plugin": "^8.19.1",
90
- "@typescript-eslint/parser": "^8.19.1",
91
- "@vitest/eslint-plugin": "^1.1.24",
88
+ "@stylistic/eslint-plugin": "^2.13.0",
89
+ "@typescript-eslint/eslint-plugin": "^8.20.0",
90
+ "@typescript-eslint/parser": "^8.20.0",
91
+ "@vitest/eslint-plugin": "^1.1.25",
92
92
  "eslint-config-flat-gitignore": "^1.0.0",
93
93
  "eslint-flat-config-utils": "^1.0.0",
94
94
  "eslint-merge-processors": "^1.0.0",
95
95
  "eslint-plugin-antfu": "^2.7.0",
96
- "eslint-plugin-command": "^2.0.7",
96
+ "eslint-plugin-command": "^2.1.0",
97
97
  "eslint-plugin-import-x": "^4.6.1",
98
- "eslint-plugin-jsdoc": "^50.6.1",
98
+ "eslint-plugin-jsdoc": "^50.6.2",
99
99
  "eslint-plugin-jsonc": "^2.18.2",
100
100
  "eslint-plugin-n": "^17.15.1",
101
101
  "eslint-plugin-no-only-tests": "^3.3.0",
@@ -120,53 +120,53 @@
120
120
  "devDependencies": {
121
121
  "@antfu/ni": "^23.2.0",
122
122
  "@eslint-react/eslint-plugin": "^1.23.2",
123
- "@eslint/config-inspector": "^0.7.1",
123
+ "@eslint/config-inspector": "^1.0.0",
124
124
  "@prettier/plugin-xml": "^3.4.1",
125
- "@stylistic/eslint-plugin-migrate": "^2.12.1",
125
+ "@stylistic/eslint-plugin-migrate": "^2.13.0",
126
126
  "@types/fs-extra": "^11.0.4",
127
- "@types/node": "^22.10.5",
127
+ "@types/node": "^22.10.7",
128
128
  "@types/prompts": "^2.4.9",
129
129
  "@types/yargs": "^17.0.33",
130
- "@unocss/eslint-plugin": "^0.65.4",
130
+ "@unocss/eslint-plugin": "^65.4.2",
131
131
  "astro-eslint-parser": "^1.1.0",
132
- "bumpp": "^9.10.0",
133
- "eslint": "^9.17.0",
132
+ "bumpp": "^9.10.1",
133
+ "eslint": "^9.18.0",
134
134
  "eslint-plugin-astro": "^1.3.1",
135
135
  "eslint-plugin-format": "^1.0.1",
136
136
  "eslint-plugin-react-hooks": "^5.1.0",
137
- "eslint-plugin-react-refresh": "^0.4.16",
137
+ "eslint-plugin-react-refresh": "^0.4.18",
138
138
  "eslint-plugin-solid": "^0.14.5",
139
139
  "eslint-plugin-svelte": "^2.46.1",
140
- "eslint-typegen": "^0.3.2",
140
+ "eslint-typegen": "^1.0.0",
141
141
  "execa": "^9.5.2",
142
142
  "fast-glob": "^3.3.3",
143
- "fs-extra": "^11.2.0",
143
+ "fs-extra": "^11.3.0",
144
144
  "jiti": "^2.4.2",
145
- "lint-staged": "^15.3.0",
145
+ "lint-staged": "^15.4.1",
146
146
  "prettier-plugin-astro": "^0.14.1",
147
147
  "prettier-plugin-slidev": "^1.0.5",
148
148
  "rimraf": "^6.0.1",
149
149
  "simple-git-hooks": "^2.11.1",
150
- "svelte": "^5.17.1",
150
+ "svelte": "^5.19.0",
151
151
  "svelte-eslint-parser": "^0.43.0",
152
152
  "tsup": "^8.3.5",
153
153
  "tsx": "^4.19.2",
154
154
  "typescript": "^5.7.3",
155
- "vitest": "^2.1.8",
155
+ "vitest": "^3.0.2",
156
156
  "vue": "^3.5.13",
157
- "@antfu/eslint-config": "3.13.0"
157
+ "@antfu/eslint-config": "3.15.0"
158
158
  },
159
159
  "resolutions": {
160
160
  "@eslint-community/eslint-utils": "^4.4.1",
161
- "@typescript-eslint/utils": "^8.19.1",
162
- "eslint": "^9.17.0",
161
+ "@typescript-eslint/utils": "^8.20.0",
162
+ "eslint": "^9.18.0",
163
163
  "tsx": "^4.19.2"
164
164
  },
165
165
  "simple-git-hooks": {
166
166
  "pre-commit": "npx lint-staged"
167
167
  },
168
168
  "lint-staged": {
169
- "*": "eslint --flag unstable_ts_config --fix"
169
+ "*": "eslint --fix"
170
170
  },
171
171
  "scripts": {
172
172
  "build": "nr typegen && tsup --format esm,cjs --clean --dts",
@@ -174,7 +174,7 @@
174
174
  "dev": "npx @eslint/config-inspector --config eslint.config.ts",
175
175
  "build:inspector": "pnpm build && npx @eslint/config-inspector build",
176
176
  "watch": "tsup --format esm,cjs --watch",
177
- "lint": "eslint --flag unstable_ts_config .",
177
+ "lint": "eslint .",
178
178
  "typegen": "tsx scripts/typegen.ts",
179
179
  "release": "bumpp && pnpm publish",
180
180
  "test": "vitest",