diff --git a/packages/eslint-plugin-react-hooks/__tests__/ESLintRulesOfHooks-test.js b/packages/eslint-plugin-react-hooks/__tests__/ESLintRulesOfHooks-test.js index f392cf61989bd..b30f522bf1903 100644 --- a/packages/eslint-plugin-react-hooks/__tests__/ESLintRulesOfHooks-test.js +++ b/packages/eslint-plugin-react-hooks/__tests__/ESLintRulesOfHooks-test.js @@ -521,6 +521,39 @@ const tests = { } `, }, + { + code: normalizeIndent` + export const notAComponent = () => { + return () => { + useState(); + } + } + `, + // TODO: this should error but doesn't. + // errors: [functionError('use', 'notAComponent')], + }, + { + code: normalizeIndent` + export default () => { + if (isVal) { + useState(0); + } + } + `, + // TODO: this should error but doesn't. + // errors: [genericError('useState')], + }, + { + code: normalizeIndent` + function notAComponent() { + return new Promise.then(() => { + useState(); + }); + } + `, + // TODO: this should error but doesn't. + // errors: [genericError('useState')], + }, ], invalid: [ {