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

no-unused-vars false negative with comma operator #14866

Closed
snitin315 opened this issue Aug 2, 2021 · 6 comments · Fixed by #14928
Closed

no-unused-vars false negative with comma operator #14866

snitin315 opened this issue Aug 2, 2021 · 6 comments · Fixed by #14928
Labels
accepted There is consensus among the team that this change meets the criteria for inclusion archived due to age This issue has been archived; please open a new issue for any further discussion bug ESLint is working incorrectly repro:yes
Projects

Comments

@snitin315
Copy link
Contributor

Tell us about your environment

  • ESLint Version: 7.30.0
  • Node Version: v14.x
  • npm Version: v6.x
  • Operating System: MacOS

What parser (default, @babel/eslint-parser, @typescript-eslint/parser, etc.) are you using?
Default

Please show your full configuration:

Configuration
/*eslint no-unused-vars: "error"*/

What did you do? Please include the actual source code causing the issue, as well as the command that you used to run ESLint.

/*eslint no-unused-vars: "error"*/

var z = 0;
z=z+1, z=2;

var x = 0;
x++, x = 2;

var y = 0;
y = y+1;

What did you expect to happen?

no-unused-vars should report allx, y, and z as unused variables.

What actually happened? Please copy-paste the actual, raw output from ESLint.

no-unused-vars is reporting only x and y as unused variables.

Steps to reproduce this issue:

Online Demo

We probably missed addressing this case in #14325

Are you willing to submit a pull request to fix this bug?
Yes

@snitin315 snitin315 added bug ESLint is working incorrectly repro:needed labels Aug 2, 2021
@eslint-github-bot eslint-github-bot bot added this to Needs Triage in Triage Aug 2, 2021
@nzakas
Copy link
Member

nzakas commented Aug 2, 2021

Is this related to #14325?

@nzakas nzakas moved this from Needs Triage to Feedback Needed in Triage Aug 2, 2021
@snitin315
Copy link
Contributor Author

Is this related to #14325?

@nzakas It is similar to #14325, just x=x+1 instead of x++.

@nzakas
Copy link
Member

nzakas commented Aug 5, 2021

Got it.

@nzakas nzakas added the accepted There is consensus among the team that this change meets the criteria for inclusion label Aug 5, 2021
@nzakas nzakas moved this from Feedback Needed to Ready to Implement in Triage Aug 5, 2021
@nzakas
Copy link
Member

nzakas commented Aug 5, 2021

Since this is kind of a continuation of the previous issue, marking as accepted.

@ersachin3112
Copy link
Contributor

ersachin3112 commented Aug 6, 2021

can I work on this issue?

@snitin315
Copy link
Contributor Author

@ersachin3112 Sure, let us know if you need any help.

Triage automation moved this from Ready to Implement to Complete Aug 21, 2021
@eslint-github-bot eslint-github-bot bot locked and limited conversation to collaborators Feb 18, 2022
@eslint-github-bot eslint-github-bot bot added the archived due to age This issue has been archived; please open a new issue for any further discussion label Feb 18, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
accepted There is consensus among the team that this change meets the criteria for inclusion archived due to age This issue has been archived; please open a new issue for any further discussion bug ESLint is working incorrectly repro:yes
Projects
Archived in project
Triage
Complete
Development

Successfully merging a pull request may close this issue.

3 participants