-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Rule proposal: detect useless template literal interpolation #2846
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
Labels
accepting prs
Go ahead, send a pull request that resolves this issue
enhancement: new plugin rule
New rule request for eslint-plugin
package: eslint-plugin
Issues related to @typescript-eslint/eslint-plugin
Comments
This rule to be implemented by eslint-plugin-lit |
@KurtPreston whilst it shares the name - that rule is very different. For starters - it only works on template strings tagged with |
Would be nice if we can have that! |
StyleShit
added a commit
to StyleShit/typescript-eslint
that referenced
this issue
Nov 19, 2023
JoshuaKGoldberg
added a commit
that referenced
this issue
Dec 12, 2023
* feat(eslint-plugin): [no-useless-template-literals] add new rule Closes #2846 * fix tests * thank you josh * hopefully fix tests? * support template literals with new lines * support also quotes * fix all files (damn, we need an auto fixer...) * wip * report on specific node * fix docs * fix lint * wip * fix lint * revert unrelated changes * more reverts * wip * wip --------- Co-authored-by: Josh Goldberg ✨ <git@joshuakgoldberg.com>
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
enhancement: new plugin rule
New rule request for eslint-plugin
package: eslint-plugin
Issues related to @typescript-eslint/eslint-plugin
Hi there,
First of all, thanks for this great set of ESLint + TS utilities, these are great!
I am unsure if I'm doing this right, because the issue template was about bug reports, but I would like to propose a new rule. Since I didn't see a template for this, I'm going to go ahead like this, and then can change it / resubmit if necessary.
What I wanted to bring up was the idea of a
@typescript-eslint/no-useless-interpolation
rule, similar to the eslint/eslint#10798 proposal to ESLint, which as far as I can tell, never got implemented.The idea would be, if there is useless interpolation with a template string, this would be an error.
Example of incorrect code:
Examples of correct code:
I would suggest only doing this for strings.
Remaining template things
The text was updated successfully, but these errors were encountered: