Skip to content
This repository has been archived by the owner on Aug 31, 2023. It is now read-only.

🐛 lint rule noUnusedVariables is reported when variable is being referenced inside an inner function like setInterval #4245

Open
1 task done
renzhentaxi opened this issue Feb 26, 2023 · 0 comments · Fixed by biomejs/biome#256
Labels
A-Linter Area: linter S-Bug: confirmed Status: report has been confirmed as a valid bug

Comments

@renzhentaxi
Copy link

renzhentaxi commented Feb 26, 2023

Environment information

contains sensitive information.

What happened?

If you create a variable and use it inside a callback within the "initializer". The linter reports the variable as unused.

E.g.

const tid = setInterval(() => {
  clearInterval(tid);
});

Here is a playground snippet

Expected result

In this case, the variable should not be considered as unused.

Code of Conduct

  • I agree to follow Rome's Code of Conduct
@renzhentaxi renzhentaxi added the S-To triage Status: user report of a possible bug that needs to be triaged label Feb 26, 2023
@ematipico ematipico added S-Bug: confirmed Status: report has been confirmed as a valid bug A-Linter Area: linter and removed S-To triage Status: user report of a possible bug that needs to be triaged labels Feb 27, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
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