Repository: jsx-eslint/eslint-plugin-react (JavaScript)

Issue:
Error: VariableDeclarator ASTNodes are not handled by markPropTypesAsUsed
ESLint started crashing with this error shortly after I upgraded to 7.14.0.

I suspect it's related to prop destructuring. I tried opening different JSX files and ESLint didn't seem to have a problem except for files with components that destructure their props.

Full error log: 

```
[Error - 8:04:55 PM] ESLint stack trace:
[Error - 8:04:55 PM] Error: VariableDeclarator ASTNodes are not handled by markPropTypesAsUsed
Occurred while linting /Users/.../src/pages/tournament/status.jsx:8
    at markPropTypesAsUsed (/Users/.../node_modules/eslint-plugin-react/lib/util/usedPropTypes.js:338:15)
    at Object.VariableDeclarator (/Users/.../node_modules/eslint-plugin-react/lib/util/usedPropTypes.js:492:9)
    at updatedRuleInstructions.(anonymous function) (/Users/.../node_modules/eslint-plugin-react/lib/util/Components.js:780:47)
    at listeners.(anonymous function).forEach.listener (/Users/.../node_modules/eslint/lib/util/safe-emitter.js:45:58)
    at Array.forEach (<anonymous>)
    at Object.emit (/Users/.../node_modules/eslint/lib/util/safe-emitter.js:45:38)
    at NodeEventGenerator.applySelector (/Users/.../node_modules/eslint/lib/util/node-event-generator.js:251:26)
    at NodeEventGenerator.applySelectors (/Users/.../node_modules/eslint/lib/util/node-event-generator.js:280:22)
    at NodeEventGenerator.enterNode (/Users/.../node_modules/eslint/lib/util/node-event-generator.js:294:14)
    at CodePathAnalyzer.enterNode (/Users/.../node_modules/eslint/lib/code-path-analysis/code-path-analyzer.js:632:23)
```


Discussion:
Can you share the code that produce the bug?
Here's one example:

```jsx
import {Panel, PanelContainer} from "../../components/utility";
import PropTypes from "prop-types";
import React from "react";
import RoundTable from "./round/round-table";
import {ScoreTable} from "./scores";

export default function Status({tournament}) {
    const {tourney, getPlayer} = tournament;
    const lastRound = (function () {
        if (tourney.roundList.length === 0) {
            return <p>No rounds played yet.</p>;
        }
        const lastRoundId = tourney.roundList.length - 1;
        if (tourney.roundList[lastRoundId].length === 0) {
            return (
                <p>Matched players in the current round will be shown here.</p>
            );
        }
        return (
            <RoundTable
                roundId={lastRoundId}
                tournament={tournament}
                compact
            />
        );
    }());
    return (
        <>
            <h2 style={{textAlign: "center"}}>Tournament status</h2>
            <PanelContainer
                style={{justifyContent: "center"}}
            >
                <Panel>
                    {lastRound}
                </Panel>
                <Panel>
                    <ScoreTable
                        getPlayer={getPlayer}
                        title="Rankings"
                        tourney={tourney}
                        compact
                    />
                </Panel>
            </PanelContainer>
        </>
    );
}
Status.propTypes = {
    tournament: PropTypes.object.isRequired
};
```

If I remove the line `const {tourney, getPlayer} = tournament;` then ESLint doesn't crash.
I started getting this error today also, with a very similar example to yours.
I opened a pr on this. A minimal reproducing example is:
```js
/* react/prop-types: 2 */

const PropTypes = require('prop-types');

function Foo({a}) {
  const {b} = a;
  return <p>{b.nope}</p>;
}
Foo.propTypes = {
  a: PropTypes.shape({
    b: PropTypes.shape({
      _: PropTypes.string,
    }),
  }),
};
```
What version of eslint?



Patch:
diff --git a/lib/util/usedPropTypes.js b/lib/util/usedPropTypes.js
index b783bbaf1a..9e5fffbfe5 100755
--- a/lib/util/usedPropTypes.js
+++ b/lib/util/usedPropTypes.js
@@ -489,7 +489,7 @@ module.exports = function usedPropTypesInstructions(context, components, utils)
 
       // let {firstname} = thing, where thing is defined by const thing = this.props.**.*
       if (propVariables.get(node.init.name)) {
-        markPropTypesAsUsed(node, propVariables.get(node.init.name));
+        markPropTypesAsUsed(node.id, propVariables.get(node.init.name));
       }
     },
 


Test patch:
diff --git a/tests/lib/rules/no-unused-prop-types.js b/tests/lib/rules/no-unused-prop-types.js
index 952d6763c5..ab327ce4b8 100644
--- a/tests/lib/rules/no-unused-prop-types.js
+++ b/tests/lib/rules/no-unused-prop-types.js
@@ -492,6 +492,22 @@ ruleTester.run('no-unused-prop-types', rule, {
       `,
       options: [{skipShapeProps: false}],
       parser: parsers.BABEL_ESLINT
+    }, {
+      code: `
+        function Foo({ a }) {
+          const { b } = a
+          return <>{ b.c }</>
+        }
+        Foo.propTypes = {
+          a: PropTypes.shape({
+            b: PropType.shape({
+              c: PropTypes.string,
+            }),
+          })
+        }
+      `,
+      options: [{skipShapeProps: false}],
+      parser: parsers.BABEL_ESLINT
     }, {
       // Destructured assignment with Shape propTypes with skipShapeProps off issue #816
       code: `
diff --git a/tests/lib/rules/prop-types.js b/tests/lib/rules/prop-types.js
index 6685103fa1..bcb48a09dc 100755
--- a/tests/lib/rules/prop-types.js
+++ b/tests/lib/rules/prop-types.js
@@ -2472,6 +2472,25 @@ ruleTester.run('prop-types', rule, {
         {message: "'a.nope' is missing in props validation"}
       ]
     },
+    {
+      code: `
+        function Foo({ a }) {
+          const { b } = a
+          return <p>{ b.nope }</p>
+        }
+
+        Foo.propTypes = {
+          a: PropTypes.shape({
+            b: PropType.shape({
+              _: PropType.string,
+            }),
+          })
+        }
+      `,
+      errors: [
+        {message: "'a.b.nope' is missing in props validation"}
+      ]
+    },
     {
       code: `
         function Foo(props) {