-
Notifications
You must be signed in to change notification settings - Fork 13k
Closed
Labels
SuggestionAn idea for TypeScriptAn idea for TypeScriptToo ComplexAn issue which adding support for may be too complex for the value it addsAn issue which adding support for may be too complex for the value it adds
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
Metadata
Metadata
Assignees
Labels
SuggestionAn idea for TypeScriptAn idea for TypeScriptToo ComplexAn issue which adding support for may be too complex for the value it addsAn issue which adding support for may be too complex for the value it adds