Description
Before You File a Proposal Please Confirm You Have Done The Following...
- I have searched for related issues and found none that match my proposal.
- I have searched the current rule list and found no rules that match my proposal.
- I have read 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 own defineConfig
config helper (similar to config
), which does again support extends
. I of course immediately tried to rewrite my ESLint config to use the new helper:
import { defineConfig, globalIgnores } from "eslint/config";
import ts from "typescript-eslint";
export default defineConfig(
{
plugins: {
ts: ts.plugin
},
extends: [
"ts/strict",
"ts/stylistic",
],
rules: {
"ts/no-inferrable-types": [
"error",
{ ignoreParameters: true, ignoreProperties: true },
],
},
},
);
Running npx eslint
fails with the following error:
Oops! Something went wrong! :(
ESLint: 9.22.0
TypeError: 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 given ts/strict
ESLint tries to access ts.plugin.configs.strict
, which is not the same as ts.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 use ts.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 their docs, but if one of them does not work, it will be confusing).