-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add unnecessary_underscores
to core/recommended set.
#856
Comments
I'm in favor. It's mostly a style fix but I'm inclined to put it in the core set. |
I'm not sure it warrantes being in |
For public API this might warrant inclusion in the core set, but you're right that it will be incredibly rare. It's definitely not worth splitting the implementation just to be able to include it in the core set.
There's also no (good) reason for maintainers of published packages who are anyways upgrading their language version to not apply the quick fixes for this lint. I'd be happy enough to see this in the recommended set, but I do think it is likely to do more good (alert maintainers of a readability improvement they may have overlooked) than harm (annoy maintainers of published packages who prefer ugly code to any amount of churn?) if we put it in core. |
The lint should also only apply to code that is 3.7 or above (that's where we released it, right?), so if you're not touching your old code, you won't lose points. I don't think it'll matter much for adaption whether the lint is in core or not. I expect authors that edit their code to use the recommended lints. |
Describe the rule you'd like to see added and to what rule set
https://dart.dev/tools/linter-rules/unnecessary_underscores
When a user is using multiple underscores (
__
) and that variable isn't referenced, they should use a wildcard variable_
instead.Enabling this lint will allow us to avoid that pattern which is also the point of having the wildcard variables feature 😀
This should at least be in the recommended lint set.
I'd love to see it in the core lint set though.
We should be encouraging users to use wildcard variables where they can and avoid multiple underscores all together. Wildcard variables provide static errors when used and would prevent errors like referencing an intentionally unused parameter by accident.
Additional context
See paragraph above.
The text was updated successfully, but these errors were encountered: