From de117b0361ed0fa8ac9a1fafc2570015dcdf50f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=BCrg=C3=BCn=20Day=C4=B1o=C4=9Flu?= Date: Mon, 11 Dec 2023 12:07:37 +0100 Subject: [PATCH] reformat --- src/rules/prefer-property-access-at.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/rules/prefer-property-access-at.js b/src/rules/prefer-property-access-at.js index c1d6a74..86077aa 100644 --- a/src/rules/prefer-property-access-at.js +++ b/src/rules/prefer-property-access-at.js @@ -12,11 +12,16 @@ module.exports = { (node.callee.object.type === "Identifier" || node.callee.object.type === "MemberExpression") ) { + const objectText = context + .getSourceCode() + .getText(node.callee.object); const [argument] = node.arguments; + let val; if ( argument.type === "UnaryExpression" && + argument.argument.type === "Literal" && typeof argument.argument.value === "number" ) { val = argument.argument.value; @@ -27,9 +32,6 @@ module.exports = { val = argument.value; } - const objectText = context - .getSourceCode() - .getText(node.callee.object); let replacement; if (val !== undefined) {