Skip to content

[Bug]: context.getSource() is not a function (react-hooks/exhaustive-deps) #3887

@neoncube2

Description

@neoncube2

Is there an existing issue for this?

  • I have searched the existing issues and my issue is unique
  • My issue appears in the command-line and not only in the text editor

Description Overview

When running yarn eslint app/, I get this error:

Oops! Something went wrong! :(

ESLint: 9.20.1

TypeError: context.getSource is not a function
Occurred while linting C:\example\app\components\course\example.jsx:93
Rule: "react-hooks/exhaustive-deps"
    at visitFunctionWithDependencies (C:\example\.yarn\__virtual__\eslint-plugin-react-hooks-virtual-5f4daa2ead\0\cache\eslint-plugin-react-hooks-npm-4.6.0-b429fac07f-3c63134e05.zip\node_modules\eslint-plugin-react-hooks\cjs\eslint-plugin-react-hooks.development.js:1704:42)
    at visitCallExpression (C:\example\.yarn\__virtual__\eslint-plugin-react-hooks-virtual-5f4daa2ead\0\cache\eslint-plugin-react-hooks-npm-4.6.0-b429fac07f-3c63134e05.zip\node_modules\eslint-plugin-react-hooks\cjs\eslint-plugin-react-hooks.development.js:1759:11)
    at ruleErrorHandler (C:\example\.yarn\__virtual__\eslint-virtual-f7fc0c0de8\0\cache\eslint-npm-9.20.1-5c3419cdfc-b1d870135c.zip\node_modules\eslint\lib\linter\linter.js:1160:48)
    at C:\example\.yarn\__virtual__\eslint-virtual-f7fc0c0de8\0\cache\eslint-npm-9.20.1-5c3419cdfc-b1d870135c.zip\node_modules\eslint\lib\linter\safe-emitter.js:45:58
    at Array.forEach (<anonymous>)
    at Object.emit (C:\example\.yarn\__virtual__\eslint-virtual-f7fc0c0de8\0\cache\eslint-npm-9.20.1-5c3419cdfc-b1d870135c.zip\node_modules\eslint\lib\linter\safe-emitter.js:45:38)
    at NodeEventGenerator.applySelector (C:\example\.yarn\__virtual__\eslint-virtual-f7fc0c0de8\0\cache\eslint-npm-9.20.1-5c3419cdfc-b1d870135c.zip\node_modules\eslint\lib\linter\node-event-generator.js:297:26)
    at NodeEventGenerator.applySelectors (C:\example\.yarn\__virtual__\eslint-virtual-f7fc0c0de8\0\cache\eslint-npm-9.20.1-5c3419cdfc-b1d870135c.zip\node_modules\eslint\lib\linter\node-event-generator.js:326:22)
    at NodeEventGenerator.enterNode (C:\example\.yarn\__virtual__\eslint-virtual-f7fc0c0de8\0\cache\eslint-npm-9.20.1-5c3419cdfc-b1d870135c.zip\node_modules\eslint\lib\linter\node-event-generator.js:337:14)
    at runRules (C:\example\.yarn\__virtual__\eslint-virtual-f7fc0c0de8\0\cache\eslint-npm-9.20.1-5c3419cdfc-b1d870135c.zip\node_modules\eslint\lib\linter\linter.js:1204:40)

Oops! Something went wrong! :(

ESLint: 9.20.1

AbortError: The operation was aborted
    at checkAborted (node:fs:343:14)
    at Object.readFile (node:fs:381:7)
    at C:\example\.pnp.cjs:13313:19
    at new Promise (<anonymous>)
    at NodeFS.readFilePromise (C:\example\.pnp.cjs:13311:18)
    at makeCallPromise.async.subPath.subPath (C:\example\.pnp.cjs:14004:32)
    at ZipOpenFS.makeCallPromise (C:\example\.pnp.cjs:14122:20)
    at ZipOpenFS.readFilePromise (C:\example\.pnp.cjs:14003:17)
    at VirtualFS.readFilePromise (C:\example\.pnp.cjs:12921:24)
    at PosixFS.readFilePromise (C:\example\.pnp.cjs:12921:24)

Oops! Something went wrong! :(

ESLint: 9.20.1

AbortError: The operation was aborted
    at ReadFileContext.read (node:internal/fs/read/context:92:9)
    at FSReqCallback.readFileAfterStat [as oncomplete] (node:fs:338:11)

Let me know if there's anything I can do to help track this down :)

Expected Behavior

eslint-plugin-react version

v7.37.4

eslint version

v9.20.1

node version

v22.13.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions