From 722a0ff6f88bed4d54579a2b8bc574e87948187f Mon Sep 17 00:00:00 2001 From: Tom Spencer Date: Wed, 1 Dec 2021 14:07:58 -0800 Subject: [PATCH] Fix eslint no-shadow issue with TypeScript enums (#32644) Summary: The current ESLint config includes a rule for `no-shadow`. When authoring using TypeScript, the [typescript-eslint docs](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/docs/rules/no-shadow.md) mention that the base `no-shadow` rule should be disabled in favour of `typescript-eslint/no-shadow`, otherwise false positives can be reported. In my case, I was experiencing the same symptoms as described in [this issue](https://github.com/typescript-eslint/typescript-eslint/issues/2552). ## Changelog [General] [Fixed] - ESLint `no-shadow` rule returning false positive for TypeScript enums Pull Request resolved: https://github.com/facebook/react-native/pull/32644 Test Plan: Before config changes: Screenshot 2021-11-22 at 21 02 31 After changes: Screenshot 2021-11-22 at 21 03 28 Reviewed By: GijsWeterings Differential Revision: D32618393 Pulled By: yungsters fbshipit-source-id: c69d5cff7210c22c84a0791bde62674efc6aa027 --- packages/eslint-config-react-native-community/index.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/eslint-config-react-native-community/index.js b/packages/eslint-config-react-native-community/index.js index 71480dca05b..b9b7ee22734 100644 --- a/packages/eslint-config-react-native-community/index.js +++ b/packages/eslint-config-react-native-community/index.js @@ -56,6 +56,8 @@ module.exports = { {argsIgnorePattern: '^_'}, ], 'no-unused-vars': 'off', + 'no-shadow': 'off', + '@typescript-eslint/no-shadow': 1, }, }, {