-
Notifications
You must be signed in to change notification settings - Fork 30
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
Add unnecessary_library_directive
#178
Comments
@natebosch @goderbauer @lrhn - can you weigh in here (even if you have already on #172)? cc @parlough |
I am in favor of adding this lint. My suggestion would be to add it to recommended since IMO it does not "help identify critical issues that are likely to lead to problems when running or consuming Dart code", which has been our bar for core lints. |
Link: https://dart.dev/tools/linter-rules/unnecessary_library_directive It's not that bad. It's not great. I'm fine with putting it in google internal lints, or Dart/Flutter team lints, where people care a lot about conformance to a single style. I don't want to bother our users with this, because it really doesn't matter. Recommended lints should have significant value. We are bothering our users about something, so that better be meaningful. It better make their code better in at least some way. This is just noise. Nobody's day gets better because we make them remove A library author can always remove the |
I think removing noise is enough justification for recommended. I'm sold on keeping it out of core. This is another one which might be best as a transient lint. In the absence of that capability I think users of the recommended set would benefit enough to make it worth including. I still see packages come in to google3 with unnecessary library names that look to me like a habit of copy/paste. If we recommend a lint that requires |
To be precise, I was considering the lint to be the noise, not the Warnings about things that don't actually matter is worse than having things that don't actually matter. I expect the cost on someone seeing a There is just no value at a normal user, or future readers of their same code, from telling them to remove a I don't know what a transient lint is, but if it's something that basically says "FYI, the thing you just changed can be improved as ....", and then goes away if the author doesn't do anything about it (like they save the file two more times without editing near the code, or commits it to git), then that would be fine. A persistent nag about something unnecessary (and possibly deliberate, if planning to come back and write comments) isn't fine, IMO. |
After discussion, we're not going to add this to a package:lints lint set. We're not currently willing to lint if there's just a bare However, we do think its worth linting if there's an unnecessary library name (as per effective dart). See the proposal for that here: dart-lang/linter#3882. |
Creating this issue as a companion to #172 (see comments #172 (comment), #172 (comment)).
This lint - along with a few others - would help with general library statement hygiene.
The text was updated successfully, but these errors were encountered: