From 46fe08d19a48f5b8ee46a80675f49c0896708599 Mon Sep 17 00:00:00 2001 From: Manuel Thalmann Date: Fri, 6 Sep 2024 12:08:05 +0200 Subject: [PATCH] [Refactor] ensure `getScope` compatibility --- src/rules/order.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/rules/order.js b/src/rules/order.js index f8177cc6d..113aace27 100644 --- a/src/rules/order.js +++ b/src/rules/order.js @@ -3,7 +3,7 @@ import minimatch from 'minimatch'; import includes from 'array-includes'; import groupBy from 'object.groupby'; -import { getSourceCode } from 'eslint-module-utils/contextCompat'; +import { getScope, getSourceCode } from 'eslint-module-utils/contextCompat'; import importType from '../core/importType'; import isStaticRequire from '../core/staticRequire'; @@ -182,10 +182,10 @@ function isCJSExports(context, node) { && node.property.type === 'Identifier' && node.object.name === 'module' && node.property.name === 'exports') { - return (context.sourceCode || context).getScope(node).variables.findIndex((variable) => variable.name === 'module') === -1; + return getScope(context, node).variables.findIndex((variable) => variable.name === 'module') === -1; } else if (node.type === 'Identifier' && node.name === 'exports') { - return (context.sourceCode || context).getScope(node).variables.findIndex((variable) => variable.name === 'exports') === -1; + return getScope(context, node).variables.findIndex((variable) => variable.name === 'exports') === -1; } }