Skip to content
This repository has been archived by the owner on Aug 7, 2023. It is now read-only.

Better error messages for missing plugins #883

Open
IanVS opened this issue Apr 14, 2017 · 1 comment
Open

Better error messages for missing plugins #883

IanVS opened this issue Apr 14, 2017 · 1 comment

Comments

@IanVS
Copy link
Member

IanVS commented Apr 14, 2017

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-xxxxx is not installed alongside ESLint. Within your project directory, please run npm install --save-dev eslint-plugin-xxxxx.

Global installation:

The package eslint-plugin-xxxxx is not installed alongside your global ESLint. In a terminal, please run npm 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 with linter-eslint does not support eslint plugins. Within your project directory, please run npm 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.

@skylize
Copy link
Contributor

skylize commented Feb 25, 2018

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 module on require.
  • Module name matches on /eslint-plugin-/.

Possible causes:

  • Plugin not installed.
  • ESLint running from different location than installed plugin.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants