ecosystem icon indicating copy to clipboard operation
ecosystem copied to clipboard

Include Flutter-specific lints or add another superset

Open parlough opened this issue 1 year ago • 3 comments

I'd really like to standardize all of my dart-lang and flutter org contributions to use this as a single analysis package, however that's difficult as Flutter apps often like to base their analysis on package:flutter_lints, which includes some helpful Flutter-specific lints. This results in a mix not only between repositories, but sometimes within the same repository.

Primary options:

  1. Base package:dart_flutter_team_lints on package:flutter_lints.

    • I'm not the biggest fan, mostly because it includes the avoid_print lint, but that can always be disabled :)
    • Technically will enable more lints even for Dart packages, potentially reducing analysis server performance, but should fail early.
  2. Create a new superset of package:dart_flutter_team_lints, perhaps at lib/flutter_analysis_options.yaml that adds its own set of Flutter specific lints on top.

A few projects that could benefit:

parlough avatar Jan 16 '24 19:01 parlough

Hmm. For background:

package:dart_flutter_team_lints is based on package:lints/recommended.yaml. package:lints is the set of lints we recommend that dart users use. dart_flutter_team_lints is the delta on top of that that we ourselves would like to use, but that we don't feel we need to recommend generally.

package:flutter_lints are the flutter specific set of lints - on top of package:lints/recommended.yaml - that we feel all flutter projects should use.

I think you're looking for a lint set - based on package:lints/recommended.yaml - that combines the deltas from both package:dart_flutter_team_lints and package:flutter_lints.

I think it would be nice if we avoided adding a new package dependency here (on package:flutter_lints), so I think in-lining the content from flutter_lints would make sense.

Perhaps a new file in this package - package:dart_flutter_team_lints/flutter_lints.yaml? It could depend on package:dart_flutter_team_lints/analysis_options.yaml, and manually add all the current lints from the flutter_lints package.

devoncarew avatar Jan 22 '24 17:01 devoncarew

That sounds like your option 2, above.

devoncarew avatar Jan 22 '24 17:01 devoncarew

Thanks for adding more background details!

Perhaps a new file in this package - package:dart_flutter_team_lints/flutter_lints.yaml? It could depend on package:dart_flutter_team_lints/analysis_options.yaml, and manually add all the current lints from the flutter_lints package.

That sounds like a perfect solution to me, giving more flexibility and avoiding the extra dependency. I'd personally suggest not adding avoid_print but I can adapt :)

parlough avatar Jan 22 '24 17:01 parlough