Skip to content

fix: add ESLint 10 compatibility by replacing deprecated context.getSourceCode()#2379

Open
aklkv wants to merge 1 commit intoember-cli:masterfrom
aklkv:fix/eslint-10-compat
Open

fix: add ESLint 10 compatibility by replacing deprecated context.getSourceCode()#2379
aklkv wants to merge 1 commit intoember-cli:masterfrom
aklkv:fix/eslint-10-compat

Conversation

@aklkv
Copy link

@aklkv aklkv commented Feb 8, 2026

Summary

Adds ESLint 10 compatibility by replacing the deprecated context.getSourceCode() API with the backward-compatible pattern context.sourceCode ?? context.getSourceCode().

Fixes #2378

Changes

  • Updated 60 occurrences of context.getSourceCode() across 35 files to use the backward-compatible pattern
  • Added CI job to test against ESLint 8, 9, and 10

Details

ESLint 10 removed the deprecated context.getSourceCode() method. The new pattern works with ESLint 8, 9, and 10:

// Before
const sourceCode = context.getSourceCode();

// After
const sourceCode = context.sourceCode ?? context.getSourceCode();

@NullVoxPopuli
Copy link
Contributor

The eslint matrix failed. Tyty for doing this!

@aklkv
Copy link
Author

aklkv commented Feb 8, 2026

I will circle back to it once typescript-eslint/typescript-eslint#11952 is resolved as it doesn't even seem to be feasible to upgrade just yet

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ESLint 10 compatibility: context.getSourceCode() is removed

2 participants

Comments