When you run `eslint src/`, that’s running a globally-installed version of 
ESLint, probably installed via `npm install --global eslint`, whereas VSCode is 
using your locally-installed version of ESLint. Try running 
`node_modules/.bin/eslint src/` in your project directory to run the local 
version and see if you get the same error VSCode is reporting. If that’s the 
case, it appears you have some globally-installed dependencies like the Airbnb 
plugin and `eslint-plugin-import` that aren’t available locally and will need 
to be installed.

Having both globally- and locally-installed versions of ESLint can cause 
inconsistencies like this when it’s not clear which version is running. It’s 
often easier for each project to have its own locally-installed copy of ESLint, 
so if you don’t have a specific need for a global ESLint install, you could 
`npm uninstall --global eslint` so that you know you’re always using each 
project’s local version.
On May 2, 2020, 6:40 PM -0400, Seif Eddine Slimene <[email protected]>, 
wrote:
> Hello, i'm using vscode and already setup  a small project with express, i 
> already installed eslint dependency locally using
>
> npm install --save-dev eslint
>
> It runs in terminal when doing
>
> eslint src/
>
> but in vscode error are not highlighted or shown!
>
> my configuration file .eslintrc.js
> module.exports = {
>   env: {
>     browser: true,
>     commonjs: true,
>     es6: true,
>   },
>   extends: ["airbnb-base"],
>   globals: {
>     Atomics: "readonly",
>     SharedArrayBuffer: "readonly",
>   },
>   parserOptions: {
>     ecmaVersion: 2018,
>   },
>   rules: {},
> };
>
> error output in vscode
> [Error - 11:22:53 PM]
> Failed to load plugin 'import' declared in 'server\.eslintrc.js » 
> eslint-config-airbnb-base » D:\Documents 
> Box\Personal\Projects\travel_log\server\node_modules\eslint-config-airbnb-base\rules\imports.js':
>  Cannot find module 'eslint-plugin-import'
> Require stack:
> - D:\Documents Box\Personal\Projects\travel_log\__placeholder__.js
> Happened while validating D:\Documents 
> Box\Personal\Projects\travel_log\server\src\index.js
> This can happen for a couple of reasons:
> 1. The plugin name is spelled incorrectly in an ESLint configuration file 
> (e.g. .eslintrc).
> 2. If ESLint is installed globally, then make sure 'eslint-plugin-import' is 
> installed globally as well.
> 3. If ESLint is installed locally, then 'eslint-plugin-import' isn't 
> installed correctly.
>
>
> Consider running eslint --debug D:\Documents 
> Box\Personal\Projects\travel_log\server\src\index.js from a terminal to 
> obtain a trace about the configuration files used.
>
> What is the solution?
> --
> You received this message because you are subscribed to the Google Groups 
> "ESLint" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected].
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/eslint/3125e515-2d5d-47d6-86cc-703a650d0c28%40googlegroups.com.

-- 
You received this message because you are subscribed to the Google Groups 
"ESLint" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/eslint/54d9738d-870c-44f0-b51f-0065d20b5789%40Spark.

Reply via email to