standardx icon indicating copy to clipboard operation
standardx copied to clipboard

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

Open ghost opened this issue 5 years ago • 25 comments
trafficstars

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.

ghost avatar Jan 12 '20 02:01 ghost

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

The standard tool itself works without such an error.

indigoviolet avatar Jan 19 '20 01:01 indigoviolet

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 [email protected] 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.

ghost avatar Jan 19 '20 14:01 ghost

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

yarn add [email protected] @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. :)

Jero786 avatar Mar 01 '20 12:03 Jero786

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.

Raynos avatar May 21 '20 13:05 Raynos

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"

JeffSpies avatar May 26 '20 00:05 JeffSpies

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

Raynos avatar May 26 '20 07:05 Raynos

@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.

ghost avatar Jun 17 '20 12:06 ghost

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?

JeffSpies avatar Jul 05 '20 19:07 JeffSpies

I used standardx 3.0.0 because reasons :(

Raynos avatar Jul 06 '20 08:07 Raynos

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

UrzaUrza avatar Aug 14 '20 14:08 UrzaUrza

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.

APWHY avatar Aug 31 '20 02:08 APWHY

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.

zunpitchk avatar Nov 04 '20 05:11 zunpitchk

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

feross avatar Nov 04 '20 09:11 feross

Let me try.

Raynos avatar Nov 04 '20 09:11 Raynos

~/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 avatar Nov 04 '20 09:11 Raynos

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 avatar Nov 04 '20 10:11 Raynos

I tried that locally and it doesn't help.

Raynos avatar Nov 04 '20 10:11 Raynos

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.

feross avatar Nov 04 '20 20:11 feross

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 avatar May 17 '21 11:05 tcurdt

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

tcurdt avatar May 19 '21 14:05 tcurdt

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

tcurdt avatar May 19 '21 18:05 tcurdt

Hello! 👋

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

Sanity checks by interested folks here would be cool!

Flet avatar Jun 15 '21 23:06 Flet

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

KnifeFed avatar Oct 25 '21 23:10 KnifeFed

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

fviazzi avatar Jan 17 '22 18:01 fviazzi

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

thorger avatar Jul 07 '23 16:07 thorger