Skip to content
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

[Wildcard Variables] support for no_leading_underscores_for_local_identifiers #5040

Open
Tracked by #4969
pq opened this issue Aug 2, 2024 · 4 comments
Open
Tracked by #4969
Assignees
Labels
false-negative new-language-feature P2 A bug or feature request we're likely to work on set-recommended Affects a rule in the recommended Dart rule set type-enhancement A request for a change that isn't a bug

Comments

@pq
Copy link
Member

pq commented Aug 2, 2024

The current implementation special-cases all underscore variations:

**EXCEPTION:**: An unused parameter can be named `_`, `__`, `___`, etc.  This is
common practice in callbacks where you are passed a value but you don't need
to use it. Giving it a name that consists solely of underscores is the idiomatic
way to indicate that the value isn't used.

With the wild card variables feature we might start reporting on __, ___, etc.

Note that making this change may result in newly reported diagnostics. The impact could have some reach since this is a recommended lint.

/fyi @kallentu @bwilkerson

@pq pq added type-enhancement A request for a change that isn't a bug P2 A bug or feature request we're likely to work on new-language-feature false-negative labels Aug 2, 2024
@pq pq self-assigned this Aug 2, 2024
@github-actions github-actions bot added the set-recommended Affects a rule in the recommended Dart rule set label Aug 2, 2024
@lrhn
Copy link
Member

lrhn commented Aug 5, 2024

Agree on warning on __ etc.
The reason they are exempt no longer applies, you should just use _ everywhere.

@kallentu
Copy link
Member

kallentu commented Aug 8, 2024

+1 on warning on _.

I don't know how much we care, but I wonder if it would be a useful step to have a fix that turns __ into the wildcard _ because I'm sure that's what users are trying to do in most cases.

@bwilkerson
Copy link
Member

Yes, we should definitely have a fix. And we should care a lot because such a fix will help users migrate seamlessly to whatever version this language feature ships in.

@pq
Copy link
Member Author

pq commented Aug 27, 2024

See also #5048.

We'll want to pick how and where to nudge to use wildcards (and not do over do it!)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
false-negative new-language-feature P2 A bug or feature request we're likely to work on set-recommended Affects a rule in the recommended Dart rule set type-enhancement A request for a change that isn't a bug
Projects
None yet
Development

No branches or pull requests

4 participants