sdk
sdk copied to clipboard
Validate the conditions of config specific imports in analyzer
All tools restrict the conditions to dart.library.*, but analyzer ignores them completely. It would be nice to get a hint when there is a typo.
Do we have a list of what "*" is allowed to be, or should we just accept anything for forward compatibility?
I think it would be fine to accept anything in place of the * for forward compatibility. Build tools do have a hardcoded list but we don't necessarily need analyzer to be perfectly restrictive against the build tools.
I guess it depends on how often the list of valid values will change. If analyzer knows the list then it can potentially do more to suggest valid ways to fix the error.
@jakemac53 any opinion?
If we had a fixed list in the analyzer, it would help guard against typos as well as potentially enabling autocomplete which would be nice. I don't think its a must have though.
Another possibility is to publish a list of valid names somewhere in the SDK (similar to libraries.dart) and analyzer could read from it. Then it's easy to expand the list in the future without needing to coordinate with analyzer.
Another possibility is to publish a list of valid names somewhere in the SDK
I don't think that's possible since a derived SDK can add new ones and code should be compatible across both. The "core" SDK analyzer code will need to hardcode "flutter" as a valid library even though it doesn't exist in that SDK.