Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 46fe08d

Browse files
committedSep 6, 2024·
[Refactor] ensure getScope compatibility
1 parent e8ac4e4 commit 46fe08d

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed
 

‎src/rules/order.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import minimatch from 'minimatch';
44
import includes from 'array-includes';
55
import groupBy from 'object.groupby';
6-
import { getSourceCode } from 'eslint-module-utils/contextCompat';
6+
import { getScope, getSourceCode } from 'eslint-module-utils/contextCompat';
77

88
import importType from '../core/importType';
99
import isStaticRequire from '../core/staticRequire';
@@ -182,10 +182,10 @@ function isCJSExports(context, node) {
182182
&& node.property.type === 'Identifier'
183183
&& node.object.name === 'module'
184184
&& node.property.name === 'exports') {
185-
return (context.sourceCode || context).getScope(node).variables.findIndex((variable) => variable.name === 'module') === -1;
185+
return getScope(context, node).variables.findIndex((variable) => variable.name === 'module') === -1;
186186
} else if (node.type === 'Identifier'
187187
&& node.name === 'exports') {
188-
return (context.sourceCode || context).getScope(node).variables.findIndex((variable) => variable.name === 'exports') === -1;
188+
return getScope(context, node).variables.findIndex((variable) => variable.name === 'exports') === -1;
189189
}
190190
}
191191

0 commit comments

Comments
 (0)
Please sign in to comment.