From 3e5d334f056bf230a431a7ad3b5f36ceddfb9f89 Mon Sep 17 00:00:00 2001 From: Alexander Date: Sat, 22 Feb 2020 22:22:57 +0200 Subject: [PATCH] fix(eslint-plugin): [embt] ignore JSX callbacks --- .../rules/explicit-module-boundary-types.ts | 4 +++ .../explicit-module-boundary-types.test.ts | 29 +++++++++++++++++++ 2 files changed, 33 insertions(+) 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 f003977d8fb9..55c6bd29f99e 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 20a9f14a57e8..388adb994315 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: [ { pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy