Skip to content

Commit

Permalink
feat: add eslint api v9 compatibility (#33)
Browse files Browse the repository at this point in the history
  • Loading branch information
MikeMcC399 authored May 19, 2024
1 parent 3055947 commit 4a33848
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/rules/no-unused-expressions.js
Original file line number Diff line number Diff line change
Expand Up @@ -255,11 +255,15 @@ module.exports = {
return null;
}


const sourceCode = context.sourceCode ?? context.getSourceCode();
return {
ExpressionStatement: function(node) {
var valid = !Checker.isDisallowed(node.expression)
|| isDirective(node, context.getAncestors())
|| isDirective(node,
(sourceCode.getAncestors
? sourceCode.getAncestors(node)
: context.getAncestors()
))
|| isChaiExpectCall(node)
|| isChaiShouldCall(node);
if (!valid) {
Expand Down

0 comments on commit 4a33848

Please sign in to comment.