linter-eslint
linter-eslint copied to clipboard
Better error messages for missing plugins
Issue Type
Feature Request
Issue Description
A common problem that linter-eslint users encounter is getting an error message like Cannot find module 'eslint-plugin-xxxxx'. This is usually because they haven't installed it in the same location as the eslint that linter-eslint is using.
We should catch these errors and give some intelligent instructions on how to fix the problem within the error message. We already know what kind of ESLint they're using, so we should be able to say something like:
Local installation:
The package
eslint-plugin-xxxxxis not installed alongside ESLint. Within your project directory, please runnpm install --save-dev eslint-plugin-xxxxx.
Global installation:
The package
eslint-plugin-xxxxxis not installed alongside your global ESLint. In a terminal, please runnpm install -g eslint-plugin-xxxxx.
Fallback ESLint:
You have configured your project to use
eslint-plugin-xxxxx, but have not installed ESLint in your project. The fallback version of ESLint installed withlinter-eslintdoes not support eslint plugins. Within your project directory, please runnpm install --save-dev eslint eslint-plugin-xxxxx.
I think something like this would prevent a large portion of the issue reports we get on this project.
I think this idea could certainly extend beyond plugins. This should just be "Better error messages".
The vast majority of runtime errors are due to improper setup on the user end. But in most of those cases we could automatically suggest a fix if we were actually parsing the Error messages.
Seems like the first step here is to start building a list of known errors, along with potential identifying features and causes of the problem. I'll start with your example:
Failure:
- Plugin not found
Identifying features:
- Throws
Cannot find moduleonrequire.- Module name matches on
/eslint-plugin-/.Possible causes:
- Plugin not installed.
- ESLint running from different location than installed plugin.