Skip to content

no-unused-vars highlights at wrong position #14324

@M393

Description

@M393

With no-unused-vars enabled eslint highlights the last use of the variable. If it is used left and right of an assignment it should mark the one on the left.

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

Instead of this:

let x = [];
x = x.concat(x);
             ^

What did you expect to happen?
It should be this:

let x = [];
x = x.concat(x);
^

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

Steps to reproduce this issue:

  1. eslint demo

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    acceptedThere is consensus among the team that this change meets the criteria for inclusionarchived due to ageThis issue has been archived; please open a new issue for any further discussionbugESLint is working incorrectlyrepro:yesIssues with a reproducible example

    Type

    No type

    Projects

    Status

    Complete

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions