Bug: [no-unnecessary-template-expression] Auto fix will change meaning of code #8669
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: 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=5.3.0-beta&fileType=.tsx&code=MYGwhgzhAECC0G8BQ1oQC5nQS2NAZgPYBOAtlgBQZYCuEAXItAHZikCmjGx2zA5tAA%2B0GswAm7fL3ZjoAXyEjxk6WICUXdD36LREqcxmIUqaMXboaxZmkyWIAfgB0rDtAfQABgBIE1ey5s7ELCAOShcp5OWtikFGrQjHoqhmIA3CZySHJAA&eslintrc=N4KABGBEBOCuA2BTAzpAXGYkACAXAngA4oDG0AlobgLQrzkB2uA9AwPbWzKJLLLW5EAW0LwAhoOr1B0MfFQZIiaNDbRIAXxAagA&tsconfig=N4KABGBEDGD2C2AHAlgGwKYCcDyiAuysAdgM6QBcYwAviNUA&tokens=false
Repro Code
ESLint Config
tsconfig
{ "compilerOptions": {} }
Expected Result
I think the autofixer should have added parens when it removed the template literal.
Actual Result
Additional Info
This seems to repro in Playground with or without
strictNullChecks
. I'm my project, I was not usingstrictNullChecks
.The autofix highlights that the original code is silly.
I tested this also with minimal eslint config, and it still happens.
Edit: I changed Playground link to be most minimal rule set & tsConfig.
The text was updated successfully, but these errors were encountered: