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 #44

Closed
nickserv opened this issue Jan 4, 2018 · 7 comments
Closed

Environment key "jest/globals" is unknown #44

nickserv opened this issue Jan 4, 2018 · 7 comments

Comments

@nickserv
Copy link

nickserv commented Jan 4, 2018

I couldn't use { "jest/globals": true } as recommended in the readme, so I'm using the built in Jest env with { "jest": true }.

Config

{
  "env": { 
    "jest/globals": true
  },
  "extends": [
    "plugin:jest/recommended"
  ]
}

Dependencies

[email protected] /Users/nick/Repos/purespec
├── [email protected]
├── [email protected]
└── [email protected]
@pauloborges
Copy link

I believe ESLint processes the configuration file as it reads it, so try declaring the env block after the extends block.

@nickserv
Copy link
Author

nickserv commented Jan 5, 2018

I'm still seeing this error after swapping the order.

@pauloborges
Copy link

I completely misread your code, sorry. If you're extending from the recommended jest plugin (instead of just using the plugin), you shouldn't need to explicitly declare jest/globals, since it is already declared by the recommended configuration:

https://github.com/jest-community/eslint-plugin-jest/blob/master/index.js#L21

@nickserv
Copy link
Author

nickserv commented Jan 5, 2018

I didn't notice that, thanks! Removing the Jest env fixed it.

@yvele
Copy link

yvele commented Jul 10, 2018

Note that I have the same error and I cannot use the "extends" solution, see #128

binchik added a commit to anvilabs/eslint-config that referenced this issue Jan 28, 2019
'jest/globals' env now is unknown for eslint. Used 'jest' instead like it was suggested here jest-community/eslint-plugin-jest#44 (comment)
yenbekbay pushed a commit to anvilabs/eslint-config that referenced this issue Feb 11, 2019
'jest/globals' env now is unknown for eslint. Used 'jest' instead like it was suggested here jest-community/eslint-plugin-jest#44 (comment)
mick352 added a commit to mick352/eslint-config-heise that referenced this issue Dec 19, 2019
@trusktr
Copy link

trusktr commented Nov 2, 2020

Note that I have the same error and I cannot use the "extends" solution, see #128

The extends in overrides is working great lately. F.e., I have the following in my eslintrc just for test files:

  overrides: [
    {
      files: ['**/*.test.js'],
      extends: ['plugin:jest/recommended', 'plugin:jest/style'],
    },
  ],

@yogeshdotnet
Copy link

I have also faced this issue and solved by following steps:

Update Package.json(Remove "react-app/jest" from extends array

"eslintConfig": { "extends": [ "react-app" ] },
Run npm install and check again It works It works fine for me

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

5 participants