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

Lint rule to disable implicit dynamic values #375

Merged
merged 11 commits into from
Apr 27, 2022
Merged

Conversation

ikurek
Copy link
Contributor

@ikurek ikurek commented Apr 21, 2022

This should solve #84. The issue was raised a while ago, and the implicit dynamic option was already deprecated, but it was replaced with strict type checks. The changes here are mostly cosmetic, but overall they remove ~200 lint warnings in the codebase and remove implicit dynamic typing, which is discouraged in Dart for a while. The changes include:

  • Enabled strict-casts and strict-inference lint rules, as a replacement for implicit-dynamic. Also, removed avoid_annotating_with_dynamic and avoid_types_on_closure_parameters since they conflict with strict-inference
  • Added declared types to all methods that used implicit dynamic values
  • Widened the scope of dynamic variables where it was possible. There were some cases where the variable/method did not need dynamic at all, as it's type was declared during asignement
  • Removed unnecessary cast methods like transformState or transformStateChange. With declared variable types, there's no need to use methods that cast variables to their type in cases like this, a simple as cast is enough, and reduces a lot of boilerplate code
  • Added void return types for Future methods that do not return any value. Previously these methods returned dynamic which was always a void type

@ikurek ikurek added the code-quality Affects the developer experience when working in our codebase. label Apr 21, 2022
@ikurek ikurek self-assigned this Apr 21, 2022
@ikurek ikurek marked this pull request as draft April 22, 2022 08:17
@ikurek ikurek force-pushed the fix/implicit-dynamic branch from d7e55dd to 313122f Compare April 22, 2022 15:07
@ikurek ikurek marked this pull request as ready for review April 22, 2022 15:08
@github-actions github-actions bot temporarily deployed to staging/pull/375/dartdoc April 22, 2022 15:10 Inactive
@github-actions github-actions bot temporarily deployed to staging/pull/375/dartdoc April 25, 2022 10:55 Inactive
@ikurek ikurek force-pushed the fix/implicit-dynamic branch from 5d9edca to 14dc494 Compare April 25, 2022 11:30
@github-actions github-actions bot temporarily deployed to staging/pull/375/dartdoc April 25, 2022 11:33 Inactive
Copy link

@KacperKluka KacperKluka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good (after a skim-read) 👍

@ikurek ikurek merged commit 5e96dff into main Apr 27, 2022
@ikurek ikurek deleted the fix/implicit-dynamic branch April 27, 2022 08:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
code-quality Affects the developer experience when working in our codebase.
Development

Successfully merging this pull request may close these issues.

3 participants