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 positive for TSTypeAliasDeclaration with ExportDefaultDeclaration #7809

Closed
Sysix opened this issue Dec 11, 2024 · 1 comment · Fixed by #7813
Closed
Assignees
Labels
A-linter Area - Linter A-semantic Area - Semantic C-bug Category - Bug

Comments

@Sysix
Copy link
Collaborator

Sysix commented Dec 11, 2024

What version of Oxlint are you using?

0.15.0

What command did you run?

oxlint

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

{
  "plugins": ["unicorn", "typescript", "oxc"],
  "categories": {
    "correctness": "error",
    "suspicious": "warn"
  },
  "rules": {
    "no-unused-vars": "error"
  }
}

What happened?

Setup:

/// types.ts:
type ABC = Record<string, unknown>;

export default ABC;

/// index.ts
import Types from './types.ts';

const xxx = (): ABC => ({}};

Result

  × eslint(no-unused-vars): Type alias 'ABC' is declared but never used.
    ╭─[src/build-from-oxlint-config/types.ts:21:6]
 20 │ 
 21 │ type ABC = Record<string, unknown>;
    ·      ─┬─
    ·       ╰── 'ABC' is declared here
 22 │ 
    ╰────
  help: Consider removing this declaration.

Expected

No Error

@Sysix Sysix added C-bug Category - Bug A-linter Area - Linter labels Dec 11, 2024
@Dunqing Dunqing added the A-semantic Area - Semantic label Dec 12, 2024
@Dunqing Dunqing self-assigned this Dec 12, 2024
Dunqing added a commit that referenced this issue Dec 12, 2024
…ype alias binding (#7813)

Fixes: #7809

`ExportNamedDecalration` and `ExportDefaultDeclaration` can reference both type binding and value, so we need to make sure the `ReferenceFlags` is `Read | Type`
Dunqing added a commit that referenced this issue Dec 12, 2024
…ype alias binding (#7813)

Fixes: #7809

`ExportNamedDecalration` and `ExportDefaultDeclaration` can reference both type binding and value, so we need to make sure the `ReferenceFlags` is `Read | Type`
@Sysix
Copy link
Collaborator Author

Sysix commented Dec 12, 2024

closing because of the implemented test in the pr. thanks ❤️

@Sysix Sysix closed this as completed Dec 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-linter Area - Linter A-semantic Area - Semantic C-bug Category - Bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants