I am getting following error when Eslint plugin is running:
[Info - 07:43:14] ESLint library loaded from: c:\proj\node_modules\eslint\lib\api.js
[Error - 07:43:25] Failed to load plugin 'import' declared in '.eslintrc 禄 eslint-config-airbnb 禄 C:\proj\node_modules\eslint-config-airbnb-base\index.js 禄 C:\proj\node_modules\eslint-config-airbnb-base\rules\imports.js': Cannot find module 'eslint/lib/util/source-code'
Happened while validating C:\proj\src\Game\Game.jsx
"devDependencies": {
"eslint": "^6.0.1",
"eslint-config-airbnb": "^17.1.1",
"eslint-plugin-import": "^2.18.0",
"eslint-plugin-jsx-a11y": "^6.2.3",
"eslint-plugin-jest": "^22.7.2",
"eslint-plugin-react": "^7.14.2",
"node-sass": "^4.12.0"
},
$ yarn -v 1.13.0
$ npm -v 6.10.1
$ node v10.15.0
Project is done in react, and all packages are updated globally to most recent version.
Went to Eslint repo reported bug they said your packages are incompatible.
Reversed Eslint to 5.16.0 and also installed same globally and still same message it does not work.
.eslintrc
{
"parser": "babel-eslint",
"extends": [
"airbnb",
"eslint:recommended",
"plugin:react/recommended"
],
"parserOptions": {
"ecmaVersion": 9,
"sourceType": "module",
"ecmaFeatures": {
"esversion": 9,
"destructuring": true,
"generators": true,
"superInFunctions": true,
"experimentalObjectRestSpread": true,
"jsx": true
}
},
"plugins": [
"react"
],
"env": {
"browser": true,
"jasmine": true,
"jest": true
},
"rules": {
"no-console": 0,
"comma-dangle": [2, "always-multiline"],
"no-unused-vars": "error",
"react/require-default-props": 0,
"react/jsx-no-target-blank": [0, { "enforceDynamicLinks": "never" }],
"react/jsx-one-expression-per-line": 0,
"react/jsx-indent": ["warn", 4],
"react/jsx-indent-props": ["warn", 4],
"react/jsx-filename-extension": [1, { "extensions": [".js", ".jsx",".ts", ".tsx"] }],
"jsx-a11y/anchor-is-valid": 0
},
"settings": {
"import/resolver": {
"node": {
"paths": ["src"],
"extensions": [".js", ".jsx", ".ts", ".tsx"]
}
}
}
}
No eslint thing should be installed globally; if all of those are removed, and you鈥檙e on eslint 5 (since were not compatible with eslint 6 yet), what does npm ls say?
Also, how are you running eslint? It should only be ran via npx or an npm run-script.
Installed version of VS Code is latest, 1.36.1 and running with Eslint plugin, which I think requires global installation of eslint. Before I run NCU to update packages I had same setup and everything was working fine.
My question is which version of eslint-config-airbnb is compatible with eslint 15.6.0 ?
The plugin can be configured to use a local version of eslint; i'd recommend doing so.
The latest version of the airbnb config should work fine with the latest version of eslint v5.
After uninstalling eslint globally with npm uninstall -g eslint now it is looking into yarn's global modules:
[Error - 07:36:48] Error: Failed to load config "airbnb" to extend from.
Referenced from: C:\proj\.eslintrc
at configMissingError (C:\Users\zzz\AppData\Local\Yarn\Data\global\node_modules\eslint\lib\cli-engine\config-array-factory.js:233:9)
at ConfigArrayFactory._loadExtendedShareableConfig (C:\Users\zzz\AppData\Local\Yarn\Data\global\node_modules\eslint\lib\cli-engine\config-array-factory.js:708:23)
at ConfigArrayFactory._loadExtends (C:\Users\zzz\AppData\Local\Yarn\Data\global\node_modules\eslint\lib\cli-engine\config-array-factory.js:613:25)
at ConfigArrayFactory._normalizeObjectConfigDataBody (C:\Users\zzz\AppData\Local\Yarn\Data\global\node_modules\eslint\lib\cli-engine\config-array-factory.js:545:25)
at _normalizeObjectConfigDataBody.next (<anonymous>)
at ConfigArrayFactory._normalizeObjectConfigData (C:\Users\zzz\AppData\Local\Yarn\Data\global\node_modules\eslint\lib\cli-engine\config-array-factory.js:491:20)
at _normalizeObjectConfigData.next (<anonymous>)
at createConfigArray (C:\Users\zzz\AppData\Local\Yarn\Data\global\node_modules\eslint\lib\cli-engine\config-array-factory.js:307:25)
at ConfigArrayFactory.loadInDirectory (C:\Users\zzz\AppData\Local\Yarn\Data\global\node_modules\eslint\lib\cli-engine\config-array-factory.js:400:16)
at CascadingConfigArrayFactory._loadConfigInAncestors (C:\Users\zzz\AppData\Local\Yarn\Data\global\node_modules\eslint\lib\cli-engine\cascading-config-array-factory.js:304:46)
The plugin can be configured to use a local version of eslint; i'd recommend doing so.
The latest version of the airbnb config should work fine with the latest version of eslint v5.
let me try to find how to do it, so fire it was working as it is.
Uninstalled yarn global remove eslint removed node_modules, ran yarn install, changed default Eslint plugin manager and it works now.
I had the same error:
Error: Failed to load config "standard" to extend from.
Referenced from: BaseConfig
at configMissingError (/usr/local/lib/node_modules/standardx/node_modules/eslint/lib/cli-engine/config-array-factory.js:233:9)
Problem was that in my case standard was not installed.
After I installed standard this error was gone.
The problem could be eslint compatibility issues between eslint and eslint-config-airbnb.
I downgraded to the latest eslint verson 5 through npm i eslint@^5 and it worked for me.
Hope it helps.
If that鈥檚 true it means you鈥檙e using an outdated eslint-config-airbnb.
Most helpful comment
Uninstalled
yarn global remove eslintremoved node_modules, ranyarn install, changed default Eslint plugin manager and it works now.