sdk icon indicating copy to clipboard operation
sdk copied to clipboard

Validate the conditions of config specific imports in analyzer

Open natebosch opened this issue 7 years ago • 7 comments

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.

natebosch avatar Aug 30 '18 18:08 natebosch

Do we have a list of what "*" is allowed to be, or should we just accept anything for forward compatibility?

bwilkerson avatar Aug 30 '18 18:08 bwilkerson

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.

natebosch avatar Aug 30 '18 18:08 natebosch

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.

bwilkerson avatar Aug 30 '18 19:08 bwilkerson

@jakemac53 any opinion?

natebosch avatar Aug 30 '18 19:08 natebosch

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.

jakemac53 avatar Aug 30 '18 20:08 jakemac53

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.

bwilkerson avatar Aug 30 '18 20:08 bwilkerson

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.

natebosch avatar Aug 30 '18 20:08 natebosch