Closed as not planned
Description
Before You File a Proposal Please Confirm You Have Done The Following...
- I have searched for related issues and found none that match my proposal.
- I have searched the current rule list and found no rules that match my proposal.
- I have read the FAQ and my problem is not listed.
My proposal is suitable for this project
- I believe my proposal would be useful to the broader TypeScript community (meaning it is not a niche proposal).
Link to the rule's documentation
Description
Having to do this is a little annoying:
const href = `https://example.com/foo/bar/baz?${new URLSearchParams({ abc: 'xyz' }).toString()}`
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
const href = 'https://example.com/foo/bar/baz?${{ abc: 'xyz' }}`
Pass
const href = 'https://example.com/foo/bar/baz?${new URLSearchParams({ abc: 'xyz' })}`
Additional Info
The option should work just like allowNumber
, allowBoolean
, etc.
I'd be happy to contribute a PR if it'd be accepted.