Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: Failed to load config "standard" to extend from. #27

Open
ghost opened this issue Jan 12, 2020 · 25 comments · May be fixed by #38
Open

Error: Failed to load config "standard" to extend from. #27

ghost opened this issue Jan 12, 2020 · 25 comments · May be fixed by #38

Comments

@ghost
Copy link

ghost commented Jan 12, 2020

What version of this package are you using?

5.0.0 (standard 14.3.1)

What operating system, Node.js, and npm version?

Manjaro KDE, Node v13.5.0, npm v6.13.4

What happened?

  1. Installed standardx with sudo npm install standardx --global
  2. Executed standardx --fix in my local project folder.
  3. The program terminated with this error:
standardx: Unexpected linter output:

Error: Failed to load config "standard" to extend from.
Referenced from: BaseConfig
    at configMissingError (/usr/lib/node_modules/standardx/node_modules/eslint/lib/cli-engine/config-array-factory.js:233:9)
    at ConfigArrayFactory._loadExtendedShareableConfig (/usr/lib/node_modules/standardx/node_modules/eslint/lib/cli-engine/config-array-factory.js:712:23)
    at ConfigArrayFactory._loadExtends (/usr/lib/node_modules/standardx/node_modules/eslint/lib/cli-engine/config-array-factory.js:617:25)
    at ConfigArrayFactory._normalizeObjectConfigDataBody (/usr/lib/node_modules/standardx/node_modules/eslint/lib/cli-engine/config-array-factory.js:547:25)
    at _normalizeObjectConfigDataBody.next (<anonymous>)
    at ConfigArrayFactory._normalizeObjectConfigData (/usr/lib/node_modules/standardx/node_modules/eslint/lib/cli-engine/config-array-factory.js:491:20)
    at _normalizeObjectConfigData.next (<anonymous>)
    at createConfigArray (/usr/lib/node_modules/standardx/node_modules/eslint/lib/cli-engine/config-array-factory.js:307:25)
    at ConfigArrayFactory.create (/usr/lib/node_modules/standardx/node_modules/eslint/lib/cli-engine/config-array-factory.js:362:16)
    at createBaseConfigArray (/usr/lib/node_modules/standardx/node_modules/eslint/lib/cli-engine/cascading-config-array-factory.js:84:48)

If you think this is a bug in `standardx`, open an issue: https://github.com/standard/standardx/issues

What did you expect to happen?

To run the autofixer.

Are you willing to submit a pull request to fix this bug?

I'm not familiar with the code, so I don't think I could.

@indigoviolet
Copy link

indigoviolet commented Jan 19, 2020

ping? I'm also seeing this, with a similar setup.

The standard tool itself works without such an error.

@ghost
Copy link
Author

ghost commented Jan 19, 2020

Apparently the error comes from the fact that ESLint v6 now demands that all plugins are installed locally as seen here and here. Replacing the eslint package in standardx/node_modules with eslint@5.16.0 and reverting to ecmaVersion: 2019 in standardx/node_modules/eslint-config-standard/eslintrc.json and standardx/node_modules/eslint-config-standard-jsx/eslintrc.json fixed it for me. Not the ideal solution but at least I can use my customizations now.

@Jero786
Copy link

Jero786 commented Mar 1, 2020

@ManuelFte @indigoviolet In the meantime of that wrong configuration of eslint, I could resolve fallback of version 3.0.0 of standardx.

yarn add standardx@3.0.0 @typescript-eslint/parser @typescript-eslint/eslint-plugin -D

That's all

Extra tip:

I was having some problems with paths, etc.. so I ended to add a script to my package.json file.

scripts: {
  "fix-lints" : "standardx src/**/*.ts src/**/*.tsx --fix",
   ...
}

and finally, just be sure that you are importing the rest of configurations that are described here

That's it, then It's working as I expected. :)

@Raynos
Copy link

Raynos commented May 21, 2020

This is still an issue, we should look into fixing this with the eslint @ 7 upgrade. I think eslint @ 7 is supposed to fix this,

cc @LinusU who's got the eslint7 PR.

@JeffSpies
Copy link

Still an issue for me:

"@typescript-eslint/eslint-plugin": "^3.0.1",
"@typescript-eslint/parser": "^3.0.1",
"eslint": "^7.1.0",
"standardx": "^5.0.0"

@Raynos
Copy link

Raynos commented May 26, 2020

I think resolve plugins relative to is supposed to help with this maybe :(

@ghost
Copy link
Author

ghost commented Jun 17, 2020

@Jero786 standardx 3.0.0 uses ES 2018, so you still have to change the version numbers as I had mentioned in order to use at least ES 2019. Hopefully this issue is fixed soon because ES 2020 has just been released.

@JeffSpies
Copy link

JeffSpies commented Jul 5, 2020

I tried with another a new project and am hitting the same problem. So is it the case that no one is using latest standardx to add typescript support to standard?

@Raynos
Copy link

Raynos commented Jul 6, 2020

I used standardx 3.0.0 because reasons :(

@UrzaUrza
Copy link

I got this issue today and solved it by installing the following packages:

npm install eslint --save-dev
npm install eslint-config-standard --save-dev
npm install eslint-config-standard-jsx --save-dev
npm install eslint-plugin-react --save-dev
npm install eslint-plugin-import --save-dev
npm install eslint-plugin-node --save-dev
npm install eslint-plugin-promise --save-dev
npm install eslint-plugin-standard --save-dev

@APWHY
Copy link

APWHY commented Aug 31, 2020

I got this issue today and solved it by installing the following packages:
...

This worked for me, but I didn't need all these packages (it's dependent on your setup). Running
./node_modules/.bin/eslint <SOME_FILE>
will cause it to tell you what libraries you are missing (although you will have to do this multiple times.

airhorns added a commit to gadget-inc/fastify-passport that referenced this issue Sep 10, 2020
mcollina pushed a commit to fastify/fastify-passport that referenced this issue Sep 14, 2020
@zunpitchk
Copy link

zunpitchk commented Nov 4, 2020

I got this issue today and solved it by installing the following packages:

npm install eslint --save-dev
npm install eslint-config-standard --save-dev
npm install eslint-config-standard-jsx --save-dev
npm install eslint-plugin-react --save-dev
npm install eslint-plugin-import --save-dev
npm install eslint-plugin-node --save-dev
npm install eslint-plugin-promise --save-dev
npm install eslint-plugin-standard --save-dev

In my case, it was resolved by removing all these packages and restart VSCode.
The problem was from 'eslint' package itself. Probably collided with 'standardx' because both are linters.

@feross feross closed this as completed Nov 4, 2020
@feross feross reopened this Nov 4, 2020
@feross
Copy link
Member

feross commented Nov 4, 2020

Is this still an issue in the latest version of standardx?

@Raynos
Copy link

Raynos commented Nov 4, 2020

Let me try.

@Raynos
Copy link

Raynos commented Nov 4, 2020

~/optoolco/logs on master*
$ npr standardx
standardx: Unexpected linter output:

Error: Failed to load config "standard" to extend from.
Referenced from: BaseConfig
    at configInvalidError (/home/raynos/.config/npm-bin-deps/logs/node_modules/eslint/lib/cli-engine/config-array-factory.js:295:9)
    at ConfigArrayFactory._loadExtendedShareableConfig (/home/raynos/.config/npm-bin-deps/logs/node_modules/eslint/lib/cli-engine/config-array-factory.js:876:23)
    at ConfigArrayFactory._loadExtends (/home/raynos/.config/npm-bin-deps/logs/node_modules/eslint/lib/cli-engine/config-array-factory.js:776:25)
    at ConfigArrayFactory._normalizeObjectConfigDataBody (/home/raynos/.config/npm-bin-deps/logs/node_modules/eslint/lib/cli-engine/config-array-factory.js:715:25)
    at _normalizeObjectConfigDataBody.next (<anonymous>)
    at ConfigArrayFactory._normalizeObjectConfigData (/home/raynos/.config/npm-bin-deps/logs/node_modules/eslint/lib/cli-engine/config-array-factory.js:660:20)
    at _normalizeObjectConfigData.next (<anonymous>)
    at ConfigArrayFactory.create (/home/raynos/.config/npm-bin-deps/logs/node_modules/eslint/lib/cli-engine/config-array-factory.js:457:16)
    at createBaseConfigArray (/home/raynos/.config/npm-bin-deps/logs/node_modules/eslint/lib/cli-engine/cascading-config-array-factory.js:99:48)
    at new CascadingConfigArrayFactory (/home/raynos/.config/npm-bin-deps/logs/node_modules/eslint/lib/cli-engine/cascading-config-array-factory.js:226:30)

If you think this is a bug in `standardx`, open an issue: https://github.com/standard/standardx/issues
raynos at raynos-Precision-5530  
~/optoolco/logs on master*
$ npr standardx --version
6.0.0 (standard 15.0.1)

Yes.

@Raynos
Copy link

Raynos commented Nov 4, 2020

In tsdocstandard I use

  eslintConfig: {
    configFile: path.join(__dirname, 'eslintrc.json')
  },

Instead of eslintConfig: { baseConfig }.

Maybe giving it a fileName for a json file with require.resolve() fixes the issue.

@Raynos
Copy link

Raynos commented Nov 4, 2020

I tried that locally and it doesn't help.

@feross
Copy link
Member

feross commented Nov 4, 2020

Thanks for checking, @Raynos. I can't reproduce this issue on my machine. A PR that fixes this would be really helpful to get this resolved.

@tcurdt
Copy link

tcurdt commented May 17, 2021

Also ended up installing thse packages that made it work (although I don't need most of them - in theory)

npm install eslint-config-standard --save-dev
npm install eslint-config-standard-jsx --save-dev
npm install eslint-plugin-react --save-dev
npm install eslint-plugin-import --save-dev
npm install eslint-plugin-node --save-dev
npm install eslint-plugin-promise --save-dev
npm install eslint-plugin-standard --save-dev

@tcurdt
Copy link

tcurdt commented May 19, 2021

Any suggestion how to fix this without installing all those eslint packages manually?
Happy to help debugging this.

@tcurdt
Copy link

tcurdt commented May 19, 2021

I can't reproduce this issue on my machine. A PR that fixes this would be really helpful to get this resolved.

I am running out of ideas so I've created a testcase to reproduce it.

$ yarn -v
1.22.10
$ node -v
v14.17.0
$ yarn run lint:fix
yarn run v1.22.10
$ standardx --fix
standardx: Unexpected linter output:

Error: Failed to load config "standard" to extend from.
Referenced from: BaseConfig
...

testcase.zip

Flet added a commit that referenced this issue Jun 15, 2021
@Flet Flet linked a pull request Jun 15, 2021 that will close this issue
@Flet
Copy link
Member

Flet commented Jun 15, 2021

Hello! 👋

I was able to get something working that resolves this issue in PR #38.

Sanity checks by interested folks here would be cool!

@KnifeFed
Copy link

Any news on this? Is it at all possible to have a working global installation of standardx?

tonitone added a commit to tonitone/placeholder-image-service that referenced this issue Nov 1, 2021
tonitone added a commit to tonitone/placeholder-image-service that referenced this issue Nov 2, 2021
@fviazzi
Copy link

fviazzi commented Jan 17, 2022

In my case, using PR #38 and removing the setting standard.workingDirectories from my vsCode config file did the trick

@thorger
Copy link

thorger commented Jul 7, 2023

Any news on it? I just installed 7.0.0 and I'm getting:

npx standardx
standardx: Unexpected linter output:

Error: Failed to load config "standard" to extend from.
Referenced from: BaseConfig

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: No status
Development

Successfully merging a pull request may close this issue.