Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 When using React hook prefix, exhaustive deps breaks #578

Closed
1 task done
crutchcorn opened this issue Oct 22, 2023 · 2 comments · Fixed by #996
Closed
1 task done

🐛 When using React hook prefix, exhaustive deps breaks #578

crutchcorn opened this issue Oct 22, 2023 · 2 comments · Fixed by #996
Labels
A-Linter Area: linter S-Bug-confirmed Status: report has been confirmed as a valid bug

Comments

@crutchcorn
Copy link
Contributor

crutchcorn commented Oct 22, 2023

Environment information

↳  pnpm biome rage
CLI:
  Version:                      1.3.1
  Color support:                true

Platform:
  CPU Architecture:             x86_64
  OS:                           windows

Environment:
  BIOME_LOG_DIR:                unset
  NO_COLOR:                     unset
  TERM:                         unset
  JS_RUNTIME_VERSION:           "v18.16.0"
  JS_RUNTIME_NAME:              "node"
  NODE_PACKAGE_MANAGER:         "pnpm/8.9.2"

Biome Configuration:
  Status:                       Loaded successfully
  Formatter disabled:           false
  Linter disabled:              false
  Organize imports disabled:    false
  VCS disabled:                 true

Workspace:
  Open Documents:               0

What happened?

While the following works as-expected:

import {useState, useEffect} from "react";

const Comp = () => {
  const [count, setCount] = useState(0)

  useEffect(() => {
    setCount(v => v+1);
  }, [])
  
  return null;
}

Aliasing React like so:

import * as React from "react";

const Comp = () => {
  const [count, setCount] = React.useState(0)

  React.useEffect(() => {
    setCount(v => v+1);
  }, [])
  
  return null;
}

Forces the following error to be thrown:

This hook do not specify all of its dependencies.

Playground link

Expected result

No errors to be thrown in the code sample listed above

Code of Conduct

  • I agree to follow Biome's Code of Conduct
@ematipico
Copy link
Member

Can you provide an example with the Eslint rule, please? This rule should follow what the original rule does.

@ematipico ematipico added the S-Needs response Status: await response from OP label Oct 22, 2023
@crutchcorn
Copy link
Contributor Author

Sure @ematipico, here you are:

https://stackblitz.com/edit/node-hcjbcn?file=src%2Findex.js,.eslintrc.js

This has ESLint setup and allows you to run npm run lint in the terminal to verify the ESLint functionality

@ematipico ematipico added A-Linter Area: linter S-Bug-confirmed Status: report has been confirmed as a valid bug and removed S-Needs response Status: await response from OP labels Oct 23, 2023
XiNiHa added a commit to XiNiHa/biome that referenced this issue Dec 1, 2023
XiNiHa added a commit to XiNiHa/biome that referenced this issue Dec 1, 2023
XiNiHa added a commit to XiNiHa/biome that referenced this issue Dec 1, 2023
XiNiHa added a commit to XiNiHa/biome that referenced this issue Dec 1, 2023
XiNiHa added a commit to XiNiHa/biome that referenced this issue Dec 1, 2023
XiNiHa added a commit to XiNiHa/biome that referenced this issue Dec 2, 2023
XiNiHa added a commit to XiNiHa/biome that referenced this issue Dec 2, 2023
XiNiHa added a commit to XiNiHa/biome that referenced this issue Dec 2, 2023
XiNiHa added a commit to XiNiHa/biome that referenced this issue Dec 2, 2023
XiNiHa added a commit to XiNiHa/biome that referenced this issue Dec 2, 2023
XiNiHa added a commit to XiNiHa/biome that referenced this issue Dec 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Linter Area: linter S-Bug-confirmed Status: report has been confirmed as a valid bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants