Pattern: Irregular whitespace
Issue: -
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.
<template>
<!-- ✓ GOOD -->
<div class="foo bar" />
<!-- ✗ BAD -->
<div class="foo�bar" />
<!-- ^ LINE TABULATION (U+000B) -->
</template>
<script>
/* ✓ GOOD */
var foo = bar;
/* ✗ BAD */
var foo =�bar;
// ^ LINE TABULATION (U+000B)
</script>
{
"vue/no-irregular-whitespace": ["error", {
"skipStrings": true,
"skipComments": false,
"skipRegExps": false,
"skipTemplates": false,
"skipHTMLAttributeValues": false,
"skipHTMLTextContents": false
}]
}
skipStrings
: iftrue
, allows any whitespace characters in string literals. defaulttrue
skipComments
: iftrue
, allows any whitespace characters in comments. defaultfalse
skipRegExps
: iftrue
, allows any whitespace characters in regular expression literals. defaultfalse
skipTemplates
: iftrue
, allows any whitespace characters in template literals. defaultfalse
skipHTMLAttributeValues
: iftrue
, allows any whitespace characters in HTML attribute values. defaultfalse
skipHTMLTextContents
: iftrue
, allows any whitespace characters in HTML text contents. defaultfalse
<script>
/* ✓ GOOD */
var foo = '�'
// ^ LINE TABULATION (U+000B)
</script>
<script>
/* ✗ BAD */
var foo = '�'
// ^ LINE TABULATION (U+000B)
</script>
<template>
<!-- ✓ GOOD -->
<!-- [�]< LINE TABULATION (U+000B) -->
</template>
<script>
/* ✓ GOOD */
// [�]< LINE TABULATION (U+000B)
/* [�]< LINE TABULATION (U+000B) */
</script>
<script>
/* ✓ GOOD */
var foo = /�/
// ^ LINE TABULATION (U+000B)
</script>
<script>
/* ✓ GOOD */
var foo = `�`
// ^ LINE TABULATION (U+000B)
</script>
<template>
<!-- ✓ GOOD -->
<div class="foo�bar" />
<!-- ^ LINE TABULATION (U+000B) -->
</template>
<template>
<!-- ✓ GOOD -->
<div>�</div>
<!-- ^ LINE TABULATION (U+000B) -->
</template>