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

avoid_late_keyword - ignored_types not working as expected. #157

Open
arthurbcd opened this issue Apr 14, 2024 · 0 comments
Open

avoid_late_keyword - ignored_types not working as expected. #157

arthurbcd opened this issue Apr 14, 2024 · 0 comments
Assignees

Comments

@arthurbcd
Copy link

arthurbcd commented Apr 14, 2024

I'm currently using:

    - avoid_late_keyword:
      allow_initialized: true
      ignored_types:
        - AnimationController
        - StreamSubscription
        - Timer

Timer is working fine and AnimationController too, but StreamSubscription is not working and here is why:

checkedTypes: {StreamSubscription<dynamic>, Object}

The code is trying to compare StreamSubscription with StreamSubscription<dynamic> strings, so It will always fail.

I suggest creating a pattern to ignore the subtype of the node type, effectively removing the <dynamic> part. Note that in some cases, the node type may have more than one subtype, but I believe a pattern for removing everything after < should be enough.

This is a really good package, by the way. Great job.

@yurii-prykhodko-solid yurii-prykhodko-solid self-assigned this Apr 15, 2024
Yarl745 added a commit to Yarl745/solid_lints that referenced this issue Apr 15, 2024
Yarl745 added a commit to Yarl745/solid_lints that referenced this issue Apr 15, 2024
…node type (support for nested types for dynamic, Object?, Object) solid-software#157
illia-romanenko pushed a commit that referenced this issue Apr 18, 2024
…node type (#157) (#158)

* Improved `avoid_late_keyword` to support ignoring the subtype of the node type (#157)

* Improved `avoid_late_keyword` to support matching the subtype of the node type (support for nested types for dynamic, Object?, Object) #157

* Update lint_test/avoid_late_keyword_test.dart

Co-authored-by: Yurii Prykhodko <[email protected]>

* Update lib/src/utils/types_utils.dart

Co-authored-by: Yurii Prykhodko <[email protected]>

* Refactored code for `ignored_types` type matching using AST analyzer (#157)

* Divided code into logical parts using the NamedType nodes tree to analyze and compare type names

* Refactored code and reorganized files

---------

Co-authored-by: Yarl745 <[email protected]>
Co-authored-by: Yurii Prykhodko <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants