Skip to content

Commit

Permalink
[lint] treat React.use() the same as use() (#27769)
Browse files Browse the repository at this point in the history
We should probably treat `React.use()` the same as `use()` to allow it
within loops and conditionals.

Ideally this would implement a test that `React` is imported or required
from `'react'`, but we don't otherwise implement such a test.

DiffTrain build for [640cceb](640cceb)
  • Loading branch information
kassens committed Dec 1, 2023
1 parent c35082f commit 7adeb4a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion compiled/facebook-www/REVISION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
5dd35968bef791ccc5948c657fabf191a77fff3f
640ccebb7d9669f1efbd20e86f6f84086c3d698d
2 changes: 1 addition & 1 deletion compiled/facebook-www/eslint-plugin-react-hooks.js
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ function isUseEffectEventIdentifier$1(node) {
}

function isUseIdentifier(node) {
return node.type === 'Identifier' && node.name === 'use';
return isReactFunction(node, 'use');
}

var RulesOfHooks = {
Expand Down

0 comments on commit 7adeb4a

Please sign in to comment.