Skip to content
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

I'd love a "strict" version of flutter_lints #216

Open
csells opened this issue Nov 30, 2024 · 4 comments
Open

I'd love a "strict" version of flutter_lints #216

csells opened this issue Nov 30, 2024 · 4 comments

Comments

@csells
Copy link

csells commented Nov 30, 2024

The flutter_lints package is a great way to balance recommended style vs. ease-of-use for new Dart and Flutter devs. But for advanced Flutter devs or devs build Dart or Flutter packages, I want a "strict" mode that cranks down the screws and helps me to write much better code.

Personally, I use the all_lint_rules_community package for this and it feels like unlocking the other half of the Dart compiler. It's kept up to date: as the Dash team adds new lints, they're automatically added and I automatically get better code. Frankly, it's amazing.

There are so many things that flutter_lints doesn't flag, like dynamic type usage, the lack of docs on public APIs for packages, unawaited async calls, etc. I wouldn't dream of building an without these lints in place, let alone a package that I expect other folks to use.

It makes sense that flutter_lints is not for that -- but there should be some curated set of lints for folks that really want to use Dart and Flutter like the pros do. Perhaps start with the Flutter team's analysis_options.yaml and build from there (and don't forget these)?

Thoughts? @mit-mit @devoncarew @pq

@devoncarew
Copy link
Member

devoncarew commented Dec 3, 2024

We've avoided doing that in the past (and in fact a previous proposal for this caused us to update our lint set descriptions here: https://github.com/dart-lang/lints?tab=readme-ov-file#lint-sets).

The subjectivity increases quite a bit with strict lint sets, and something we ship often gets interpreted as the canonical version of something. Our current strategy is to publicize community lint sets (ala https://pub.dev/packages?q=topic%3Alints) - things built on top of the core, recommended, and flutter sets.

We're happy to hear other thoughts though - either re-deciding against shipping strict sets, or, better publicizing 1-3 of the more highly used, well-thought out sets.

@csells
Copy link
Author

csells commented Dec 4, 2024

Well that’s great and I use all_lint_rules_community myself (as I mentioned) except that @mit-mit doesn’t allow any submissions to the flutter org on GitHub to use anything that isn’t created by the Flutter team itself. So now flutter_lints is the required set and it’s inadequate (imo) for production quality code.

@devoncarew
Copy link
Member

Personally, I use the all_lint_rules_community package for this ...

Hmm, generally, turning all the lints on is somewhat concerning. Several of the lints conflict - have opposite recommendations. Some are less well thought out, have less-than-complete implementations, or haven't aged well with the language.

So now flutter_lints is the required set and it’s inadequate (imo) for production quality code.

I am curious - which additional lints do you get value out of? Where do you see the gap between package:core+recommended+flutter_lints and production quality code?

@csells
Copy link
Author

csells commented Dec 4, 2024

Personally, I use the all_lint_rules_community package for this ...

Hmm, generally, turning all the lints on is somewhat concerning. Several of the lints conflict - have opposite recommendations. Some are less well thought out, have less-than-complete implementations, or haven't aged well with the language.

Of course. I turn them all on and then eliminate the conflicts via a custom analysis_options.yaml. Ideally this would be part of a flutter_lints_strict package out of the box.

So now flutter_lints is the required set and it’s inadequate (imo) for production quality code.

I am curious - which additional lints do you get value out of? Where do you see the gap between package:core+recommended+flutter_lints and production quality code?

“There are so many things that flutter_lints doesn't flag, like dynamic type usage, the lack of docs on public APIs for packages, unawaited async calls, etc.”

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Triage backlog
Development

No branches or pull requests

2 participants