Skip to content

noIrregularWhitespace

¥Summary

¥How to configure

biome.json
{
"linter": {
"rules": {
"suspicious": {
"noIrregularWhitespace": "error"
}
}
}
}

¥Description

禁止使用不规则的空格字符。

¥Disallows the use of irregular whitespace characters.

无效或不规则的空格会导致各种解析器出现问题,也会使代码更难调试。

¥Invalid or irregular whitespace causes issues with various parsers and also makes code harder to debug.

¥Examples

¥Invalid

let count;
code-block.js:1:4 lint/suspicious/noIrregularWhitespace ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Irregular whitespaces found.

> 1 │ letcount;
^
2 │

Irregular whitespaces can cause issues to other parsers, and make the code harder to debug.

Replace the irregular whitespaces with normal whitespaces or tabs.

let foo;
code-block.js:1:4 lint/suspicious/noIrregularWhitespace ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Irregular whitespaces found.

> 1 │ letfoo;
^
2 │

Irregular whitespaces can cause issues to other parsers, and make the code harder to debug.

Replace the irregular whitespaces with normal whitespaces or tabs.

¥Valid

const count = 1;
const foo = ' ';

¥Related links