Skip to content

noIrregularWhitespace

诊断类别:lint/nursery/noIrregularWhitespace

¥Diagnostic Category: lint/nursery/noIrregularWhitespace

自从:v1.9.0

¥Since: v1.9.0

来源:

¥Sources:

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

¥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/nursery/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/nursery/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