Bug: consistent-type-definitions leaves trailing parenthesis when converting a paren-wrapped type to an interface #10233
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: eslint-plugin
Issues related to @typescript-eslint/eslint-plugin
Before You File a Bug Report Please Confirm You Have Done The Following...
Issue Description
This isn't actually a complex issue, but I didn't immediately see how to set eslint version 9 in the playground and I wasn't interested in learning, since I already had a reproduction repo set up.
The issue is that when you use the --fix argument with the
@typescript-eslint/consistent-type-definitions
rule, it will leave a trailing parenthesis if the type it converts was wrapped in parens.For example, the following code
becomes
triggering a syntax error.
I tried this on the latest version of typescript-eslint, including 8.12.2 and 8.12.3-alpha.1
Reproduction Repository Link
https://github.com/rdecoito/repro-consistent-type-definitions
Repro Steps
Copy-pasted from README in repo:
npm i
npm run lint
npm run lint -- --fix
Versions
typescript-eslint
~8.11.0
TypeScript
5.6.3
ESLint
~9.13.0
node
20.18.0
The text was updated successfully, but these errors were encountered: