Bug: tseslint.config
hides user-friendly error messages from ESLint
#10549
Labels
accepting prs
Go ahead, send a pull request that resolves this issue
bug
Something isn't working
locked due to age
Please open a new issue if you'd like to say more. See https://typescript-eslint.io/contributing.
Uh oh!
There was an error while loading. Please reload this page.
Before You File a Bug Report Please Confirm You Have Done The Following...
Issue Description
According to the docs,
tseslint.config
is a helper function thatextends
property on config objects.Besides that, it should have no other effect.
However, another "hidden" difference, when using
tseslint.config
, is that it suppresses user-friendly error messages from ESLint.For example, if a config object is
undefined
, ESLint returns:TypeError: Config (unnamed): Unexpected undefined config at user-defined index 0.
but
tseslint.config
returns:TypeError: Cannot destructure property 'extends' of 'configWithExtends' as it is undefined.
which is a less-helpful error.
Now, in an ideal world, TypeScript would report that a user had passed
undefined
to the function. However, I think there are several things to consider:eslint.config.js
in JavaScript, and not type-check it, while still usingtseslint.config()
tseslint.config(eslintPlugin['nonexistent-preset']);
tseslint.config
should not remove any functionality on the JavaScript side, since that's what the docs say.Reproduction Repository Link
https://github.com/abrahamguo/repro/tree/undefined-config
Repro Steps
npm i
npx eslint -c tseslint.config.js .
— compare withnpx eslint .
Versions
typescript-eslint
8.18.2
ESLint
9.17.0
The text was updated successfully, but these errors were encountered: