ESLint "context.getScope is not a function" - Version Mismatch in CI
A plugin called context.getScope() (or a similar context method) that does not exist on the ESLint version you are running. ESLint moved several context APIs across majors, so a plugin built for a different ESLint version crashes with a TypeError.
What this error means
ESLint crashes mid-run with TypeError: context.getScope is not a function (or getAncestors/getDeclaredVariables), with a stack pointing into a plugin's rule. It is a version mismatch, not flake.
TypeError: context.getScope is not a function
at create (/app/node_modules/eslint-plugin-foo/lib/rules/bar.js:14:31)
at Object.create (/app/node_modules/eslint/lib/linter/linter.js:...)Common causes
Plugin built for a different ESLint major
ESLint 9 moved context.getScope() and related methods onto sourceCode. A plugin written for ESLint 8 (or vice versa) calls the old/new API that does not exist on the installed version.
Mismatched/duplicate ESLint versions
A tool pins one ESLint while a plugin resolves against another, so the plugin runs against a context from an incompatible ESLint copy.
How to fix it
Align the plugin with your ESLint major
Install the plugin release that supports your ESLint version (and dedupe ESLint).
npm install eslint-plugin-foo@latest
npm ls eslint # confirm a single, matching eslint versionPin compatible versions together
- Upgrade ESLint and its plugins as a set, not piecemeal.
- Check each plugin's supported ESLint range before bumping ESLint.
- Deduplicate ESLint so plugins run against one version (
npm dedupe).
How to prevent it
- Upgrade ESLint and plugins together, checking supported ranges.
- Keep a single ESLint version in the tree (
npm ls eslint). - Pin majors so an ESLint upgrade is a deliberate, tested change.