Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork2.8k
Description
Before You File a Proposal Please Confirm You Have Done The Following...
- I havesearched for related issues and found none that match my proposal.
- I have searched thecurrent rule list and found no rules that match my proposal.
- I haveread the FAQ and my problem is not listed.
Relevant Package
typescript-eslint
My proposal is suitable for this project
- I believe my proposal would be useful to the broader TypeScript community (meaning it is not a niche proposal).
Description
With ESLint v9.22 they added their owndefineConfig
config helper (similar toconfig
), which does again supportextends
. I of course immediately tried to rewrite my ESLint config to use the new helper:
import{defineConfig,globalIgnores}from"eslint/config";importtsfrom"typescript-eslint";exportdefaultdefineConfig({plugins:{ts:ts.plugin},extends:["ts/strict","ts/stylistic",],rules:{"ts/no-inferrable-types":["error",{ignoreParameters:true,ignoreProperties:true},],},},);
Runningnpx eslint
fails with the following error:
Oops! Something went wrong! :(ESLint: 9.22.0TypeError: Plugin config "ts/strict" is an eslintrc config and cannot be used in this context. at deepNormalizePluginConfig (C:\Users\niklaswimmer\Dev\test\node_modules\@eslint\config-helpers\dist\cjs\index.cjs:231:9) at findPluginConfig (C:\Users\niklaswimmer\Dev\test\node_modules\@eslint\config-helpers\dist\cjs\index.cjs:262:9) at C:\Users\niklaswimmer\Dev\test\node_modules\@eslint\config-helpers\dist\cjs\index.cjs:394:25 at Array.map (<anonymous>) at processExtends (C:\Users\niklaswimmer\Dev\test\node_modules\@eslint\config-helpers\dist\cjs\index.cjs:392:36) at C:\Users\niklaswimmer\Dev\test\node_modules\@eslint\config-helpers\dist\cjs\index.cjs:464:38 at Array.flatMap (<anonymous>) at processConfigList (C:\Users\niklaswimmer\Dev\test\node_modules\@eslint\config-helpers\dist\cjs\index.cjs:464:20) at defineConfig (C:\Users\niklaswimmer\Dev\test\node_modules\@eslint\config-helpers\dist\cjs\index.cjs:499:9) at file:///C:/Users/niklaswimmer/Dev/test/eslint.config.mjs?mtime=1741610408364:37:16
My understandig is that when givents/strict
ESLint tries to accessts.plugin.configs.strict
, which is not the same asts.configs.strict
and not compatible with flat configs.
Additional Info
I marked this as enhancement and not as bug because the "fix" is to simply usets.configs.strict
instead of"ts/strict"
(and use the full rule namespace instead of just"ts"
), but I expect the current behavior to be confusing for new users (ESLint shows both options in theirdocs, but if one of them does not work, it will be confusing).