File tree Expand file tree Collapse file tree 1 file changed +33
-0
lines changed
packages/eslint-plugin-react-hooks/__tests__ Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change @@ -521,6 +521,39 @@ const tests = {
521521 }
522522 ` ,
523523 } ,
524+ {
525+ code : normalizeIndent `
526+ export const notAComponent = () => {
527+ return () => {
528+ useState();
529+ }
530+ }
531+ ` ,
532+ // TODO: this should error but doesn't.
533+ // errors: [functionError('use', 'notAComponent')],
534+ } ,
535+ {
536+ code : normalizeIndent `
537+ export default () => {
538+ if (isVal) {
539+ useState(0);
540+ }
541+ }
542+ ` ,
543+ // TODO: this should error but doesn't.
544+ // errors: [genericError('useState')],
545+ } ,
546+ {
547+ code : normalizeIndent `
548+ function notAComponent() {
549+ return new Promise.then(() => {
550+ useState();
551+ });
552+ }
553+ ` ,
554+ // TODO: this should error but doesn't.
555+ // errors: [genericError('useState')],
556+ } ,
524557 ] ,
525558 invalid : [
526559 {
You can’t perform that action at this time.
0 commit comments