Skip to content

Commit 722a0ff

Browse files
fiznoolfacebook-github-bot
authored andcommitted
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](typescript-eslint/typescript-eslint#2552). ## Changelog <!-- Help reviewers and the release process by writing your own changelog entry. For an example, see: https://github.com/facebook/react-native/wiki/Changelog --> [General] [Fixed] - ESLint `no-shadow` rule returning false positive for TypeScript enums Pull Request resolved: #32644 Test Plan: Before config changes: <img width="631" alt="Screenshot 2021-11-22 at 21 02 31" src="https://user-images.githubusercontent.com/820863/142934803-ef1343d6-46ab-4495-9ea5-957f7ec404fc.png"> After changes: <img width="486" alt="Screenshot 2021-11-22 at 21 03 28" src="https://user-images.githubusercontent.com/820863/142934914-a151656a-a37e-4ffb-9db5-ed9fb93543c7.png"> Reviewed By: GijsWeterings Differential Revision: D32618393 Pulled By: yungsters fbshipit-source-id: c69d5cff7210c22c84a0791bde62674efc6aa027
1 parent b2cf24f commit 722a0ff

File tree

1 file changed

+2
-0
lines changed
  • packages/eslint-config-react-native-community

1 file changed

+2
-0
lines changed

packages/eslint-config-react-native-community/index.js

+2
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ module.exports = {
5656
{argsIgnorePattern: '^_'},
5757
],
5858
'no-unused-vars': 'off',
59+
'no-shadow': 'off',
60+
'@typescript-eslint/no-shadow': 1,
5961
},
6062
},
6163
{

0 commit comments

Comments
 (0)