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 30 forks source link

forced var #162

Closed bsz0206 closed 11 months ago

bsz0206 commented 11 months ago

Describe the rule you'd like to see added and to what rule set When 'var' can be used (not as Object/dynamic), it should not allow explicit type declaration:

Example: Bad: String a= ""; Map m=<String, dynamic>{};

goog: var a=""; var m=<String, dynamic>{};

parlough commented 11 months ago

Hi! Does the omit_local_variable_types lint accomplish what you are looking for?

parlough commented 11 months ago

Oh sorry, I didn't realize you opened this issue in package:lints, not the linter repository itself.

I imagine that package:lints will not include this lint by default, as some users prefer to always explicitly type variables. You can always enable extra lints yourself though in your project's analysis_options.yaml file or choose a different prebuilt set which enables it by default.

bsz0206 commented 11 months ago

I think I mentioned it in a wrong thread. I didn't know about omit_local_variable_types

bsz0206 commented 11 months ago

I think I mentioned it in a wrong thread. I didn't know about omit_local_variable_types