-
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 library_annotations
#177
Comments
+1 I'm all for this for being in the core set and eventually dropping support for dangling metadata. It seems the |
library_annotations
library_annotations
@natebosch @goderbauer @lrhn - can you review this proposal and give an initial thumbs-up / thumbs-down (with some rational if useful)? |
+1 for putting this lint in the core set. There isn't a good reason to leave this metadata ambiguous when it's very easy to add a |
+1 to putting this in core. |
+1. If there is an issue with the implementation, fix that. For an annotation with a |
@parlough - do you have examples of where its not triggering (or @pq - do you know of open issue w/ this lint)? |
Sorry, just seeing this now. Taking a look at the implementation, the lint is currently limited to annotations that have used |
As Erik pointed out in the first comment, if we don't know that the annotation is intended to be used for the library, then it's ambiguous. It might be intended to apply to the library, or it might be intended to apply to the first directive. The |
After discussion, we're in favor of adding this lint to the We think that tools which use specific directives ( |
Please add
library_annotations
to the recommended or core set of lints.It is currently possible to associate metadata with a library as such by putting it in front of all non-comment/non-whitespace elements in a library. However, this is ambiguous: The metadata might be intended for the library as such, but it might just as well be intended for the first import directive, or whatever comes first after the metadata. Some kinds of metadata could be applicable to both, and it could matter.
If we actively support the habit of putting library metadata on a
<libraryName>
directive (a plainlibrary;
would suffice) then there will be fewer and fewer cases where this ambiguity exists, and we may be able to retire this feature entirely (which means that there must be a<libraryName>
for metadata on the library, and the metadata that occurs at the top of the library without a<libraryName>
will unambiguously be associated with whatever comes next).Note that
dangling_library_doc_comments
is already in core, recommended, and flutter. Both lints have a quick fix.The text was updated successfully, but these errors were encountered: