Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
veritem committed Dec 26, 2024
1 parent 7e1ce6b commit 4e1ca3b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
17 changes: 9 additions & 8 deletions src/rules/valid-expect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,9 @@ function getParentIfThenified(node: TSESTree.Node): TSESTree.Node {

const findPromiseCallExpressionNode = (node: TSESTree.Node) =>
node.parent?.parent
&& [AST_NODE_TYPES.CallExpression, AST_NODE_TYPES.ArrayExpression].includes(
node.parent.type
)
&& [AST_NODE_TYPES.CallExpression, AST_NODE_TYPES.ArrayExpression].includes(
node.parent.type
)
? getPromiseCallExpressionNode(node.parent)
: null

Expand All @@ -94,10 +94,10 @@ const isAcceptableReturnNode = (
node: TSESTree.Node,
allowReturn: boolean
): node is
| TSESTree.ConditionalExpression
| TSESTree.ArrowFunctionExpression
| TSESTree.AwaitExpression
| TSESTree.ReturnStatement => {
| TSESTree.ConditionalExpression
| TSESTree.ArrowFunctionExpression
| TSESTree.AwaitExpression
| TSESTree.ReturnStatement => {
if (allowReturn && node.type === AST_NODE_TYPES.ReturnStatement)
return true

Expand Down Expand Up @@ -248,7 +248,8 @@ export default createEslintRule<[
}
else if (vitestFnCall?.type !== 'expect') {
return
} else if (vitestFnCall.modifiers.some(mod => mod.type === AST_NODE_TYPES.Identifier && mod.name == "to")) {
}
else if (vitestFnCall.modifiers.some(mod => mod.type === AST_NODE_TYPES.Identifier && mod.name == 'to')) {
return
}

Expand Down
7 changes: 4 additions & 3 deletions src/utils/parse-vitest-fn-call.ts
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,8 @@ const findModifiersAndMatcher = (
&& firstModifier !== ModifierName.to
)
return 'modifier-unknown'
} else {
}
else {
return 'modifier-unknown'
}
modifiers.push(member)
Expand Down Expand Up @@ -542,5 +543,5 @@ const isTypeCastExpression = <Expression extends TSESTree.Expression>(
export const followTypeAssertionChain = <Expression extends TSESTree.Expression>(
expression: MaybeTypeCast<Expression>
): Expression => isTypeCastExpression(expression)
? followTypeAssertionChain(expression.expression)
: expression
? followTypeAssertionChain(expression.expression)
: expression

0 comments on commit 4e1ca3b

Please sign in to comment.