-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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 read the FAQ and my problem is not listed.
Description
The strict-type-checked configuration sets allowNumber: false for the restrict-template-expressions rule. This prohibits code like the following:
const userId = 123;
const url = `/users/${userId}`;There is nothing wrong with this code. The official MDN docs on template literals contain code just like it. The typescript-eslint docs for this rule offer no rationale of why interpolating numbers into a string in this way is problematic.
Impacted Configurations
- strict
- strict-type-checked
Additional Info
I'm totally bought into all the other options that strict enables for restrict-template-expressions (allowAny, allowArray, allowBoolean, allowNullish, allowNever). These seem potentially problematic since they could result in your inadvertently showing debug code to users. But allowNumber? I'm having trouble seeing any rationale for banning that.
My proposal would be to either change the default setting or add a clear explanation of why interpolating numbers into strings is dangerous.
Possibly related: