Small idea for global vs local installation issues #9014
Labels
archived due to age
This issue has been archived; please open a new issue for any further discussion
cli
Relates to ESLint's command-line interface
enhancement
This change enhances an existing feature of ESLint
evaluating
The team will evaluate this issue to decide whether it meets the criteria for inclusion
I had a simple idea to try to help alleviate global vs local installation issues-- not a silver bullet but one that might be useful for the most common cases.
Basically, when we're printing the pretty error template due to inability to find plugin, we would check if the running process is under
$(npm bin)
; if so, add a note that this is a global installation of ESLint being run. Otherwise, leave the message as is (in particular don't try to guess if this is a local installation).This benefits what I believe to be the most common case for global vs local installation problems, which is that the developer actually does want to have locally configured dependencies and means to install ESLint and the plugin locally. For that use case, the issue is one of two things, each occurring about 50/50: The developer is running global ESLint without meaning to, or the developer didn't actually install the plugin locally.
This change would help the first of those issues: we would alert the user (when we know for sure) that they are running global ESLint, and then their question to us become "How do I make sure I'm running local ESLint?" and go from there. (Or for users who don't know whether to run global or local ESLint, it would at least save us the need to ask how ESLint is being invoked.)
Again, this isn't a silver bullet and is only meant to try to help with a fairly common subtype of the global vs local install issue. It may be rendered redundant if we decide to allow global ESLint to delegate to local ESLint (vaguely like grunt and grunt-cli). And I certainly don't want to do this if we think this would actually add more confusion than it would remove. Just looking for discussion at this point.
The text was updated successfully, but these errors were encountered: