Closed
Description
As per #9458 (comment): relying on _
prefixes as a naming convention can be suboptimal for a few reasons:
- Libraries such as jQuery and Knockout often provide function interfaces whose first parameter(s) aren't necessary for all usages
- We're binding compiler logic to the variable name
- It's easy to forget to remove the prefix, such as during refactoring
- Prefixed names clash with some existing coding styles
I jumped the gun a bit and sent PR #12139 :) that blindly allows unused parameters before used ones. Perhaps a more complete design would be to provide configurations for --noUnusedParameters
?
- No unused parameters in any situation:
tsc --noUnusedParameters
- "---" excluding
_
prefixes:tsc --noUnusedParameters allow-prefixed
- "---" excluding those before used ones:
tsc --noUnusedParameters allow-before-used
- "---" excluding both
_
prefixes and those before used ones:tsc --noUnusedParameters allow-prefixed --noUnusedParameters allow-before-used