Skip to content

Bug: [no-unused-vars] "vars": "local" not working #20376

@zacaj

Description

@zacaj

Environment

https://eslint.org/play with default settings

What parser are you using?

Default (Espree)

What did you do?

/*eslint no-unused-vars: ["error", { "vars": "local" }]*/

let globalVar = "b";

function globalFunc() {
  const localVar= 3;
}
Image

What did you expect to happen?

globalVar and globalFunc shouldn't trigger errors

What actually happened?

globalVar and globalFunc trigger errors regardless of vars setting

Link to Minimal Reproducible Example

https://eslint.org/play/#eyJ0ZXh0IjoiLyplc2xpbnQgbm8tdW51c2VkLXZhcnM6IFtcImVycm9yXCIsIHsgXCJ2YXJzXCI6IFwibG9jYWxcIiB9XSovXG5cbmxldCBnbG9iYWxWYXIgPSBcImJcIjtcblxuZnVuY3Rpb24gZ2xvYmFsRnVuYygpIHtcbiAgY29uc3QgbG9jYWxWYXI9IDM7XG59Iiwib3B0aW9ucyI6eyJydWxlcyI6e30sImxhbmd1YWdlT3B0aW9ucyI6eyJwYXJzZXJPcHRpb25zIjp7ImVjbWFGZWF0dXJlcyI6e319fX19

Participation

  • I am willing to submit a pull request for this issue.

Additional comments

off topic but thank you for having a "I am willing to submit a pull request for this issue." checkbox! wish every project had that

Metadata

Metadata

Assignees

No one assigned

    Labels

    works as intendedThe behavior described in this issue is working correctly

    Type

    No type

    Projects

    Status

    Complete

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions