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
Enhancement: [restrict-template-expressions] More permissive type check #6279
Comments
No, users have been known to create quite a few of these in their projects. 😉 By which I mean: the rule would be much less useful if it was configured to only work on a small set of named types. You'd have to reconfigure it every time you CRUD them! Note that #6161 adds a few options for specific types [edit: to @typescript-eslint/triage-team what do you think about instead adding an |
Sounds good to me :) The exact format may still be up for discussion (if we want to propagate this convention, we should probably prioritize built-in types like |
FYI - #6161 is for IMO the point of the rule was always "make sure you pass strings that are sanitised and correct for consumers to see" - which is why I have pushed back vehemently in the past against adding more allow options. But it's clear that users see this rule differently, and are comfortable instead with "make sure you pass things that are |
Fun fact, the TypeScript codebase creates a |
Before You File a Proposal Please Confirm You Have Done The Following...
My proposal is suitable for this project
Link to the rule's documentation
https://typescript-eslint.io/rules/restrict-template-expressions/
Description
Related: #6203 #5325
I've originally opened #5600 because I'd like to leverage this rule to discover the accidental misuse of string template expression (e.g., the mostly occurring case is, interpolating a
() => string
,Promise<string>
orPromise<...>
instead ofstring
). However, after I've openedrestrict-template-expressions
. there seems to be a lot of rule violations that cannot be silenced with existing options. For example,string[]
unknown
never
URL
URLSearchParameters
Instead of defining what types are allowed in the interpolate expression, is it possible to set up a list of blocked types?
Fail
Pass
Additional Info
No response
The text was updated successfully, but these errors were encountered: