question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`no-unused-vars` false negative with comma operator

See original GitHub issue

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 https://github.com/eslint/eslint/issues/14325

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

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
snitin315commented, Aug 6, 2021

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

1reaction
nzakascommented, Aug 5, 2021

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

Read more comments on GitHub >

github_iconTop Results From Across the Web

typescript-eslint/no-unused-vars false positive in type ...
I am on version 4.22.1 and am still getting the warnings. Is there any additional configurations required to disable linting on function ...
Read more >
ESLint v7.27.0 released - Pluggable JavaScript Linter
A pluggable and configurable linter tool for identifying and reporting on patterns in JavaScript. Maintain your code quality with ease.
Read more >
S878 Unexpected use of comma operator - Sonar Community
Use of comma operator is tolerated : If the expression sequence is explicitly wrapped in parentheses.
Read more >
eslint/CHANGELOG.md - UNPKG
421, * d4557a6 Docs: disallow use of the comma operator using ... 881, * 9f540fd2 Update: no-unused-vars false negative about destructuring (fixes #8442) ......
Read more >
tslint-eslint-rules - npm
Description: Ensure that the results of typeof are compared against a ... "props": false ... Description: disallow use of the comma operator.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found