Description
eslint(no-unused-vars) produces false positives for dotted/nested TypeScript namespace declarations like export namespace editor.multiplayer { ... }.
The rule incorrectly reports the second (and subsequent) segments of a dotted namespace name as "declared but never used", even though they are part of the namespace declaration syntax, not standalone variable declarations.
Reproduction
// file: example.ts
export namespace editor.multiplayer {
export type AwarenessPayload = {
cursor: { x: number; y: number } | null;
};
}
export namespace editor.api {
export type Request = { url: string };
}
export namespace editor.internal.export_settings {
export type Format = "png" | "svg";
}
Running oxlint on this file produces:
× eslint(no-unused-vars): Variable 'multiplayer' is declared but never used.
╭─[example.ts:2:25]
1 │
2 │ export namespace editor.multiplayer {
· ─────┬─────
· ╰── 'multiplayer' is declared here
3 │ export type AwarenessPayload = {
╰────
× eslint(no-unused-vars): Variable 'api' is declared but never used.
╭─[example.ts:8:25]
7 │
8 │ export namespace editor.api {
· ─┬─
· ╰── 'api' is declared here
9 │ export type Request = { url: string };
╰────
× eslint(no-unused-vars): Variable 'internal' is declared but never used.
╭─[example.ts:12:25]
11 │
12 │ export namespace editor.internal.export_settings {
· ────┬───
· ╰── 'internal' is declared here
13 │ export type Format = "png" | "svg";
╰────
Expected behavior
No diagnostic should be emitted for multiplayer, api, or internal — they are segments of the namespace path, not standalone variable declarations.
ESLint's @typescript-eslint/no-unused-vars does not flag these.
Environment
- oxlint v1.60.0
- macOS, Node 24 LTS
Description
eslint(no-unused-vars)produces false positives for dotted/nested TypeScript namespace declarations likeexport namespace editor.multiplayer { ... }.The rule incorrectly reports the second (and subsequent) segments of a dotted namespace name as "declared but never used", even though they are part of the namespace declaration syntax, not standalone variable declarations.
Reproduction
Running
oxlinton this file produces:Expected behavior
No diagnostic should be emitted for
multiplayer,api, orinternal— they are segments of the namespace path, not standalone variable declarations.ESLint's
@typescript-eslint/no-unused-varsdoes not flag these.Environment