Skip to content

Bug: ESLint: Cannot read property 'type' of undefined Occurred while linting #21342

Closed
@LeonardoRick

Description

@LeonardoRick

React version:
17.0.2

eslint-plugin-react-hooks version:
4.2.0

Steps To Reproduce

  1. import useEfect from react library
  2. type useEfect(

Link to code example:
https://github.com/LeonardoRick/podcastr

The current behavior

image

output:

[Error - 16:40:28] ESLint stack trace:
[Error - 16:40:28] TypeError: Cannot read property 'type' of undefined
Occurred while linting D:\GIT\podcastr\src\Components\Player\index.tsx:16
    at visitCallExpression (D:\GIT\podcastr\node_modules\eslint-plugin-react-hooks\cjs\eslint-plugin-react-hooks.development.js:1736:24)
    at D:\GIT\podcastr\node_modules\eslint\lib\linter\safe-emitter.js:45:58
    at Array.forEach (<anonymous>)
    at Object.emit (D:\GIT\podcastr\node_modules\eslint\lib\linter\safe-emitter.js:45:38)
    at NodeEventGenerator.applySelector (D:\GIT\podcastr\node_modules\eslint\lib\linter\node-event-generator.js:256:26)
    at NodeEventGenerator.applySelectors (D:\GIT\podcastr\node_modules\eslint\lib\linter\node-event-generator.js:285:22)
    at NodeEventGenerator.enterNode (D:\GIT\podcastr\node_modules\eslint\lib\linter\node-event-generator.js:299:14)
    at CodePathAnalyzer.enterNode (D:\GIT\podcastr\node_modules\eslint\lib\linter\code-path-analysis\code-path-analyzer.js:711:23)
    at D:\GIT\podcastr\node_modules\eslint\lib\linter\linter.js:954:32
    at Array.forEach (<anonymous>)

error line:

      // eslint-plugin-react-hooks\cjs\eslint-plugin-react-hooks.development.js:1736:24:
      switch (callback.type) {

The expected behavior

No errors showing, since I'm currently typing the code

Metadata

Metadata

Assignees

No one assigned

    Labels

    Status: UnconfirmedA potential issue that we haven't yet confirmed as a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions