question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

eslint extension keeps giving errors for a node_modules package - Failed to load config "./.config/eslint.config" to extend from

See original GitHub issue

the error Error: Failed to load config "./.config/eslint.config" to extend from. is flooding the output channel, showing popups none-stop

Ive tried looking everywhere for a solution, no luck yet -/ these are my configs:

//this is a multiroot workspace
"eslint.workingDirectories": [
      {
        "directory": "client",
        "changeProcessCWD": true
      }
    ],

error output: eslinterror.txt

config file: eslintrc.txt

verbose output: verbose.txt

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:21 (9 by maintainers)

github_iconTop GitHub Comments

2reactions
justingrantcommented, Aug 20, 2021

I can repro this problem at will. I removed my globally-installed ESLint and removed all ESLint settings from my user settings file, and the problem still reproes. The problem happens for me when I open a JS file in any node_modules package (let’s call it “A”) that extends from another package “B” where the “B” dependency is in devDependencies of “A”, which means that it’s not installed on my machine when I npm install A.

Even if eslint isn’t working in code in node_modules, honestly I don’t care-- because it’s not my code so I can’t fix it! Ideally, the extension would:

  • Recognize node_modules and ignore ESLint errors (both errors in the code and ESLint’s own internal failures). If that’s not possible, it’d be great to have an easy way to exclude node_modules folders from ESLint. (I’ve tried .eslintignore and haven’t found the magic content to get it to ignore node_modules)
  • Another possibility would be, instead of a modal error dialog, to have a more subtle UI to let me know that something is amiss with a particular file. The (prettier-vscode extension)[https://github.com/prettier/prettier-vscode} does this really well; when prettier is broken, its icon in the status bar changes from a checkmark to an X. Ideally, ESLint could do something similar.

Here’s repro steps:

  1. Open a new VS Code window
  2. Create a new folder
  3. Open that folder as a workspace in VS Code
  4. npm init the folder. Accept all the defaults.
  5. npm i serverless eslint
  6. In the files/folders left pane, navigate to and open this file: ./node_modules/severless/lib/Serverless.js

Expected: No modal error dialog box. Actual: ESLint: Failed to load config “@serverless/eslint-config/node” to extend from. Referenced from: /Users/justingrant/Documents/hdev/repro/eslint-warning/node_modules/serverless/package.json. Please see the ‘ESLint’ output channel for details.

Here’s the content of the output channel:

[Info  - 9:15:04 PM] ESLint server is starting
[Info  - 9:15:04 PM] ESLint server running in node v14.16.0
[Info  - 9:15:04 PM] ESLint server is running.
[Info  - 9:15:05 PM] ESLint library loaded from: /Users/justingrant/Documents/hdev/repro/eslint-warning/node_modules/eslint/lib/api.js
[Error - 9:15:05 PM] ESLint stack trace:
[Error - 9:15:05 PM] Error: Failed to load config "@serverless/eslint-config/node" to extend from.
Referenced from: /Users/justingrant/Documents/hdev/repro/eslint-warning/node_modules/serverless/package.json
    at configInvalidError (/Users/justingrant/Documents/hdev/repro/eslint-warning/node_modules/@eslint/eslintrc/lib/config-array-factory.js:290:9)
    at ConfigArrayFactory._loadExtendedShareableConfig (/Users/justingrant/Documents/hdev/repro/eslint-warning/node_modules/@eslint/eslintrc/lib/config-array-factory.js:883:23)
    at ConfigArrayFactory._loadExtends (/Users/justingrant/Documents/hdev/repro/eslint-warning/node_modules/@eslint/eslintrc/lib/config-array-factory.js:781:25)
    at ConfigArrayFactory._normalizeObjectConfigDataBody (/Users/justingrant/Documents/hdev/repro/eslint-warning/node_modules/@eslint/eslintrc/lib/config-array-factory.js:720:25)
    at _normalizeObjectConfigDataBody.next (<anonymous>)
    at ConfigArrayFactory._normalizeObjectConfigData (/Users/justingrant/Documents/hdev/repro/eslint-warning/node_modules/@eslint/eslintrc/lib/config-array-factory.js:665:20)
    at _normalizeObjectConfigData.next (<anonymous>)
    at ConfigArrayFactory.loadInDirectory (/Users/justingrant/Documents/hdev/repro/eslint-warning/node_modules/@eslint/eslintrc/lib/config-array-factory.js:511:28)
    at CascadingConfigArrayFactory._loadConfigInAncestors (/Users/justingrant/Documents/hdev/repro/eslint-warning/node_modules/@eslint/eslintrc/lib/cascading-config-array-factory.js:379:46)
    at CascadingConfigArrayFactory._loadConfigInAncestors (/Users/justingrant/Documents/hdev/repro/eslint-warning/node_modules/@eslint/eslintrc/lib/cascading-config-array-factory.js:398:20)

I’m happy to help you diagnose further-- let me know how I can help. Thanks!

1reaction
dbaeumercommented, Aug 24, 2021

@justingrant the reason why the .eslintignore file doesn’t work in this case is that the ESLint npm module reads the config before inspecting the ignore file. This is document capture in https://github.com/microsoft/vscode-eslint/issues/1238

Read more comments on GitHub >

github_iconTop Results From Across the Web

Linting in TypeScript using ESLint and Prettier - LogRocket Blog
Integrate Prettier with ESLint to automate type-checking in your TypeScript code and ensure that the code has no bugs.
Read more >
[eslint] failed to load config "standard" to extend from. - You.com
ESLint : Failed to load config "standard" to extend from. I do not use standard and do not have it installed. However, .eslintrc...
Read more >
Failed to load plugin 'flowtype' declared in 'package.json ...
In the terminal npm start . Instantly get this error. Failed to load plugin 'flowtype' declared in 'package.json » eslint-config-react-app': Cannot ...
Read more >
eslint | Yarn - Package Manager
Make sure your plugins (and ESLint) are both in your project's package.json as devDependencies (or dependencies, if your project uses ESLint at runtime)....
Read more >
Migrating and configuring Eslint with Angular 11
ESLint couldn't find the config "prettier/@typescript-eslint" to extend from. Please check that the name of the config is correct. The config " ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found