When using ESLint v9.0.0 or later with a plugin, you may see one of the following errors:
TypeError: context.getScope is not a function
TypeError: context.getAncestors is not a function
TypeError: context.markVariableAsUsed is not a function
TypeError: context.getDeclaredVariables is not a function
ESLint v9.0.0 introduces changes to the rules API that plugin rules use, which included moving some methods from the context object to the sourceCode object. If you’re seeing one of these errors, that means the plugin has not yet been updated to use the new rules API.
Common resolutions for this issue include:
For more information, see:
© OpenJS Foundation and other contributors
Licensed under the MIT License.
https://eslint.org/docs/latest/use/troubleshooting/v9-rule-api-changes