-
Notifications
You must be signed in to change notification settings - Fork 885
suggestion: option for variable-name
rule to allow leading underscore only for unused params
#3442
Comments
The latest version of the "naming-convention": [
true,
// forbid leading and trailing underscores and enforce camelCase on EVERY name. will be overridden by subtypes if needed
{"type": "default", "format": "camelCase", "leadingUnderscore": "forbid", "trailingUnderscore": "forbid"},
...
// allow leading underscores for unused parameters, because `tsc --noUnusedParameters` will not flag underscore prefixed parameters
// all other rules (trailingUnderscore: forbid, format: camelCase) still apply
{"type": "parameter", "modifiers": "unused", "leadingUnderscore": "allow"}
] |
Excellent, that's just what we were looking for! Thanks! |
Thanks for the link @ajafff. I would like this functionality incorporated into the |
This is now more important as in TypeScript 2.9 EDIT: Hmm, actually, it's already supported, see https://palantir.github.io/tslint/rules/variable-name/. Should this issue be closed? |
@mgol All I see at that link is "allow-leading-underscore". This suggestion was about allowing leading underscores only for unused variables (and still banning them elsewhere). |
@sethbrenith Ah, sorry, I misinterpreted your request. |
@ajafff Since you're most familiar, Would you mind giving this PR a go? @JoshuaKGoldberg given your participation in #3558, not sure if you're actively looking into this? |
@aryzing no plans on my part to address this issue, but if you want to send a PR that'd be great! 😊 |
Oh man it would be great to fix this. |
☠️ TSLint's time has come! ☠️ TSLint is no longer accepting most feature requests per #4534. See typescript-eslint.io for the new, shiny way to lint your TypeScript code with ESLint. ✨ It was a pleasure open sourcing with you all! |
🤖 Beep boop! 👉 TSLint is deprecated 👈 (#4534) and you should switch to typescript-eslint! 🤖 🔒 This issue is being locked to prevent further unnecessary discussions. Thank you! 👋 |
I'm just promoting a comment by @mohsen1 in this discussion into its own issue for visibility.
Can
variable-name
know about unused params? Most of us don't want to allow leading underscore elsewhere.The text was updated successfully, but these errors were encountered: