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

linter: no-unused-vars false positives when variable and type have same name #8236

Open
EYHN opened this issue Jan 3, 2025 · 0 comments
Open
Labels
A-linter Area - Linter C-bug Category - Bug

Comments

@EYHN
Copy link
Contributor

EYHN commented Jan 3, 2025

What version of Oxlint are you using?

0.15.5

What command did you run?

oxlint

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

without config file

What happened?

with typescript file:

// bad.ts
const a = {
  hello: "world",
};

export type a = typeof a;

it shows error when i run oxlint

  × eslint(no-unused-vars): Type alias 'a' is declared but never used. Unused type aliases should start with a '_'.
   ╭─[src\bad.ts:1:7]
 1 │ const a = {
   ·       ┬
   ·       ╰── 'a' is declared here
 2 │   hello: "world",
   ╰────
  help: Consider removing this declaration.

But when I rewrite type a to type b

// good.ts
const a = {
  hello: "world",
};

export type b = typeof a;

no error will show

Found 0 warnings and 0 errors.

It seems that oxlint cannot correctly handle the situation where the variable and type with the same name. but this code can pass in eslint. so I think it's a bug

@EYHN EYHN added A-linter Area - Linter C-bug Category - Bug labels Jan 3, 2025
@EYHN EYHN changed the title linter: linter: no-unused-vars false positives when variable and type have same name Jan 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-linter Area - Linter C-bug Category - Bug
Projects
None yet
Development

No branches or pull requests

1 participant