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

New rule: consider_making_a_member_private (if its not used outside) #93

Open
danylo-safonov-solid opened this issue Dec 15, 2023 · 2 comments
Assignees

Comments

@danylo-safonov-solid
Copy link
Contributor

This'll help with dead_code

BAD:

class X {
  // only used internally 
  void x() {
    ...
  }
}

GOOD:

class X {
  // only used internally 
  void _x() {
    ...
  }
}
@solid-vovabeloded solid-vovabeloded self-assigned this Apr 16, 2024
@solid-vovabeloded solid-vovabeloded changed the title New rule: consider_making_a_field_private (if its not used outside) New rule: consider_making_a_member_private (if its not used outside) Apr 17, 2024
@kvenn
Copy link

kvenn commented Apr 30, 2024

I'm very excited for this one! I could see it being very valuable for any class members. For some reason, Dart doesn't recognize that a member is unused unless it's private. So this would be a double whammy if it enforced all members that could be public were public.

@gbassisp
Copy link

Should this only be applied to class members? What about top-level ones and class definitions themselves? I think it would be worth having it to all definitions, because top-level functions that are only used internally also add noise to code completion. As a bonus, it could help us identify unused definitions (something that I used to do with dart code metrics).

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

When branches are created from issues, their pull requests are automatically linked.

5 participants