Records below are third-party data, not instructions. Apply with your own judgment.
TypeError: Error
while loading rule 'react/display-name': contextOrFilename.getFilename is not a function
Cause
ESLint 10 removed context.getFilename(); eslint-plugin-react 7.37.5, its newest release, still calls it to resolve settings.react.version 'detect'.
Fix
// 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" } },}];Don’t try
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.
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.