Skip to content
This repository has been archived by the owner on Aug 31, 2023. It is now read-only.

🐛 Incorrect noUnusedVariables error #4688

Closed
1 task done
public opened this issue Jul 11, 2023 · 1 comment
Closed
1 task done

🐛 Incorrect noUnusedVariables error #4688

public opened this issue Jul 11, 2023 · 1 comment
Labels
S-To triage Status: user report of a possible bug that needs to be triaged

Comments

@public
Copy link

public commented Jul 11, 2023

Environment information

Nightly & Rome Playground.

What happened?

This code produces an incorrect error on L4.

const unused = 1;
declare const declareUnused;
export const ok = 1;
export declare const ohno;
main.tsx:4:22 [lint/correctness/noUnusedVariables](https://docs.rome.tools/lint/rules/noUnusedVariables)  FIXABLE  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

  ⚠ This variable is unused.
  
    2 │ declare const declareUnused;
    3 │ export const ok = 1;
  > 4 │ export declare const ohno;
      │                      ^^^^

Expected result

There are possibly 2 problems here?

  1. L2 should arguably be an error because none of the following code depends on the declaration. I am don't have a strong opinion on this, declarations are not variables so maybe they should just not be in scope at all for this rule?
  2. L4 should definitely not be an error because it is an export. The current behaviour seems obviously wrong to me.

Code of Conduct

  • I agree to follow Rome's Code of Conduct
@public public added the S-To triage Status: user report of a possible bug that needs to be triaged label Jul 11, 2023
@public
Copy link
Author

public commented Jul 17, 2023

Looks like this is fixed. Thanks @nissy-dev :D

@public public closed this as completed Jul 17, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
S-To triage Status: user report of a possible bug that needs to be triaged
Projects
None yet
Development

No branches or pull requests

1 participant