Skip to content

fix: Clashing rules: omit_obvious_property_types and type_annotate_public_apis #145

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

Open
frankvollebregt opened this issue May 15, 2025 · 1 comment
Labels
bug Something isn't working as expected

Comments

@frankvollebregt
Copy link

Description

Since the 8.0.0 release candidate 1, the omit_obvious_property_types rule is part of the analysis options. While I like it, and it seems pretty nice, I unfortunately encountered an incompatibility between it and the type_annotate_public_apis rule.

dart-lang/sdk#60642

Until there is some resolution there, I suppose it might be easiest to disable this rule again? (or if there are any other ideas to make it work, that's even better)

Steps To Reproduce

I have a private class (name preceded with _), and in this class I'm declaring a variable.

class _Developer {
  bool likesDart = true;
}

This results in ("bool" is highlighted)

The type annotation isn't needed because it is obvious. (omit_obvious_property_types)

When I apply the autofix it becomes

class _Developer {
  var likesDart = true;
}

But now, this results in ("likesDart" is highlighted)

Missing type annotation on a public API. (type_annotate_public_apis)

And I go back and forth between these two.

Expected Behavior

I expect the rules defined by this (very good!) package not to conflict amongst each other

Additional Context

Here's the issue I originally opened (which was closed because it duplicates the one I linked above): dart-lang/sdk#60734

@frankvollebregt frankvollebregt added the bug Something isn't working as expected label May 15, 2025
@wolfenrain
Copy link
Member

This one indeed seem to be indeed incorrectly giving a warning about the type annotation. I am going to remove it from the v8 lint rules and we can keep this issue open to track if/when this problem gets solved upstream.

Thanks for bringing it to our attention!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working as expected
Projects
None yet
Development

No branches or pull requests

2 participants