-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Lints to be considered for score.yaml or recommend.yaml from Flutter #58349
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Bob, OK that I assign this to you? |
Thanks Michael! I'm in favour of adding lints that only fire on Flutter code to the general set, it's simpler. Without being familiar with Flutter I can't evaluate the lints themselves; We've generally followed the idea that lints should have no false positives to make the recommended list. So if any of those have the expectation that users should sometimes add an Re: the general list, we decided against all those in google3, more details:
There is a need for The
Finally:
|
True, |
Closing this since the lint packages with most of these lints have been released. |
The following lints are no-ops for non-Flutter code and adding them to the general lint set shouldn't cause any harm. They help developers craft clean UI code without unnecessary cruft while honoring the widget lifecycle contract and encourage good widget design practices.
avoid_unnecessary_containers
avoid_web_libraries_in_flutter
no_logic_in_create_state
sized_box_for_whitespace
use_full_hex_values_for_flutter_colors
use_key_in_widget_constructors
The following lints also affect non-Flutter code, but I hope they can be added to the general lint set as well to have alignment between regular Dart and Flutter code (if not, they should go into a Flutter-specific lint set). Encouraging the use of
const
Widgets is beneficial for performance.prefer_const_constructors
prefer_const_constructors_in_immutables
prefer_const_declarations
prefer_const_literals_to_create_immutables
avoid_type_to_string
(currently broken: Rule avoid_type_to_string not working #58377) - avoids hard to debug differences between debug and release modeno_runtimeType_toString
(subset ofavoid_type_to_string
? If yes, not needed.) - discourages performance pitfallprefer_if_elements_to_conditional_expressions
- cleaner code when generating children listsThe following lint is not appropriate for non-Flutter apps and should go into a Flutter-specific lint set:
avoid_print
- avoids polluting production logs@mit-mit and/or @munificent to figure out if the first two lists in this bug are OK to add to the general lint set.
/cc @Hixie @pq @devoncarew
The text was updated successfully, but these errors were encountered: