Skip to content

vue/no-irregular-whitespace

禁止在 .vue 中出现不规则空格文件

¥disallow irregular whitespace in .vue files

📖 规则详情

vue/no-irregular-whitespace 规则旨在捕获无效的空白,这些空白不是正常的制表符和空格。其中一些字符可能会在现代浏览器中引起问题,而其他字符则是需要调试的问题。vue/no-irregular-whitespace 规则与核心 no-irregular-whitespace 规则类似,但它适用于 .vue 中的源代码。

¥vue/no-irregular-whitespace rule is aimed at catching invalid whitespace that is not a normal tab and space. Some of these characters may cause issues in modern browsers and others will be a debugging issue to spot. vue/no-irregular-whitespace rule is the similar rule as core no-irregular-whitespace rule but it applies to the source code in .vue.

Now loading...

🔧选项

¥🔧 Options

js
{
    "vue/no-irregular-whitespace": ["error", {
        "skipStrings": true,
        "skipComments": false,
        "skipRegExps": false,
        "skipTemplates": false,
        "skipHTMLAttributeValues": false,
        "skipHTMLTextContents": false
    }]
}
  • skipStrings:如果 true,则允许字符串字面量中出现任何空格字符。默认 true

    ¥skipStrings: if true, allows any whitespace characters in string literals. default true

  • skipComments:如果 true,则允许注释中出现任何空格字符。默认 false

    ¥skipComments: if true, allows any whitespace characters in comments. default false

  • skipRegExps:如果 true,则允许正则表达式字面量中出现任何空格字符。默认 false

    ¥skipRegExps: if true, allows any whitespace characters in regular expression literals. default false

  • skipTemplates:如果 true,则允许模板字面量中出现任何空格字符。默认 false

    ¥skipTemplates: if true, allows any whitespace characters in template literals. default false

  • skipHTMLAttributeValues:如果 true,则允许 HTML 属性值中出现任何空格字符。默认 false

    ¥skipHTMLAttributeValues: if true, allows any whitespace characters in HTML attribute values. default false

  • skipHTMLTextContents:如果 true,则允许 HTML 文本内容中出现任何空格字符。默认 false

    ¥skipHTMLTextContents: if true, allows any whitespace characters in HTML text contents. default false

"skipStrings": true(默认)

¥"skipStrings": true (default)

Now loading...

"skipStrings": false

Now loading...

"skipComments": true

Now loading...

"skipRegExps": true

Now loading...

"skipTemplates": true

Now loading...

"skipHTMLAttributeValues": true

Now loading...

"skipHTMLTextContents": true

Now loading...

📚扩展阅读

¥📚 Further Reading

🚀版本

¥🚀 Version

此规则在 eslint-plugin-vue v6.1.0 中引入

¥This rule was introduced in eslint-plugin-vue v6.1.0

🔍代码实现

¥🔍 Implementation

使用 ❤️ 来自 ESLint 核心

¥Taken with ❤️ from ESLint core

eslint-plugin-vue v10.0 中文网 - 粤ICP备13048890号