Skip to content
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: [no-useless-template-literals] Nested template literals contain useless one #8584

Closed
4 tasks done
waynzh opened this issue Mar 1, 2024 · 0 comments · Fixed by #8575
Closed
4 tasks done

Bug: [no-useless-template-literals] Nested template literals contain useless one #8584

waynzh opened this issue Mar 1, 2024 · 0 comments · Fixed by #8575
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

Comments

@waynzh
Copy link
Contributor

waynzh commented Mar 1, 2024

Before You File a Bug Report Please Confirm You Have Done The Following...

  • I have tried restarting my IDE and the issue persists.
  • I have updated to the latest version of the packages.
  • I have searched for related issues and found none that matched my issue.
  • I have read the FAQ and my problem is not listed.

Playground Link

https://typescript-eslint.io/play/#ts=5.3.3&fileType=.ts&code=MYewdgzgLgBGCuBbGBeGBGA3AKAAYEMASAb1wCMSFEBfM3a-XTIA&eslintrc=N4KABGBEBOCuA2BTAzpAXGUEKQAIBcBPABxQGNoBLY-AWhXkoDt8B6Jge1tmUSWWS18iALbF4AQ2G1Gw6BPioMkRNGgdokcGAC%2BIHUA&tsconfig=&tokens=false

Repro Code

const num = 1;
`a${`b${num}b`}a`;

ESLint Config

{
  "rules": {
    "@typescript-eslint/no-useless-template-literals": "error"
  }
}

tsconfig

No response

Expected Result

Should report and support autofix by removing the unnecessary template literals:

`ab${num}ba`

Actual Result

`a${`b${num}b`}a`

Additional Info

See #8575 (comment).
The valid case in that PR needs to be adjusted if it is merged.

@waynzh waynzh added bug Something isn't working package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin triage Waiting for maintainers to take a look labels Mar 1, 2024
@auvred auvred added accepting prs Go ahead, send a pull request that resolves this issue and removed triage Waiting for maintainers to take a look labels Mar 6, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 14, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
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
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants