eslint-config-standard: Environment key "es2021" is unknown
version: 15.0.0, didnt have error in previous version
Error: .eslintrc » eslint-config-standard: Environment key “es2021” is unknown
.eslintrc
{ "extends": "standard", "rules": { "padded-blocks": ["error", "always"], "space-before-function-paren": ["error", "never"], "semi": ["error", "always"], "eol-last": ["error", "never"], "no-trailing-spaces": ["error", { "skipBlankLines": true, "ignoreComments": true }], "space-infix-ops": 0, "one-var": ["error", { "initialized": "consecutive" }], }, "globals": { "jQuery": true, "$": true } }
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 23 (6 by maintainers)
@bonesoul Are you sure that’s the ESLint that is used then?
Do you see this error on the command line or in eg. Visual Studio Code?
If on command line:
eslintand not a globally installed one?npx eslint --version– then it showsv7.11.0?eslint --version– does it run? If so, does it also showv7.11.0?If in Visual Studio Code or similar:
same here.
i’m already using eslint 7.11.0;
"eslint": "7.11.0",You need to update your ESLint then,
es2021was introduced in ESLint version7.8.0: https://github.com/eslint/eslint/releases/tag/v7.8.0Also,
eslint-config-standardversion15.0.0states that it requires at least ESLint7.11.0, so you should be seeing some kind of warning about having wrong peer dependencies: https://github.com/standard/eslint-config-standard/blob/6cd5bd5371189e9c8bda05992644de6e589a7a53/package.json#L51A friendly suggestion to avoid this in the future:
If you use the
install-peerdepsCLI tool to install a package like this, which has many peer dependencies, then it will automatically install the correct peer dependencies for you.I have run into this problem recently.
ESLint error log
NPM versions
Reproducible repo
https://github.com/huan/ducks
BTW: the above error only shows in vscode, but I can run eslint without any problem in command line.
I ran into this as well. Reason was, I had an outdated eslint installed globally (7.6.0) that was picked up by neovim instead of the project wide dependency @ 7.14.0. A
npm i -g eslintdid it for me.same here.
This is maybe a longshot, but for future folks: I am working in a monorepo with nested packages, where the base repo had the correct version of eslint, but a child repo had its own version of eslint that was older. So if you have nested repos, double-check (and make sure
npx eslint --versionsays what you think it should!)For future reference, in my case, it turns out prettier-standard is the culprit. It is way behind standard releases nowadays.
I still ran into this, and I’m using
eslint@7.32.0, both locally and globally are the same.I’ve degraded
eslint-config-standardto14.0.0, it works for me.