-
-
Notifications
You must be signed in to change notification settings - Fork 381
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
Rule proposal: no-useless-interpolation
#1261
Comments
Oh, I just realized this may be difficult to implement without variable type information. What is the position of the project on using type information (eg. TypeScript, JSDoc) in rules? |
🤦♂️ Ohh I know why this rule seemed so familiar to me, I proposed something similar over at typescript-eslint/typescript-eslint#2846 If you think this is a better place for this (instead of here) then I will close this. |
Ah and background of a similar proposal in the ESLint repo: eslint/eslint#10798 |
This is not right they are the same, one expression plus two empty quasis. |
Actually, not really nessary, if it's unknown type, we can assume it's type-casting, |
The rule could be two parts
Update: String concatenation should fobid too
|
I think we can accept it. |
One note, taged templates should not reported. |
This is now accepted. |
Note: the |
I will work on it! |
I started few month ago, but I can't remember the progress... https://github.com/fisker/eslint-plugin-unicorn/commits/no-useless-interpolation |
is anything happening on this? |
This rule to be implemented by eslint-plugin-lit: |
Some progress on that? I could includes functions like |
Looks like this was implemented in |
Hi there! 👋 First of all, thanks again for this plugin, super helpful, the things available in this plugin.
I wanted to propose a new rule to address a pattern that I have seen from a lot of our students at @upleveled - writing overly complex patterns with unnecessary interpolations in template strings (eg. a single string variable, or a string literal, or multiple string literals).
Fail
Pass
Implementation ideas
Looking into the ASTExplorer, I guess the simple version of the first failure case below would be:
TemplateLiteral.expressions
(anIdentifier
)TemplateLiteral.quasis
, all empty stringsFor the literals, I guess no limit to the
quasis
, but every element inexpressions
should be aLiteral
.The text was updated successfully, but these errors were encountered: