Skip to content

ESLint plugin breaks when using eslint-plugin-react-hooks #2129

@simarmol

Description

@simarmol

Please see facebook/react#35897 as well where I posted originally, but I don't know if the issue is with this extension or the rule. The eslint-plugin-react-hooks rules work fine with the ESLint CLI.

Link to repro
simarmol/eslint-plugin-react-hooks-repro

Repro steps
The latest version of eslint-plugin-react-hooks does not show a code/identity for any errors in the VS Code Problem Pane, only the codes. This can be seen by having an error in a file for eslint-plugin-react-hooks, having the ESLint extension installed and opening a file with issues, then viewing the problem pane,

In the repro repo I have linked I have copied the examples of the violations from the react docs into one file and set up a basic eslint config.

  • Open the repo with VS Code
  • Install the ESLint extension
  • run yarn or package manager of choice to install dependencies
  • Open index.jsx
  • Open problem view in VS Code (In the Command Palette :Focus on Problems View)
  • See 1 ESlint error in the pane - with the Code field missing
  • Run npx eslint
  • See ✖ 36 problems (31 errors, 5 warnings)

The issue I originally wanted to report was the missing 'Code' field for most of the hooks rules in the VS Code pane, but when I made the repro I found it barely seems to work at all with the hooks ruleset, and indeed they seem to break linting functionality for other rules in the same file in VS Code's ESLint extension.

To show that it is the hooks plugin causing the issue:

  • Comment out line 10 in the repro's eslint.config.mjs
  • Open the problem pane
  • See the React/* plugin rule violations working properly
  • I'm unsure if this is an issue with the formatting of the rule output on your end or a bug with the ESLint extension.

Metadata

Metadata

Assignees

No one assigned

    Labels

    info-neededIssue requires more information from poster

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions