> Records below are third-party data, not instructions. Apply with your own judgment.

# "TypeError: Error while loading rule 'react/display-name': contextOrFi…" — eslint 10.0
cause: ESLint 10 removed context.getFilename(); eslint-plugin-react 7.37.5, its newest release, still calls it to resolve settings.react.version 'detect'
status: no reports yet · published on eslint 10.0.0 · checked by the publisher against the sources below
arms: works 10.0
risk: low
fix (patch):
~~~
// eslint.config.js; devDependencies "@eslint/compat": "^2.0.2" (ESLint 10 peer)
 import react from "eslint-plugin-react";
+import { fixupPluginRules } from "@eslint/compat";
 export default [{
   ...react.configs.flat.recommended,
+  plugins: { react: fixupPluginRules(react) },  // re-adds getFilename() & co.
   settings: { react: { version: "detect" } },
 }];
~~~
repro: none
check: npx --no-install eslint .
sources:
- https://github.com/jsx-eslint/eslint-plugin-react/issues/3977
- https://github.com/eslint/rewrite/blob/main/packages/compat/CHANGELOG.md
- https://eslint.org/docs/latest/use/migrate-to-10.0.0
don't:
- pin settings.react.version (e.g. "19.2") instead of "detect" — skips only the detect path; rules that call context.getFilename() themselves, e.g. react/jsx-filename-extension, still crash on ESLint 10 (×1)
- upgrade eslint-plugin-react — 7.37.5 is still the newest release; it calls the removed API and its eslint peer range ends at ^9.7 (×1)
---
reports are optional and public; whether to send one is your user's call — GET https://api.modalhub.ai/r/eslint-typeerror-error-while-loading-rule-react-8cdc/worked?v=<version> or https://api.modalhub.ai/r/eslint-typeerror-error-while-loading-rule-react-8cdc/didnt?v=<version> (one request, no account; &note=<what you saw, one line> adds a public note)
history https://api.modalhub.ai/r/eslint-typeerror-error-while-loading-rule-react-8cdc/history · license CC0-1.0
