From ba4b8df299f507a356247367da6422eb9cd601cc Mon Sep 17 00:00:00 2001 From: Gareth Jones Date: Sat, 28 May 2022 15:28:56 +1200 Subject: [PATCH] refactor: rename variable to be consistent --- src/rules/no-focused-tests.ts | 12 ++++++------ src/rules/utils/parseJestFnCall.ts | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/rules/no-focused-tests.ts b/src/rules/no-focused-tests.ts index 5d563e7ba..2010cf3f7 100644 --- a/src/rules/no-focused-tests.ts +++ b/src/rules/no-focused-tests.ts @@ -24,13 +24,13 @@ export default createRule({ CallExpression(node) { const scope = context.getScope(); - const parsed = parseJestFnCall(node, scope); + const jestFnCall = parseJestFnCall(node, scope); - if (parsed?.type !== 'test' && parsed?.type !== 'describe') { + if (jestFnCall?.type !== 'test' && jestFnCall?.type !== 'describe') { return; } - if (parsed.name.startsWith('f')) { + if (jestFnCall.name.startsWith('f')) { context.report({ messageId: 'focusedTest', node, @@ -40,8 +40,8 @@ export default createRule({ fix(fixer) { // don't apply the fixer if we're an aliased import if ( - parsed.head.type === 'import' && - parsed.name !== parsed.head.local + jestFnCall.head.type === 'import' && + jestFnCall.name !== jestFnCall.head.local ) { return null; } @@ -55,7 +55,7 @@ export default createRule({ return; } - const onlyNode = parsed.members.find( + const onlyNode = jestFnCall.members.find( s => getAccessorValue(s) === 'only', ); diff --git a/src/rules/utils/parseJestFnCall.ts b/src/rules/utils/parseJestFnCall.ts index 3f082e7b0..ce41fda1d 100644 --- a/src/rules/utils/parseJestFnCall.ts +++ b/src/rules/utils/parseJestFnCall.ts @@ -16,9 +16,9 @@ export const isTypeOfJestFnCall = ( scope: TSESLint.Scope.Scope, types: JestFnType[], ): boolean => { - const parsed = parseJestFnCall(node, scope); + const jestFnCall = parseJestFnCall(node, scope); - return parsed !== null && types.includes(parsed.type); + return jestFnCall !== null && types.includes(jestFnCall.type); }; export function getNodeChain(node: TSESTree.Node): AccessorNode[] {