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

Environment key "jest/globals" is unknown #98

Closed
minblake opened this issue May 12, 2020 · 16 comments
Closed

Environment key "jest/globals" is unknown #98

minblake opened this issue May 12, 2020 · 16 comments

Comments

@minblake
Copy link

I'm getting this error on a fresh install of create-nuxt-app with linting tools of eslint and prettier enabled

> eslint --ext .js,.vue --ignore-path .gitignore . "--fix"

Error: .eslintrc.js » @nuxtjs/eslint-config-typescript » @nuxtjs/eslint-config:
        Environment key "jest/globals" is unknown

    at /home/kdjs8967/nuxtjs-test/node_modules/eslint/lib/shared/config-validator.js:169:19
    at Array.forEach (<anonymous>)
    at validateEnvironment (/home/kdjs8967/nuxtjs-test/node_modules/eslint/lib/shared/config-validator.js:163:30)
    at validateConfigArray (/home/kdjs8967/nuxtjs-test/node_modules/eslint/lib/shared/config-validator.js:334:9)
    at CascadingConfigArrayFactory._finalizeConfigArray (/home/kdjs8967/nuxtjs-test/node_modules/eslint/lib/cli-engine/cascading-config-array-factory.js:417:13)
    at CascadingConfigArrayFactory.getConfigArrayForFile (/home/kdjs8967/nuxtjs-test/node_modules/eslint/lib/cli-engine/cascading-config-array-factory.js:271:21)
    at FileEnumerator._iterateFilesRecursive (/home/kdjs8967/nuxtjs-test/node_modules/eslint/lib/cli-engine/file-enumerator.js:396:49)
    at _iterateFilesRecursive.next (<anonymous>)
    at FileEnumerator.iterateFiles (/home/kdjs8967/nuxtjs-test/node_modules/eslint/lib/cli-engine/file-enumerator.js:251:49)
    at iterateFiles.next (<anonymous>)

The .eslintrc.js is the default one

module.exports = {
  root: true,
  env: {
    browser: true,
    node: true
  },
  extends: [
    '@nuxtjs/eslint-config-typescript',
    'prettier',
    'prettier/vue',
    'plugin:prettier/recommended',
    'plugin:nuxt/recommended'
  ],
  plugins: [
    'prettier'
  ],
  // add your custom rules here
  rules: {
  }
}
@buecki
Copy link

buecki commented May 12, 2020

Everything worked fine yesterday, now I have exactly the same problem and haven't found a solution yet.

@buecki
Copy link

buecki commented May 13, 2020

@minblake I just tried again and it suddenly works for me although I haven't changed anything :-)

@minblake
Copy link
Author

@buecki Yeah, same thing happend to me. Strange.. Anyways, thank you!

@edwin177
Copy link

Just ran into this issue using:

"@nuxtjs/eslint-config-typescript": "1.0.2",
"eslint": "6.8.0",

Did you do anything to fix it?

@minblake
Copy link
Author

@edwin177 the error just suddenly disappeared, so sadly, no. Maybe try deleting your node_modules and installing it again but I can't guarantee you it will work

@edwin177
Copy link

Couldn't figure out, but upgrading eslint worked for me:

"@nuxtjs/eslint-config-typescript": "2.0.0",
"eslint": "7.0.0",

@lephuongbg
Copy link

Version 3 of "@nuxtjs/eslint-config-typescript" doesn't work at the moment. Same error.

"@nuxtjs/eslint-config-typescript": "^3.0.0",
"eslint": "^7.5.0",
"eslint-plugin-import": "^2.22.0", // <- Not sure why I suddenly need to install this with version 3?

@Sletheren
Copy link

+1

@mrleblanc101
Copy link

mrleblanc101 commented Oct 13, 2021

Weird I just ran into this issue after upgrading to eslint 8.0.0 I guess

@SixBytesUnder
Copy link

I run into this today. Already deleted package-lock and node-modules and reinstalled everything, didn't help :(

  "devDependencies": {
    "@nuxtjs/eslint-config": "^6.0.1",
    "@nuxtjs/eslint-module": "^3.0.2",
    "babel-core": "7.0.0-bridge.0",
    "babel-eslint": "^10.1.0",
    "eslint": "^8.0.1",
    "eslint-plugin-nuxt": "^2.0.0"
  }

@aparajita
Copy link

Is there any special reason you are depending on eslint-plugin-jest? I know it may seem hard to believe, but some of us neither use jest nor want to install it. Making jest a hard-coded dependency to lint Nuxt code seems a bit opinionated.

@acidjazz
Copy link

we should re-open this @minblake

@minblake minblake reopened this Oct 21, 2021
@clarkdo
Copy link
Member

clarkdo commented Oct 24, 2021

This issue has been fix in latest eslint-config by updating eslint and jest plugin.

Can you try:

yarn upgrade @nuxtjs/eslint-config@latest @nuxtjs/eslint-config-typescript@latest 

// or

npm install @nuxtjs/eslint-config@latest   @nuxtjs/eslint-config-typescript@latest

@acidjazz
Copy link

I think you need to upgrade both as majors in semver @clarkdo so - does @latest do that? because I know yarn upgrade wont do it alone

@clarkdo
Copy link
Member

clarkdo commented Oct 24, 2021

If you specify latest tag, the package will be updated to latest tag which includes major release.

@mrleblanc101
Copy link

I do not have typescript or jest

@pi0 pi0 closed this as completed May 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests