Bug: config-helper.ts
has unexpected behavior when base config contains only meta keys
#10754
Closed
4 tasks done
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.
package: typescript-eslint
Issues related to the typescript-eslint package
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...
Relevant Package
typescript-eslint
There are two bugs related to this issue: one meaningful and one mostly inconsequential.
1. Using
extends
intseslint.config()
creates global ignoresPlayground Link
Reproduction with StackBlitz.
ESLint Config
Expected Result
I expect that the
ignores
key only apply to the extend config, or at the very least not create a global ignores that affects the entire ESLint config.In other words, I expect the resulting configuration array to be equivalent to this:
Actual Result
If you look into the config inspector, the resulting config is the following:
In other words, the equivalent config array is
Extends will create a configuration with only the
ignores
key, which is parsed as a global ignores. Then,.ts
and.tsx
will not be linted.This can be seen in the reproduction where
src/index.ts
is not linted as-is, while removing theextends
config correctly allows it to be linted.2. Using
extends
intseslint.config()
creates extraneous configPlayground Link
Reproduction with StackBlitz
ESLint Config
Expected Result
Per ESLint’s documentation (Debug your Configuration#Print a File’s Calculated Configuration), "You won’t see any entries for files, ignores, or name, because those are only used in calculating the final configuration and so do not appear in the result[ing configuration]."
I expect that if there are no meaningful keys for configuration and I only want to extend those configs with those keys, it should not create an unnecessary configuration file, and only updates the configs accordingly.
The ESLint configuration array should look like:
Actual Result
If you look into the config inspector, the resulting config is the following:
Or equivalently
The final config in the config array named
my-config
doesn't do anything and is unnecessary, and may make debugging harder in more complex ESLint configs.Versions
@typescript-eslint
8.22.0
TypeScript
5.7.3
ESLint
9.19.0
The text was updated successfully, but these errors were encountered: