From 0c5ef573fed31698ff8906675ddfc12a35829723 Mon Sep 17 00:00:00 2001 From: fwcd Date: Wed, 12 Oct 2022 11:41:50 -0700 Subject: [PATCH] Add destructuredArrayIgnorePattern to eslint config (#33552) Summary: This adds the `destructuredArrayIgnorePattern` rule [recently introduced in `typescript-eslint`](https://github.com/typescript-eslint/typescript-eslint/issues/4691), making underscored identifiers in array destructurings no longer an error, e.g. ```js const [state, _dispatch] = useContext(MyContext); ``` would be acceptable if `state` is used. ## Changelog [General] [Added] - Add destructuredArrayIgnorePattern to eslint config Pull Request resolved: https://github.com/facebook/react-native/pull/33552 Test Plan: Install the `react-native-community/eslint-config` package and test the example. Reviewed By: lunaleaps, cipolleschi Differential Revision: D40166101 Pulled By: ryancat fbshipit-source-id: 1e30297bf40d65e09682c4f9f3b3dd432ba5310e --- 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 563a400c02ab4d..bb5e2e32c94bf0 100644 --- a/packages/eslint-config-react-native-community/index.js +++ b/packages/eslint-config-react-native-community/index.js @@ -53,7 +53,10 @@ module.exports = { rules: { '@typescript-eslint/no-unused-vars': [ 'error', - {argsIgnorePattern: '^_'}, + { + argsIgnorePattern: '^_', + destructuredArrayIgnorePattern: '^_', + }, ], 'no-unused-vars': 'off', 'no-shadow': 'off',