Skip to content

Commit

Permalink
fix: replace context.getScope() with sourceCode.getScope()
Browse files Browse the repository at this point in the history
  • Loading branch information
aladdin-add committed Dec 11, 2023
1 parent 68674b7 commit 6aed8bb
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/rules/require-meta-has-suggestions.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,14 +95,15 @@ module.exports = {
ruleReportsSuggestions = true;
}
},
'Program:exit'() {
'Program:exit'(node) {
const scope = sourceCode.getScope?.(node) || context.getScope(); // TODO: just use sourceCode.getScope() when we drop support for ESLint < v9.0.0
const metaNode = ruleInfo && ruleInfo.meta;
const hasSuggestionsProperty = utils
.evaluateObjectProperties(metaNode, scopeManager)
.find((prop) => utils.getKeyName(prop) === 'hasSuggestions');
const hasSuggestionsStaticValue =
hasSuggestionsProperty &&
getStaticValue(hasSuggestionsProperty.value, context.getScope());
getStaticValue(hasSuggestionsProperty.value, scope);

if (ruleReportsSuggestions) {
if (!hasSuggestionsProperty) {
Expand Down

0 comments on commit 6aed8bb

Please sign in to comment.