An imported name is never used in the file
What it finds
import { debounce } from "lodash" with debounce never used: an import that nothing refers to still loads its module, slows down builds and tests, and misleads readers about what the file depends on. It is often left over from code that was removed.
A name counts as used when anything refers to it, as a value or as a type, including export lists and typeof queries in types. React is left alone in files with JSX, which the classic JSX transform compiles to calls of React.createElement. Files with syntax errors or a with statement are skipped.
From the rule's source, unused_import.rs.
import { debounce, throttle } from "lodash";tx0 reports: debounce is imported but never usedimport type { Config } from "./config";import * as path from "path";tx0 reports: path is imported but never usedimport { defaults } from "./defaults";export type Defaults = typeof defaults;export function run(config: Config) { return throttle(() => config, 10);} Turn it on, off or suppress it
The rule runs from the recommended tier up. To turn it on in a lower tier, give it a level in tx0.toml:
[rules]
"tx0/ts:unused-import" = "warning"To keep one finding, suppress it with a reason. tx0 suppress ID --reason "..." writes the comment on the line before the code:
// tx0: ignore[tx0/ts:unused-import] reason="..."tx0 explain tx0/ts:unused-import shows the same in the terminal. Found a false positive? Report it.