SKY-U008 · Dead code
Unused TypeScript namespace member
Low
A variable, type or interface exported from an export namespace block that no file reads. Other members of the same namespace are used, so the namespace itself is live.
- Languages
- TypeScript
- Turned on by
skylos .(every scan)- Quality gate
- counted toward the gate limits (full and diff scans). Reported in unused_variables with its own SKY-U008 ID; counts toward max_dead_code, which is unlimited by default.
- Finding type
- review
Why it matters
Namespaces often collect constants and types for one feature. An unread member looks like supported behaviour and keeps its initializer and dependencies alive.
What Skylos flags
export namespace Shapes { export const Circle = "circle"; export const Square = "square";}import { Shapes } from "./shapes"; console.log(Shapes.Circle);{"name": "shapes-app", "private": true, "main": "src/main.ts"}What Skylos leaves alone
import { Shapes } from "./shapes"; console.log(Object.values(Shapes));Why Skylos leaves it alone
Object.values(Shapes) reads every member, so none can be shown to be unused.
How Skylos decides
- Checks
export namespaceblocks in internal modules (the SKY-E004 notion of a module that is not public). - Combines member reads from every file (
Shapes.Circle, type positions such asShapes.Kind, destructuring) with references in the namespace body. Nested namespaces are followed (Shapes.Inner.x). - Abstains for the whole namespace when it escapes as a value, is merged with another declaration, is ambient, is tagged
@public,@alphaor@beta, no other file imports it, or a types-only wildcard export publishes its module's declarations. Tagged members stay live. Imports in Vue, Svelte and Astro scripts, HTML module scripts and MDX count as reads like any other file's. - Functions, classes and enums in a namespace keep their SKY-U001/SKY-U004 findings.
analysis_summary.namespace_member_analysisrecords checked namespaces and abstentions.
How to fix it
Remove the unread member.
export namespace Shapes { export const Circle = "circle";Removed: export const Square = "square";}When it can be wrong
- Code outside the scanned project can read a member of a namespace that an internal module exports.
Seeing a case that isn't listed here? Report the wrong result so the rule can be fixed. Don't paste company code: describe the shape of it.
How to silence it
Add
// skylos: ignore[SKY-U008]on the member's line.Set
[tool.skylos] ignore = ["SKY-U008"]to disable this rule project-wide.