dart-lang / linter

Linter for Dart.
https://dart.dev/tools/linter-rules
BSD 3-Clause "New" or "Revised" License
631 stars 170 forks source link

`unnecessary_getters_setters` Effective Dart vs. lint details #5032

Open MaryaBelanger opened 1 year ago

MaryaBelanger commented 1 year ago

In Effective Dart, the guidance is DON’T wrap a field in a getter and setter unnecessarily..

But the corresponding lint's details say AVOID wrapping fields in getters and setters just to be "safe"

The rest of the description is identical. I just have a very minor concern that since the titles don't match, and users can follow a link in the lint description to Effective Dart, it might be confusing. Should we change the title in Effective Dart or in the Lint? I.e. "DON'T" or "AVOID"?

@munificent @bwilkerson

bwilkerson commented 1 year ago

My guess is that the lint used to match Effective Dart, but that the latter changed at some point. We appear to have missed the need to update the lint docs. That's what should be changed.

And to an earlier point you made, the lint docs should be minimal and mostly just point the user to the Effective Dart discussion (unless the lint differs in some way, such as only covering a subset of the Effective Dart advice).

munificent commented 1 year ago

I think Brian is right. At least, the wording that the linter uses sounds like my writing style, so there's a good chance that I came up with that in an old version of Effective Dart, which the linter copied, and the Effective Dart was later edited. :)

I like "DON’T wrap a field in a getter and setter unnecessarily" more.

atsansone commented 2 months ago

@bwilkerson : Based on @munificent 's response, this seems like it's now a linter issue. Can you transfer this issue to that repo? If not, who can I ask to enable me to do so? @devoncarew maybe?

devoncarew commented 2 months ago

@atsansone - you might have permissions yourself? Do you see a 'transfer issue' link as an option for this issue. For now, linter issues are tracked at dart-lang/linter (though all the source has moved into the sdk).

You could also try sending a PR for this change to: https://github.com/dart-lang/sdk/blob/main/pkg/linter/lib/src/rules/unnecessary_getters_setters.dart.