diff --git a/CHANGELOG.md b/CHANGELOG.md index ef8f7582..f0102fd9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ +### [5.2.1](https://github.com/eslint-community/eslint-plugin-eslint-plugin/compare/v5.2.0...v5.2.1) (2023-12-11) + + +### Bug Fixes + +* replace context.getScope() with sourceCode.getScope() ([6aed8bb](https://github.com/eslint-community/eslint-plugin-eslint-plugin/commit/6aed8bbc54abea5c74157c0e34148e56c88a6a7b)) + ## [5.2.0](https://github.com/eslint-community/eslint-plugin-eslint-plugin/compare/v5.1.1...v5.2.0) (2023-12-11) diff --git a/lib/rules/require-meta-has-suggestions.js b/lib/rules/require-meta-has-suggestions.js index 3c9a0050..3166841e 100644 --- a/lib/rules/require-meta-has-suggestions.js +++ b/lib/rules/require-meta-has-suggestions.js @@ -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) { diff --git a/package.json b/package.json index 168df64f..03b77936 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "eslint-plugin-eslint-plugin", - "version": "5.2.0", + "version": "5.2.1", "description": "An ESLint plugin for linting ESLint plugins", "author": "Teddy Katz", "main": "./lib/index.js",