solid_lints icon indicating copy to clipboard operation
solid_lints copied to clipboard

Review new lint rules from linter 3.0

Open illia-romanenko opened this issue 2 years ago • 3 comments

Review new lint rules from linter 3.0 and enable if needed in solid_lints https://github.com/dart-lang/lints/blob/main/CHANGELOG.md#300

illia-romanenko avatar Nov 17 '23 00:11 illia-romanenko

  • collection_methods_unrelated_type
    • Unifies and replaces a couple lints that are now deprecated (list_remove_unrelated_type, iterable_contains_unrelated_type). We use both deprecated ones.
  • dangling_library_doc_comments
    • Pretty self-explanatory. Worth adding.
  • implicit_call_tearoffs
    • IMO very minor improvement. But Future language versions may remove the implicit call tear off.
  • secure_pubspec_urls
    • Good for the majority of cases, but some orgs rely on SSH dependencies for their apps.
  • type_literal_in_constant_pattern
    • Prevents mistyped conditionals not working. Useful, but will have to ignore when we actually need to check for bare type. That's probably gonna be rare.
    void main() {
      String f(Object? x) {
        return switch (x) {
          int => 'int type', // this will be linted with type_literal_in_constant_pattern enabled
          int _ => 'concrete int',
          _ => 'other',
        };
      }
    
      print(f(int)); // int type
      print(f(1)); // concrete int
      print(f('x')); // other
    }
    
    
  • unnecessary_to_list_in_spreads
    • Useful lint, potentially impactful on performance.
  • use_super_parameters
  • A bit of boilerplace reduction, would be niсe to have.

yurii-prykhodko-solid avatar Nov 17 '23 21:11 yurii-prykhodko-solid

FYI these are already in our analysis_options.yaml (click to jump to code)

danylo-safonov-solid avatar Nov 27 '23 16:11 danylo-safonov-solid