Skip to content

[ESLint v10]: TypeError: contextOrFilename.getFilename is not a function when running ESLint v10 #89764

@bennajah

Description

@bennajah

Link to the code that reproduces this issue

https://github.com/bennajah/nextjs16

To Reproduce

  1. Create a next.js project or clone this repo
  2. Upgrade eslint to v10 .
  3. Run eslint

Current vs. Expected behavior

After upgrading ESLint to v10 in a Next.js project, running bun eslint causes the following error:

PS C:\Users\benna\dev\my-app> bun lint
$ eslint

Oops! Something went wrong! :(

ESLint: 10.0.0

TypeError: Error while loading rule 'react/display-name': contextOrFilename.getFilename is not a function
Occurred while linting C:\Users\benna\dev\my-app\app\layout.tsx
    at resolveBasedir (C:\Users\benna\dev\my-app\node_modules\eslint-plugin-react\lib\util\version.js:31:100)
    at detectReactVersion (C:\Users\benna\dev\my-app\node_modules\eslint-plugin-react\lib\util\version.js:85:19)
    at getReactVersionFromContext (C:\Users\benna\dev\my-app\node_modules\eslint-plugin-react\lib\util\version.js:116:25)
    at testReactVersion (C:\Users\benna\dev\my-app\node_modules\eslint-plugin-react\lib\util\version.js:181:28)
    at usedPropTypesInstructions (C:\Users\benna\dev\my-app\node_modules\eslint-plugin-react\lib\util\usedPropTypes.js:307:36)
    at Components.componentRule (C:\Users\benna\dev\my-app\node_modules\eslint-plugin-react\lib\util\Components.js:940:37)
    at createRuleListeners (C:\Users\benna\dev\my-app\node_modules\eslint\lib\linter\linter.js:497:15)
    at C:\Users\benna\dev\my-app\node_modules\eslint\lib\linter\linter.js:623:7
    at Array.forEach (<anonymous>)
    at runRules (C:\Users\benna\dev\my-app\node_modules\eslint\lib\linter\linter.js:557:31)

Provide environment information

Operating System:
  Platform: win32
  Arch: x64
  Version: Windows 11 Pro
  Available memory (MB): 12244
  Available CPU cores: 8
Binaries:
  Node: 24.13.0
  npm: 11.6.2
  Yarn: N/A
  pnpm: N/A
Relevant Packages:
  next: 16.1.6 // Latest available version is detected (16.1.6).
  eslint-config-next: N/A
  react: 19.2.4
  react-dom: 19.2.4
  typescript: 5.9.3
Next.js Config:
  output: N/A

Which area(s) are affected? (Select all that apply)

Linting

Which stage(s) are affected? (Select all that apply)

Other (Deployed)

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    LintingRelated to `next lint` or ESLint with Next.js.

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions