javascript: ESLint: Failed to load config "airbnb" to extend from.

expect: Eslint add single quote and add white spaces

import React from 'react';

import {Switch} from "react-router-dom";

import Route from "./Route";

error: ESLint: Failed to load config “airbnb” to extend from. Referenced from: image

Already did:

  • Deleted node_modules
  • run yarn eslint --init
  • reloaded vs code

Directory: image

ESLint output channel

[Error - 1:12:45 PM] ESLint stack trace:
[Error - 1:12:45 PM] Error: Failed to load config "airbnb" to extend from.
Referenced from: /home/ruan/Documents/Projects/hackingHelp/.eslintrc.js
    at configMissingError (/home/ruan/Documents/Projects/hackingHelp/FRONT-END-Hacking.rio/node_modules/eslint/lib/cli-engine/config-array-factory.js:265:9)
    at ConfigArrayFactory._loadExtendedShareableConfig (/home/ruan/Documents/Projects/hackingHelp/FRONT-END-Hacking.rio/node_modules/eslint/lib/cli-engine/config-array-factory.js:826:23)
    at ConfigArrayFactory._loadExtends (/home/ruan/Documents/Projects/hackingHelp/FRONT-END-Hacking.rio/node_modules/eslint/lib/cli-engine/config-array-factory.js:731:25)
    at ConfigArrayFactory._normalizeObjectConfigDataBody (/home/ruan/Documents/Projects/hackingHelp/FRONT-END-Hacking.rio/node_modules/eslint/lib/cli-engine/config-array-factory.js:660:25)
    at _normalizeObjectConfigDataBody.next (<anonymous>)
    at ConfigArrayFactory._normalizeObjectConfigData (/home/ruan/Documents/Projects/hackingHelp/FRONT-END-Hacking.rio/node_modules/eslint/lib/cli-engine/config-array-factory.js:596:20)
    at _normalizeObjectConfigData.next (<anonymous>)
    at createConfigArray (/home/ruan/Documents/Projects/hackingHelp/FRONT-END-Hacking.rio/node_modules/eslint/lib/cli-engine/config-array-factory.js:340:25)
    at ConfigArrayFactory.loadInDirectory (/home/ruan/Documents/Projects/hackingHelp/FRONT-END-Hacking.rio/node_modules/eslint/lib/cli-engine/config-array-factory.js:433:16)
    at CascadingConfigArrayFactory._loadConfigInAncestors (/home/ruan/Documents/Projects/hackingHelp/FRONT-END-Hacking.rio/node_modules/eslint/lib/cli-engine/cascading-config-array-factory.js:328:46)

ESLint is working, if I delete last line in file, it add again. When I’d setup in the early of project, was working fine. Stop working after a git pull, eslint config file was in .gitignore.

It already happened to me one time and I was not able to resolve. I’m new with it and sorry if it is a simple question.

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 17

Commits related to this issue

Most upvoted comments

I had similar issue on a react app

Failed to load config “airbnb” to extend from. Referenced from: /usr/src/.eslintrc and this fixed it!

npm install -g install-peerdeps install-peerdeps --dev eslint-config-airbnb

@ljharb after npm ls it shows a list of missing packages required by eslint-config-airbnb. Now I was able to solve the problem by installing them, thanks a lot!

For any future reference, acorrding to eslint-config-airbnb, I needed to run npm info "eslint-config-airbnb@latest" peerDependencies to view the correct versions of each package that eslint-config-airbnb needs. I compared that against my already installed packages via npm ls. So for me I needed to install one package eslint-plugin-react-hooks

@jghorton14 the package readme also tells you how to use npx install-peerdeps to automate that process.

The cause of my problem was, I forgot an “.eslintrc.js” file one directory up from my project folder. So it was using the wrong “.eslintrc.js” file.

@droderuan How are you running eslint? Make sure you have nothing globally installed (which is deprecated), and then use npx eslint or an npm run-script.

I had similar issue on a react app

Failed to load config “airbnb” to extend from. Referenced from: /usr/src/.eslintrc and this fixed it!

npm install -g install-peerdeps install-peerdeps --dev eslint-config-airbnb

This worked for me 🎉

Initially installed npm i eslint eslint-config-airbnb eslint-plugin-import eslint-plugin-jsx-a11y eslint-plugin-react eslint-plugin-react-hooks@^4.3.0 -g, but was getting the same issue as OP, so I did npm install -g install-peerdeps install-peerdeps --dev eslint-config-airbnb plus the below configuration.

Workspace configuration set like this (for Mac):

{  
  "eslint.nodePath": "/Users/<USERNAME>/.nvm/versions/node/v14.15.5/lib",
  "eslint.options": {
    "overrideConfigFile": "/Users/<USERNAME>/.eslintrc",
  },
}

(I’m using NVM to set my node version, so my pathing will likely look different than yours)

I had this issue with docker. I accidentally added NODE_ENV=production (for testing purposes) and forgot it to remove. By removing it everything worked fine 😉

I also encountered this problem. The addition of extension is still invalid:

yarn add eslint-config-airbnb 

or

yarn add eslint-config-airbnb-base