dart-lang / linter

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

[macros] support for `unnecessary_getters_setters` #4935

Open pq opened 2 months ago

pq commented 2 months ago

Like support for use_enums, etc. this will require us to have more than only member-level access to augmentation contributed accessors (see e.g., isSimpleSetter).

Also, an open question:

Currently we report this lint on the accessor declaration. In a case where both accessors (and the wrapped field even) are declared in an augmentation, should we instead report on the class declaration?

For example:

class A { } // HERE?
augment class A {
  String? _x;

  String? get x => _x;
  set x(String? value) {
    _x = value;
  }
}