-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Update types and RuleContext deprecations #3972
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?
Update types and RuleContext deprecations #3972
Conversation
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
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.
It'd be interesting to also add tests that run in eslint 10.
|
|
||
| create(context) { | ||
| const filename = context.getFilename(); | ||
| const filename = context.filename; |
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's probably safer to do this since we still support much older eslint versions?
| 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; |
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; | |
| 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", |
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 still support eslint 7 so i'm not sure we can upgrade the types - and if we do we'd use ^, not =
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.)