File tree Expand file tree Collapse file tree 2 files changed +14
-1
lines changed
packages/eslint-plugin-react-hooks Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -489,9 +489,12 @@ const tests = {
489
489
} ,
490
490
{
491
491
code : normalizeIndent `
492
+ import * as React from 'react';
492
493
function App() {
493
494
if (shouldShowText) {
494
495
const text = use(query);
496
+ const data = React.use(thing);
497
+ const data2 = react.use(thing2);
495
498
return <Text text={text} />
496
499
}
497
500
return <Text text={shouldFetchBackupText ? use(backupQuery) : "Nothing to see here"} />
Original file line number Diff line number Diff line change @@ -108,7 +108,17 @@ function isUseEffectEventIdentifier(node) {
108
108
}
109
109
110
110
function isUseIdentifier ( node ) {
111
- return node . type === 'Identifier' && node . name === 'use' ;
111
+ switch ( node . type ) {
112
+ case 'Identifier' :
113
+ return node . name === 'use' ;
114
+ case 'MemberExpression' :
115
+ return (
116
+ ( node . object . name === 'React' || node . object . name === 'react' ) &&
117
+ node . property . name === 'use'
118
+ ) ;
119
+ default :
120
+ return false ;
121
+ }
112
122
}
113
123
114
124
export default {
You can’t perform that action at this time.
0 commit comments