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.
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.
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.
| 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.
we still support eslint 7 so i'm not sure we can upgrade the types - and if we do we'd use ^, not =
There was a problem hiding this comment.
Bump major and drop eslint7 support?
|
@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. |
Adds a "Blocked upgrades" section to docs/ops/dependency-policy.md tracking the eslint 9 → 10 bump that was held back today. eslint-plugin-react@7.37.5 (latest) caps its eslint peer at ^9.7 and ESLint 10 removed the RuleContext API the plugin uses (upstream PRs jsx-eslint/eslint-plugin-react#3972 and #3979 open, no release). PR #68 was closed via @dependabot ignore this major version. A scheduled remote agent re-checks upstream monthly. Signed-off-by: Snowboard Bot <bot@example.com> Co-authored-by: Snowboard Bot <bot@example.com>
…#116) - eslint 9.35.0 -> 10.8.0, com eslint-plugin-react/jsx-a11y/import (via eslint-config-next) ainda a chamar métodos de RuleContext que o ESLint 10 removeu (context.getFilename() e afins — correção já proposta a montante em jsx-eslint/eslint-plugin-react#3972, mas ainda não publicada). Em vez de patch manual, uso o shim oficial @eslint/compat (fixupConfigRules) em eslint.config.mjs, que restaura esses métodos no context passado a cada regra — mesma solução que a própria ESLint recomenda para este cenário exato. Remover o wrapping quando eslint-config-next publicar uma versão já compatível. - overrides.brace-expansion = "5.0.8": com o eslint já na v10 (que passa a depender de minimatch@10, compatível com o novo formato de export do brace-expansion@5.x), o override deixa de partir o eslint-plugin-import como partia antes do bump — confirmado via `npm run lint` limpo e via tests/unit/xlsx-export.test.ts (a exportação Excel usa a mesma cadeia archiver/glob por baixo). `npm audit`: 0 vulnerabilidades (era 8, todas nesta mesma cadeia eslint/archiver, depois da NEX-165 e do bump do next/sharp/uuid anteriores).
|
I believe these changes are incorporated in #4022. Thanks for getting the ball rolling. |
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.)