-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug: single run mode breaks with fixers #9344
Comments
You're mistaken about the cause. debug output with single-run inference turned on:
Note all of the The first lint pass fixes the first import to add the ESLint then does a second lint pass (it tries to exhaustively apply fixers). During this lint pass for whatever reason the type information is borked and so both the This then causes Then there's the 3rd and final lint pass after that fixer and now there's only 2 Which leaves you with the final broken code and lint errors. cc @JoshuaKGoldberg this is a blocker for the v8 release as we can't rollout single run inference by default with this bug. Note: I haven't investigated any further than just doing a debug run in the user's repo. |
TBH this is a separate bug that should be fixed |
YES this is the bug we were talking about wanting a repro for! (can't find the reference right now, but it's somewhere) Relevant: the current limitations of ESLint described in eslint/rfcs#102, as with other issues, makes this tricky. |
I set up a more streamlined standalone repro here: https://github.com/JoshuaKGoldberg/repros/tree/tseslint-single-run-inference-introducing-bugs-in-fix |
@JoshuaKGoldberg I think this is the real bug we should look at fixing:
We can disable single-run inference during a fix run as a band-aid, but we probably want to fix the underlying bug. |
Agreed. I have no idea how to fix that right now though. 😬 |
Fixed by #9577. |
Before You File a Bug Report Please Confirm You Have Done The Following...
Playground Link
https://github.com/hasakilol/react-vite/blob/master/src/Test.tsx
Repro Code
ESLint Config
tsconfig
Expected Result
https://github.com/hasakilol/react-vite/blob/master/src/Test.tsx#L8
No matter how you configure
@typescript-eslint/consistent-type-imports
('off' or 'error') and@typescript-eslint/no-duplicate-type-constituents
('off' or 'error'),item: { a: string; } | typeof Null | typeof Undefined,
should not change after runningnpx eslint --fix src/Test.tsx
.Actual Result
When both
@typescript-eslint/consistent-type-imports
and@typescript-eslint/no-duplicate-type-constituents
are configurederror
,item: { a: string; } | typeof Null | typeof Undefined,
is changed toitem: { a: string; } | typeof Null ,
after runningnpx eslint --fix src/Test.tsx
.When either
@typescript-eslint/consistent-type-imports
or@typescript-eslint/no-duplicate-type-constituents
are configuredoff
,item: { a: string; } | typeof Null | typeof Undefined,
will not change (what I expect) after runningnpx eslint --fix src/Test.tsx
.Additional Info
"@typescript-eslint/eslint-plugin": "^8.0.0-alpha.14",
"@typescript-eslint/parser": "^8.0.0-alpha.14",
"@typescript-eslint/scope-manager": "^8.0.0-alpha.14",
"@typescript-eslint/type-utils": "^8.0.0-alpha.14",
"@typescript-eslint/types": "^8.0.0-alpha.14",
"@typescript-eslint/typescript-estree": "^8.0.0-alpha.14",
"@typescript-eslint/utils": "^8.0.0-alpha.14",
"@typescript-eslint/visitor-keys": "^8.0.0-alpha.14",
"typescript-eslint": "^8.0.0-alpha.14",
"eslint": "^9.3.0",
The text was updated successfully, but these errors were encountered: