dart-lang / pub

The pub command line tool
https://dart.dev/tools/pub/cmd
BSD 3-Clause "New" or "Revised" License
1.04k stars 224 forks source link

Provide feedback on possible typos in pubspec #1161

Open DartBot opened 9 years ago

DartBot commented 9 years ago

Issue by alan-knight Originally opened as dart-lang/sdk#21287


I spent a bit of time wondering why my transformer wasn't working before realizing I'd written

transformer:

instead of

transformers:

in my pubspec. It would be nice if it did something besides silently ignore this.

nex3 commented 8 years ago

I suppose we could hard-code a list of typos we expect, although I'm not sure exactly what such a list would look like. Any broader heuristic seems too likely to have some false positives, especially since we'd like current pubs to be as compatible as possible with future pubspecs.

@alan-knight @rnystrom Do either of you have suggestions for a list of expected typos?

sigurdm commented 1 year ago

We have implemented this as a pre-publication validation:

* "dependencie" is not a key recognized by pub - did you mean "dependencies"?
Sorry, your package is missing some requirements and can't be published yet.
For more information, see: https://dart.dev/tools/pub/cmd/pub-lish.

@jonasfj should we consider spell-checking on pub get/upgrade/add/remove?

sigurdm commented 11 months ago

The pubspec.yaml is an open format on purpose, and we cannot really know what other packages put in there.

We can only do checks for keys that are similar to keys known by pub. I think that would be frustrating quickly if there was a false positive.

sigurdm commented 8 months ago

This could also be implemented as some kind of lint in the analyzer - in that case you could # ignore if you have an unknown key in your pubspec.

@pq do you think this would be a good solution?

pq commented 8 months ago

Totally. Implementing this as a lint or a warning in the analyzer seems like a good solution to me.