An import, export or pattern spells out a rename whose target equals its source

tx0/ts:rename-to-same-namerecommendedwarningstyle

What it finds

import { a as a }, export { b as b } and const { c: c } = o rename a name to itself. The rename adds words without changing anything, and a reader looks twice to make sure the two names are really equal.

The fix, which is safe, keeps the name once.

From the rule's source, rename_to_same_name.rs.

Example from the rule's tests
import { readFile as readFile, writeFile as write } from "fs";tx0 reports: readFile is renamed to itselfconst { size: size, mode: m } = { size: 1, mode: 2 };tx0 reports: size is renamed to itselfexport { write as write, m };tx0 reports: write is renamed to itselfexport const all = [readFile, size];
Highlighted lines are the ones tx0 reports, with its message under each; the other lines are left alone.

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:

tx0.toml
[rules]
"tx0/ts:rename-to-same-name" = "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:rename-to-same-name] reason="..."

tx0 explain tx0/ts:rename-to-same-name shows the same in the terminal. Found a false positive? Report it.