standard/standardx

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

Opened this issue ยท 25 comments

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.

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

The standard tool itself works without such an error.

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.

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

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.

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"

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

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

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?

I used standardx 3.0.0 because reasons :(

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 commented

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.

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.

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

Let me try.

~/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.

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.

I tried that locally and it doesn't help.

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.

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

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

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 commented

Hello! ๐Ÿ‘‹

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

Sanity checks by interested folks here would be cool!

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

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

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