Skip to content

Commit 6aed8bb

Browse files
committed
fix: replace context.getScope() with sourceCode.getScope()
1 parent 68674b7 commit 6aed8bb

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

Diff for: lib/rules/require-meta-has-suggestions.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -95,14 +95,15 @@ module.exports = {
9595
ruleReportsSuggestions = true;
9696
}
9797
},
98-
'Program:exit'() {
98+
'Program:exit'(node) {
99+
const scope = sourceCode.getScope?.(node) || context.getScope(); // TODO: just use sourceCode.getScope() when we drop support for ESLint < v9.0.0
99100
const metaNode = ruleInfo && ruleInfo.meta;
100101
const hasSuggestionsProperty = utils
101102
.evaluateObjectProperties(metaNode, scopeManager)
102103
.find((prop) => utils.getKeyName(prop) === 'hasSuggestions');
103104
const hasSuggestionsStaticValue =
104105
hasSuggestionsProperty &&
105-
getStaticValue(hasSuggestionsProperty.value, context.getScope());
106+
getStaticValue(hasSuggestionsProperty.value, scope);
106107

107108
if (ruleReportsSuggestions) {
108109
if (!hasSuggestionsProperty) {

0 commit comments

Comments
 (0)