Skip to content

no-irregular-whitespace

Reports unusual whitespace characters: vertical tab, form feed, no-break space (U+00A0), the spaces and zero-width characters U+2000 to U+200B, line and paragraph separators, narrow no-break space, medium mathematical space, ideographic space, and a byte order mark that is not at the start of the file. A string literal is not checked (the character is data there); comments, template literals and regex literals are. A run of them is one report.

These characters look like a space (or like nothing) but are different characters: a search for a space does not find them, a diff shows no change, and in code outside a string or comment some of them make the file fail to parse. They usually arrive by copying text from a web page or a document.

To fix, replace them with an ordinary space, or write the character as an escape (\u00a0) where it is wanted.

Reported
var a = 1;
var b = " ";
// a comment with a space
var c = ` `;
var d = / /;
var e =  f;
var g = "\u00a0";
js:
lint:
rules:
no-irregular-whitespace: warn # off, warn (default), error

Enabled by the presets: js/eslint-recommended, js/biome-recommended, js/oxlint.

Suppress one line with sudsy-disable-next-line no-irregular-whitespace in a comment of the file’s language.

The same check in other tools; Sudsy reports what each upstream rule reports.

Tool Rule Match
eslint no-irregular-whitespace full