Skip to content

Commit

Permalink
refactor: rename variable to be consistent
Browse files Browse the repository at this point in the history
  • Loading branch information
G-Rath committed May 28, 2022
1 parent 25c0179 commit ba4b8df
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
12 changes: 6 additions & 6 deletions src/rules/no-focused-tests.ts
Expand Up @@ -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,
Expand All @@ -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;
}
Expand All @@ -55,7 +55,7 @@ export default createRule({
return;
}

const onlyNode = parsed.members.find(
const onlyNode = jestFnCall.members.find(
s => getAccessorValue(s) === 'only',
);

Expand Down
4 changes: 2 additions & 2 deletions src/rules/utils/parseJestFnCall.ts
Expand Up @@ -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[] {
Expand Down

0 comments on commit ba4b8df

Please sign in to comment.