googlearchive / pedantic

How to get the most value from Dart static analysis
https://pub.dev/packages/pedantic
BSD 3-Clause "New" or "Revised" License
324 stars 56 forks source link

sort_constructors_first shows improper suggestions in Flutter #26

Closed ThinkDigitalSoftware closed 5 years ago

ThinkDigitalSoftware commented 5 years ago
const ValueSlider(
      {Key key,
      @required this.onChanged,
      @required this.labels,
      @required this.values,
      @required this.type,
      this.status = AttendanceStatus.none})
      : super(key: key);

this is caught by the linter even though Flutter puts Key first by default.

a14n commented 5 years ago

I don't understand what you mean. sort_constructors_first ensures you sort constructor declarations before other members.

ThinkDigitalSoftware commented 5 years ago

@a14n Right. It catches correctly, however, I've read in certain linting rules that they have conditions when they're run and when they aren't. It wouldn't be proper for a warning to suggest that you move away from Google suggested practices

bwilkerson commented 5 years ago

We don't limit the lints supported by the linter to all be self-consistent. We won't enable inconsistent lints in the pedantic rule set, but don't guarantee that all of the supported lints will be consistent with these rules.

ThinkDigitalSoftware commented 5 years ago

OK, So it's probably best to disable the rule then you're saying?

bwilkerson commented 5 years ago

What's "best" depends on what your goal is. But if your goal is to follow all of the Flutter recommended rules and all the rules in pedantic, then recognize that those lists are controlled by two different groups and they don't always agree about matters of style. I suspect that in some cases you're going to have to decide for yourself which rules you want to follow and which to ignore.

ThinkDigitalSoftware commented 5 years ago

Makes sense. Thanks!