'Error - ESLint: 7.32.0 ESLint couldn't find the config "standard" to extend from
We have a CircleCI Pipeline. We have a older version of eslint i.e. 5.10.0 which was around three years ago installed and now client wants to upgrade node version to 16 and upgrade related packages.
I have modified package.json file and changes eslint version from "eslint": "^5.10.0" to "eslint": "^7.10.0".
Now, while pushing changes on branch CircleCI test execution fails with the below error.:
Oops! Something went wrong! :(
ESLint: 7.32.0
ESLint couldn't find the config "standard" to extend from. Please check that the name of the config is correct.
The config "standard" was referenced from the config file in "/home/xxx/xxx/.eslintrc.yml".
I have googled for this issue but did not find the proper solution for this.
I have tried to
- Removed .eslintrc.yml file by guessing that it can be created automatically.
- Try to run the command yarn run
eslint --initinside package.json under script tag"scripts": {"test": "yarn run eslint --init && yarn lint && yarn flow && yarn jest",}But here, CircleCI pipeline is used so eslint --init command will ask question How would you like to use ESLint? We don't have any provision in CircleCI during automated file and test execution to provide any answer.
Solution 1:[1]
I had a similar case, where this error was due to my eslint version being too new compared to the one required by standard.
Here are some steps you can try to verify whether that's the case for you as well:
- Locally in your project, run
npm init @eslint/config(will ask you some questions and generate a new.eslint.{js|yml|json}out of it) - When asked "Which style guide do you want to follow?" reply
standard
at this point, you should see something on the line of
The style guide "standard" requires eslint@^7.12.1. You are currently using eslint@{version}
Do you want to downgrade?
choosing "No" will warn you as follow and cause the error you mentioned when trying to execute linting.
Note: it might not work since ESLint's version is mismatched with the standard config
In my case the eslint version was differing by major (8.11.0) which makes it more obvious, but it looks very similar to what you have too.
If by this point you figured that's indeed the issue, here are some alternatives that might help:
- Downgrade eslint (easy one but won't work in the long run if you like your dependencies to be up-to-date)
- Switch to another style guide which doesn't have this limitation with eslint version (eg. airbnb or google's are suggested by the config setup)
- Switch to using standard directly instead of going through eslint
I am no expert in js world, so please feel free to point out anything I missed
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Marino |
