fix: add ESLint 10 compatibility by replacing deprecated context.getSourceCode()#2379
fix: add ESLint 10 compatibility by replacing deprecated context.getSourceCode()#2379aklkv wants to merge 8 commits intoember-cli:masterfrom
context.getSourceCode()#2379Conversation
|
The eslint matrix failed. Tyty for doing this! |
|
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 |
|
@aklkv This one is blocking me to. Is it able to move forward? |
|
@saracope I will check situation upstream |
0343d31 to
aebd4f2
Compare
aebd4f2 to
5fad65a
Compare
- Update context.getFilename() to context.filename ?? context.getFilename() across 18 rule files and lib/utils/ember.js - Add error property normalization in eslint-compat.js for ESLint 10's stricter test assertions - Add isESLint10OrLater detection for version-specific handling
ESLint 10 Compatibility UpdateSummaryAdded ESLint 10 compatibility layer to the test infrastructure and updated rules to handle API changes. Changes Made
Test Results
ESLint 10 BlockerThe remaining ESLint 10 failures are caused by With However, Babel 8 requires ESLint ≥9 as a peer dependency, so we can't use it without dropping ESLint 8 support. Related Babel Issues/PRs
Next Steps
@NullVoxPopuli thoughts? |
we can widen the range on @babel/eslint-parser and test against both supportetd and upcoming. as in -- when testing eslint 10, we should also use @babel/eslint-parser 8 |
.github/workflows/ci.yml
Outdated
| # Update .babelrc for Babel 8 | ||
| echo '{"plugins": ["@babel/plugin-transform-class-properties", ["@babel/plugin-proposal-decorators", {"version": "2023-11"}]]}' > .babelrc | ||
| # Update .babelrc for Babel 8 with legacy decorators | ||
| echo '{"plugins": [["@babel/plugin-proposal-decorators", {"version": "legacy"}], "@babel/plugin-transform-class-properties"]}' > .babelrc |
There was a problem hiding this comment.
I wonder if it better to specify decorator-transforms here?
these babel plugins are generally considered bad for the legacy transform 🤔
Summary
Adds ESLint 10 compatibility by replacing the deprecated
context.getSourceCode()API with the backward-compatible patterncontext.sourceCode ?? context.getSourceCode().Fixes #2378
Changes
context.getSourceCode()across 35 files to use the backward-compatible patternDetails
ESLint 10 removed the deprecated
context.getSourceCode()method. The new pattern works with ESLint 8, 9, and 10: