Enhancement: [restrict-template-expressions] allowURLSearchParams
option
#5323
Labels
duplicate
This issue or pull request already exists
enhancement: plugin rule option
New rule option for an existing eslint-plugin rule
package: eslint-plugin
Issues related to @typescript-eslint/eslint-plugin
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://github.com/typescript-eslint/typescript-eslint/blob/v4.28.2/packages/eslint-plugin/docs/rules/restrict-template-expressions.md
Description
Having to do this is a little annoying:
When the version of the above without
.toString()
is always safe and less verbose. URLSearchParams is supported in pretty much every browser, nodejs, and deno.I read the rationale for closing the broader issue #3538: #3538 (comment) and I don't think it applies here. This is specific to
URLSearchParams
not any-class-which-implements-toString
which is less safe and harder to implement.Fail
Pass
Additional Info
The option should work just like
allowNumber
,allowBoolean
, etc.I'd be happy to contribute a PR if it'd be accepted.
The text was updated successfully, but these errors were encountered: