Skip to content

linter: no-unused-vars false positive when assign variable to class properties #12652

@0x-jerry

Description

@0x-jerry

What version of Oxlint are you using?

latest

What command did you run?

online playground

What does your .oxlintrc.json config file look like?

{}

What happened?

Oxc Playground

ESLint Playground

let a = 0

class A {
  c = a++
}

new A()

oxlint report error, but ESLint not:

  ! eslint(no-unused-vars): Variable 'a' is assigned a value but never used.
  | Unused variables should start with a '_'.
   ,-[:1:5]
 1 | let a = 0
   :     |
   :     `-- 'a' is declared here
 2 | 
 3 | class A {
 4 |   c = a++
   :       |
   :       `-- it was last assigned here
 5 | }
   `----
  help: Did you mean to use this variable?

Metadata

Metadata

Assignees

Labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions