Closed
Description
no_leading_underscore_for_local_functions
Description
Do not name local functions with a leading underscore: their visibility is dictated by local scope. Similar to no_leading_underscore_for_local_variables
.
Details
no_leading_underscore_for_local_variables
does not trigger on local functions. Rather than treat that as a false negative, which is hard to land, we can just create a new rule.
I often catch this in readability reviews.
Kind
Does this enforce style advice? Guard against errors? Other?
Style, I suppose. Meets with Effective Dart recommendations.
Good Examples
void foo10() {
void foo11() {}
}
Bad Examples
void foo10() {
void _foo11() {}
}
Discussion
Discussion checklist
- List any existing rules this proposal complements, overlaps or conflict with.
- List any relevant issues (reported here, the SDK Tracker, or elsewhere).
- If there's any prior art (e.g., in other linters), please add references here.
- If this proposal corresponds to Effective Dart or Flutter Style Guide advice, please call it out. (If there isn’t any corresponding advice, should there be?)
- If this proposal is motivated by real-world examples, please provide as many details as you can. Demonstrating potential impact is especially valuable.