Skip to content

[eslint-plugin-react-hooks] Bug: ESLint crashes if there's a useEffect / useLayoutEffect invocation without any arguments. #20343

Closed
@latin-1

Description

@latin-1

eslint-plugin-react-hooks version: 4.2.0

Steps To Reproduce

I know it shouldn't exist in production code, but it's annoying while editing some files.

import React, { useEffect } from "react";

const App = () => {
  useEffect(); // <-
  return null;
};

export default App;

Link to code example: https://codesandbox.io/s/polished-sun-3wr27?file=/src/App.js

The current behavior

ESLint crashed.

TypeError: Cannot read property 'type' of undefined

The expected behavior

ESLint doesn't crash but reports an error instead.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions