-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Fix ESLint v10 RuleContext API removal (follow-up to #3972) #3979
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
ljharb
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we'll need regression tests - it might be as simple as adding eslint 10 to the GHA matrix.
f987ffa to
a7b967b
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #3979 +/- ##
==========================================
- Coverage 97.85% 97.69% -0.17%
==========================================
Files 136 133 -3
Lines 10008 10000 -8
Branches 3717 3718 +1
==========================================
- Hits 9793 9769 -24
- Misses 215 231 +16 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Run published type checks against both ESLint 7 and 10. Use per-matrix dependency setup and exclude unsupported TS combinations for ESLint 10.
- route filename/sourceCode access through util helpers for ESLint 7/10 compatibility - remove deprecated meta.docs.category to satisfy current RuleModule typings - augment @eslint/core SettingsConfig with react settings shape
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
| } | ||
|
|
||
| function getFilename(context) { | ||
| return context.filename || context.getFilename(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It may be better to follow the pattern above, to only call the method if it exists
| return context.filename || context.getFilename(); | |
| return context.getFilename ? context.getFilename : filename; |
| function resolveBasedir(contextOrFilename) { | ||
| if (contextOrFilename) { | ||
| const filename = typeof contextOrFilename === 'string' ? contextOrFilename : contextOrFilename.getFilename(); | ||
| const filename = typeof contextOrFilename === 'string' ? contextOrFilename : contextOrFilename.filename || contextOrFilename.getFilename(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| const filename = typeof contextOrFilename === 'string' ? contextOrFilename : contextOrFilename.filename || contextOrFilename.getFilename(); | |
| const filename = typeof contextOrFilename === 'string' ? contextOrFilename : getFilename(contextOrFilename); |
This PR follows up on the feedback in the comments of #3972 and incorporates the requested changes.
I think this PR will fix #3977.