dart-lang / lints

Official Dart lint rules; the core and recommended set of lints suggested by the Dart team.
https://pub.dev/packages/lints
BSD 3-Clause "New" or "Revised" License
117 stars 31 forks source link

enable `strict-raw-types` #151

Open goderbauer opened 1 year ago

goderbauer commented 1 year ago

Similar to https://github.com/dart-lang/lints/issues/125, this is a proposal to enable strict-raw-types in the recommended lint set. We'd have to believe this is the way we want to recommend that people write Dart code.

See also https://github.com/dart-lang/lints/issues/149.

lrhn commented 1 year ago

I'd suggest enabling both or neither. Giving users protection against Foo() inferring Foo<dynamic>, but not against List<Foo> l; inferring List<Foo<dynamic>>, or vice versa, can give a false sense of security.

And I'd suggest "both".

It's a long-standing wish of mine to change the language to not infer or insert dynamic as a default, so you, or someone else, have to explicitly write at least one dynamic in order to get it. (And at the same time, using hacky "library versioning", I'd make the platform libraries use Object? everywhere they expose dynamic today.)

These "lints" being enabled will make such a change more viable, since code satisfying them will not need migrating for the inference/insertion change.

devoncarew commented 11 months ago

From a discussion with @leafpetersen, he saw challenges with this analysis mode (as it's implemented today?).