lints icon indicating copy to clipboard operation
lints copied to clipboard

enable `strict-raw-types`

Open goderbauer opened this issue 2 years ago • 2 comments

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.

goderbauer avatar Sep 19 '23 21:09 goderbauer

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.

lrhn avatar Sep 20 '23 07:09 lrhn

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

devoncarew avatar Oct 24 '23 18:10 devoncarew