I'm getting
ESLint: rn-project/.eslintrc.js 禄 @react-native-community/eslint-config#overrides[2]: Environment key "jest/globals" is unknown . Please see the 'ESLint' output channel for details.
Error message for every key-stock in VSCode after scaffolding new project. Seems there is an issue with the @react-native-community/eslint-config
React Native version:
System:
OS: macOS 10.14.6
CPU: (8) x64 Intel(R) Core(TM) i7-4870HQ CPU @ 2.50GHz
Memory: 400.39 MB / 16.00 GB
Shell: 5.3 - /bin/zsh
Binaries:
Node: 10.15.3 - /usr/local/bin/node
Yarn: 1.17.3 - /usr/local/bin/yarn
npm: 6.11.3 - /usr/local/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
SDKs:
iOS SDK:
Platforms: iOS 12.2, macOS 10.14, tvOS 12.2, watchOS 5.2
Android SDK:
API Levels: 18, 21, 22, 23, 24, 25, 26, 27, 28
Build Tools: 21.1.2, 23.0.1, 24.0.1, 25.0.0, 25.0.1, 25.0.2, 25.0.3, 26.0.1, 26.0.2, 26.0.3, 27.0.3, 28.0.0, 28.0.1, 28.0.2, 28.0.3
Android NDK: 20.0.5594570
IDEs:
Android Studio: 3.5 AI-191.8026.42.35.5900203
Xcode: 10.2.1/10E1001 - /usr/bin/xcodebuild
npmPackages:
react: 16.9.0 => 16.9.0
react-native: 0.61.2 => 0.61.2
react-native initDescribe what you expected to happen:
Run with out ESLint issues with every keystroke.
This is also happening for me in my CircleCI build (as opposed to OP's issue within VSCode)
I have same issue in monorepo when extending a config from root directory
For those with this issue in VSCode - it looks to be related to vscode-eslint. I found a fix with this particular post in their repo issues.
Basically, create a workspace settings file (.vscode/settings.json) and create a working directory for eslint. In particular, you want to add the directory that contains your .eslintrc.js file, such as:
{
"eslint.workingDirectories": [
"./dir/containing/eslintrc_file",
]
}
The solution from @starlabs007 worked for me. Thanks!
@starlabs007 it work. Thanks
This is failing all the time for me, even on CI
I try to update my eslint-config and add eslint-plugin. It worked.
I know that this isn't a good answer, but eslint is looking for the jest/globals environment. Until the maintainers fix it in the project, you can just add the eslint-jest-plugin to your package.json. If you're using Lerna, add the eslint-jest-plugin to your development dependencies of the RN package.
https://github.com/jest-community/eslint-plugin-jest#readme
yarn add eslint-plugin-jest --dev
npm install eslint-plugin-jest --save-dev
md5-90f5e98ceb849aed9ac010481bf82a21
lerna add -eslint-plugin-jest -scope=@yourscope/package-name --dev
yarn add -D @types/jest solved the issue for me
Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. You may also label this issue as a "Discussion" or add it to the "Backlog" and I will leave it open. Thank you for your contributions.
Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please feel free to create a new issue with up-to-date information.
Most helpful comment
For those with this issue in VSCode - it looks to be related to
vscode-eslint. I found a fix with this particular post in their repo issues.Basically, create a workspace settings file (
.vscode/settings.json) and create a working directory for eslint. In particular, you want to add the directory that contains your.eslintrc.jsfile, such as: