Update types and RuleContext deprecations#3972
Draft
tylermumford wants to merge 1 commit intojsx-eslint:masterfrom
Draft
Update types and RuleContext deprecations#3972tylermumford wants to merge 1 commit intojsx-eslint:masterfrom
tylermumford wants to merge 1 commit intojsx-eslint:masterfrom
Conversation
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
ljharb
requested changes
Jan 6, 2026
Member
ljharb
left a comment
There was a problem hiding this comment.
It'd be interesting to also add tests that run in eslint 10.
|
|
||
| create(context) { | ||
| const filename = context.getFilename(); | ||
| const filename = context.filename; |
Member
There was a problem hiding this comment.
it's probably safer to do this since we still support much older eslint versions?
Suggested change
| const filename = context.filename; | |
| const filename = context.filename || context.getFilename(); |
| function resolveBasedir(contextOrFilename) { | ||
| if (contextOrFilename) { | ||
| const filename = typeof contextOrFilename === 'string' ? contextOrFilename : contextOrFilename.getFilename(); | ||
| const filename = typeof contextOrFilename === 'string' ? contextOrFilename : contextOrFilename.filename; |
Member
There was a problem hiding this comment.
Suggested change
| const filename = typeof contextOrFilename === 'string' ? contextOrFilename : contextOrFilename.filename; | |
| const filename = typeof contextOrFilename === 'string' ? contextOrFilename : contextOrFilename.filename || contextOrFileName.getFilename(); |
| "@babel/plugin-syntax-function-bind": "^7.27.1", | ||
| "@babel/preset-react": "^7.27.1", | ||
| "@types/eslint": "=7.2.10", | ||
| "@types/eslint": "=8.56.12", |
Member
There was a problem hiding this comment.
we still support eslint 7 so i'm not sure we can upgrade the types - and if we do we'd use ^, not =
|
@tylermumford, are you still planning to work on this PR? Hitting the same error after upgrading from v9 to v10.0.0-rc.2. @ljharb's suggestions make sense – good for backwards compatibility. |
|
I've just hit this myself now 10.0 is out, and happy to help if needed. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
On
RuleContextobjects, use thefilenameproperty instead of the deprecatedgetFilename()method. That method was marked as deprecated in ESLint v8 and is removed in ESLint v10.Motivation
I'm preparing a company project for ESLint v10, and I get an error that
eslint-plugin-reactuses a method that doesn't exist on theRuleContextobject.(Hello, this is my first PR on this repo. I hope to be helpful and respectful.)