From 4822d16a9b470e0c1bac687c955030be5476f5fa Mon Sep 17 00:00:00 2001 From: Carlos Villuendas Zambrana Date: Fri, 30 Aug 2024 11:58:40 +0200 Subject: [PATCH] fix(packages/eslint-plugin-sui): Fix null check --- packages/eslint-plugin-sui/src/utils/decorators.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/eslint-plugin-sui/src/utils/decorators.js b/packages/eslint-plugin-sui/src/utils/decorators.js index 2ad0c83c6..45690c3c6 100644 --- a/packages/eslint-plugin-sui/src/utils/decorators.js +++ b/packages/eslint-plugin-sui/src/utils/decorators.js @@ -17,14 +17,14 @@ function getDecoratorsByNode(node, {isAClass, isAMethod, isArrowFunction}) { function getElementName(node, {isAClass, isAMethod, isArrowFunction}) { if (isAClass) { - const className = node.id?.name ?? 'UnknownClass' + const className = node?.id?.name ?? 'UnknownClass' return `${className}` } if (isArrowFunction) { const methodNode = node.parent const classNode = methodNode?.parent?.parent - const className = classNode.id?.name ?? 'UnknownClass' + const className = classNode?.id?.name ?? 'UnknownClass' const methodName = methodNode.key?.name ?? 'UnknownMethod' return `${className}.${methodName}` @@ -32,7 +32,7 @@ function getElementName(node, {isAClass, isAMethod, isArrowFunction}) { if (isAMethod) { const classNode = node.parent?.parent - const className = classNode.id?.name ?? 'UnknownClass' + const className = classNode?.id?.name ?? 'UnknownClass' const methodName = node.key?.name ?? 'UnknownMethod' return `${className}.${methodName}` @@ -55,7 +55,7 @@ function getElementMessageName(elementName, {isAClass, isAMethod, isArrowFunctio function remarkElement(node, {isAClass, isAMethod, isArrowFunction}) { if (isAClass) { - return node.id + return node?.id } if (isArrowFunction) {