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

feat(lint): implement duplicate dependency error #2991

Conversation

tunamaguro
Copy link
Contributor

Summary

Disallow duplicate dependencies in hooks.
close #2956

Test Plan

Invalid

import { useCallback } from "react";

function Component1({ a }) {
    const handle = useCallback(() => {
      console.log(a);
    }, [a, a]);
}

function Component2() {
    const [local,SetLocal] = useState(0);
    const handle = useCallback(() => {
      console.log(local);
    }, [local, local]);
}

@github-actions github-actions bot added A-Linter Area: linter L-JavaScript Language: JavaScript and super languages labels May 26, 2024
Copy link

codspeed-hq bot commented May 26, 2024

CodSpeed Performance Report

Merging #2991 will not alter performance

Comparing tunamaguro:feat/useExhaustiveDependencies-error-duplicate-dependency (bf4881b) with main (13811df)

Summary

✅ 92 untouched benchmarks

Copy link
Contributor

@arendjr arendjr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, nice work!

Would you like to add a CHANGELOG entry?

@tunamaguro
Copy link
Contributor Author

Thank you for the review!
I forgot about the CHANGELOG addition.
I'll get on it right away.

@tunamaguro tunamaguro force-pushed the feat/useExhaustiveDependencies-error-duplicate-dependency branch from 97fea5a to 0bc38f1 Compare May 30, 2024 11:40
@github-actions github-actions bot added the A-Changelog Area: changelog label May 30, 2024
@tunamaguro tunamaguro force-pushed the feat/useExhaustiveDependencies-error-duplicate-dependency branch from 0bc38f1 to 2679d7a Compare May 30, 2024 11:48
@tunamaguro tunamaguro force-pushed the feat/useExhaustiveDependencies-error-duplicate-dependency branch from 2679d7a to bf4881b Compare May 30, 2024 11:49
@arendjr arendjr merged commit 9e4feb6 into biomejs:main May 30, 2024
12 checks passed
@arendjr
Copy link
Contributor

arendjr commented May 30, 2024

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Changelog Area: changelog A-Linter Area: linter L-JavaScript Language: JavaScript and super languages
Projects
None yet
Development

Successfully merging this pull request may close these issues.

💅 useExhaustiveDependencies ignores duplicate dependencies
2 participants