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

🐛 Incorrect noUnusedVariables error #4688

@public

Description

@public

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    S-To triageStatus: user report of a possible bug that needs to be triaged

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions