-
Notifications
You must be signed in to change notification settings - Fork 1.7k
proposal: library_with_comments_or_annotations
#58871
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
Comments
The annotation bit might be tricky; it might be intentional. But the doc comment case I think is unambiguous. |
Perhaps if we only complain about annotations on the first directive (like an import), our false negatives will be extremely minimal. And then not worry about annotations on the first member (like |
Or (likely more difficult) lint when they are "floating" – with newlines below them. |
We could also flag for annotations whose target kind is 'library' because that's an unambiguous signal. |
FYI: the associated language feature has LANDED for Dart 1.19! |
prefer_library_with_comments_or_annotations
library_with_comments_or_annotations
Dropped |
Sorry I missed this request. These are each complete now, with the |
library_with_comments_or_annotations
Description
Doc comments and/or annotations that are meant to be "scoped" to a library should be attached to a
library;
directive and not just "floating".Details
We have a bunch of silly rules trying to deal with doc comments and annotations "floating" that are meant to be scoped to a library (and not the first import/export directive).
Preferring these to be connected to a library directive would make their purpose clear and likely help formatting and code analysis tools.
Kind
style
Good Examples
Bad Examples
Discussion
This is the ONE case where https://github.com/dart-lang/linter/issues/3686 (prefer avoiding library directives) would not apply!
Adding no-name libraries proposal: dart-lang/language#1073
This could likely be added to Effective Dart, I think.
Discussion checklist
The text was updated successfully, but these errors were encountered: