A module exports a binding that can be reassigned
What it finds
An exported let or var can be reassigned by the module that declares it, and every importer sees the change through its live binding, while importers cannot assign it themselves. State shared that way changes under the feet of its readers; a const with functions that change an object, or a getter, makes the changes explicit.
Declarations with declare, which only describe a variable defined elsewhere, are left alone.
From the rule's source, exported_let.rs.
export let counter = 0;tx0 reports: can be reassigned under its importersexport const fixed = 1;export var legacy = 2;tx0 reports: can be reassigned under its importerslet local = 3;export function bump() { counter += local;} Turn it on, off or suppress it
The rule runs from the strict tier up. To turn it on in a lower tier, give it a level in tx0.toml:
[rules]
"tx0/ts:exported-let" = "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:exported-let] reason="..."tx0 explain tx0/ts:exported-let shows the same in the terminal. Found a false positive? Report it.