diff --git a/packages/eslint-plugin/src/rules/explicit-module-boundary-types.ts b/packages/eslint-plugin/src/rules/explicit-module-boundary-types.ts index f003977d8fb..55c6bd29f99 100644 --- a/packages/eslint-plugin/src/rules/explicit-module-boundary-types.ts +++ b/packages/eslint-plugin/src/rules/explicit-module-boundary-types.ts @@ -79,6 +79,10 @@ export default util.createRule({ return false; } + if (node.type === AST_NODE_TYPES.JSXExpressionContainer) { + return true; + } + if (node.type === AST_NODE_TYPES.ReturnStatement) { isReturnedValue = true; } diff --git a/packages/eslint-plugin/tests/rules/explicit-module-boundary-types.test.ts b/packages/eslint-plugin/tests/rules/explicit-module-boundary-types.test.ts index 20a9f14a57e..388adb99431 100644 --- a/packages/eslint-plugin/tests/rules/explicit-module-boundary-types.test.ts +++ b/packages/eslint-plugin/tests/rules/explicit-module-boundary-types.test.ts @@ -312,6 +312,35 @@ export class Test { }, ], }, + { + code: ` +export const Foo: FC = () => ( +
{}} + b={function (e) {}} + c={function foo(e) {}} + > +
+) + `, + parserOptions: { + ecmaFeatures: { jsx: true }, + }, + }, + { + code: ` +export const Foo: JSX.Element = +
{}} + b={function (e) {}} + c={function foo(e) {}} + > +
+ `, + parserOptions: { + ecmaFeatures: { jsx: true }, + }, + }, ], invalid: [ {