Rule proposal: Prevent / Warns if the code attempts to interpolate functions directly into string template #5600
Labels
duplicate
This issue or pull request already exists
package: eslint-plugin
Issues related to @typescript-eslint/eslint-plugin
wontfix
This will not be worked on
Before You File a Proposal Please Confirm You Have Done The Following...
My proposal is suitable for this project
Description
This rule prevents potential erroneous implicit
Function
tostring
conversion in string interpolation expressions. Converting a function (or class itself) into string will cause function body being inserted into the string template, which could be undesirable in most of the cases.I think we can leverage TypeScript typing information for the "Function" type checking. We don't need to cover the case where the interpolated value does not have
Function
type at compile-time.Fail Cases
Pass Cases
Additional Info
No response
The text was updated successfully, but these errors were encountered: