-
Notifications
You must be signed in to change notification settings - Fork 23
consider adding strict_top_level_inference
#836
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
I am in favor of this to get rid of more (implicit) dynamics. |
Some details:
cc @srawlins to keep me honest for the above @natebosch, @lrhn, @chunhtai - can you review this lint? This was one we'd requested, so I'd guess mostly we'd be considering if there are any open issues to address, timing of landing it, which lint set, ... But feel free to do a general review. |
I like it. It's a way to avoid accidental The wildcard parameters should probably be exempt. Then 👍. |
yeah I am also onboard with this, dynamic can be dangerous in some cases. |
I am in favor of including this lint in the recommended set as it is currently implemented.
I initially leaned towards exempting wildcard parameters too, but I was convinced by you that it was better not to make them exempt 😄
|
Oh, but we also changed course on that and wildcards are exempt now? That's also fine and I'm happy to still include the lint as it is currently implemented 😄 |
Yes, the lint rule does have a quick fix. The lint rule shipped in Dart 3.7. |
After discussion we do want to add this to our lint sets, and into the We also do want a bit more user feedback on this one (anything unexpected in the implementation?), so will likely ask the community to try it out. |
I'm all for this inclusion! However:
Perhaps it should be in the recommended set for a cycle alongside an announcement of its eventual graduation to core? |
This is a good idea. However, we likely wouldn't ship the next stable version of this rule set until the April / May timeframe (we try not to ship new stable version of this package more frequently than every 6 months), so we have a bit of time to get some feedback. |
I see. Then I think a I could call out the dev release in the various package maintainers Discord channels and perhaps pub.dev could surface a note on the scoring page when the latest release of the |
We should consider adding a
strict_top_level_inference
lint, as described here: dart-lang/sdk#59562. Note that this lint does not yet exist.This lint would warn about every omitted return type, parameter type, and variable type of a top-level declaration or class-like-namespace-level declaration (static or instance member- or constructor declaration), which is not given a type by inference, and which therefore defaults to dynamic.
The text was updated successfully, but these errors were encountered: