From e78c01375aef88e0bb4029479acac9e85ecaf080 Mon Sep 17 00:00:00 2001 From: Jacob Lee Date: Fri, 26 Jul 2019 03:27:49 -0700 Subject: [PATCH] Allow jest globals in __mocks__ directories (#25738) Summary: The `__mocks__` directories should be treated the same as `__tests__` for the purpose of linting. See https://jestjs.io/docs/en/manual-mocks ## Changelog [Internal] [Changed] - eslint: allow jest globals in `__mocks__` directories Pull Request resolved: https://github.com/facebook/react-native/pull/25738 Test Plan: I installed the updated package locally in my project and verified that the `no-undef` rule no longer fires for references to `jest` in `__mocks__` directories. Differential Revision: D16515546 Pulled By: osdnk fbshipit-source-id: ae78b95d33d1b48ffa4aafa7a53c83e152d176b2 --- packages/eslint-config-react-native-community/index.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/eslint-config-react-native-community/index.js b/packages/eslint-config-react-native-community/index.js index 8691452b8fa..bd6343fc222 100644 --- a/packages/eslint-config-react-native-community/index.js +++ b/packages/eslint-config-react-native-community/index.js @@ -58,7 +58,10 @@ module.exports = { }, }, { - files: ['*.{spec,test}.{js,ts,tsx}', '**/__tests__/**/*.{js,ts,tsx}'], + files: [ + '*.{spec,test}.{js,ts,tsx}', + '**/__{mocks,tests}__/**/*.{js,ts,tsx}', + ], env: { jest: true, 'jest/globals': true,