Bug: [sort-type-constituents] Auto-fix can change behavior #6339
Labels
accepting prs
Go ahead, send a pull request that resolves this issue
bug
Something isn't working
package: eslint-plugin
Issues related to @typescript-eslint/eslint-plugin
Before You File a Bug Report Please Confirm You Have Done The Following...
Playground Link
https://typescript-eslint.io/play/#ts=4.9.3&sourceType=module&code=C4TwDgpgBAQgTgewNYQHYB4AqA+KBeAWACgooAfKACkyggA9g0ATAZylQFcBbAIwjigB+KAHIAFgEsRUAFyjgY-hBEBKYqQotgcCagDmAbmJA&eslintrc=N4KABGBEBOCuA2BTAzpAXGYUACAXAngA4oDG0AlobgLQrzkB2uA9MgPbQ0HHUlsPJc5XLERNUGANqRE0aB0gBdMAF8QKoA&tsconfig=N4KABGBEDGD2C2AHAlgGwKYCcDyiAuysAdgM6QBcYoEEkJemy0eAcgK6qoDCAFutAGsylBm3TgwAXxCSgA
Repro Code
ESLint Config
tsconfig
Expected Result
When using "fix", I expect it to keep the same semantics of the code. This might include keeping the
()
around theT extends
clause.Also I expect the "fix" to be stable, so that it no longer reports an error.
Actual Result
It fixes to this, which changes the meaning of the code:
Also, it still complains about the order. If you fix again it changes to
Additional Info
I don't know/care what order it sorts to, as long as it doesn't break my code! 🙂
The text was updated successfully, but these errors were encountered: