A member is read from a name for the global object that only some environments define
What it finds
window, self and global each name the global object in only some environments: browsers, workers and Node. globalThis names it in all of them, so code that uses it runs unchanged in each.
Reported are member accesses on window, self or global when the name is not declared in the file, as window.setTimeout. Plain uses such as window passed as an argument, which may mean the window rather than the global object, are left alone, and so are accesses to properties that only the window has, such as window.location or window.document.
From the rule's source, environment_specific_global.rs.
export function schedule(fn: () => void) { window.setTimeout(fn, 10);tx0 reports: globalThis names it in all const href = window.location.href; return href;} 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:environment-specific-global" = "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:environment-specific-global] reason="..."tx0 explain tx0/ts:environment-specific-global shows the same in the terminal. Found a false positive? Report it.