Forces indent for html attributes that have line break between.
Config defaults
"attr-format": {
"severity": "error",
"options": {
"type": "space",
"newline": 2,
"inline": 1,
"maxInlineSize": 50
}
}
Options interface:
{
type: "space" | "tab";
newline: number;
inline: number;
maxInlineSize: number;
}
GOOD:
<input
value=""
name="input"/>
BAD:
<input
value=""
name="input"/>
Forces indent before opening tag closing bracket.
Config defaults
"attr-closing-bracket": {
severity: 'error',
options: ['eol'],
}
Options interface:
['eol' | 'newline', number | undefined]
Forces closing bracket >
or />
to be on the same line as last attribute.
GOOD:
<input name="input"/>
<input
name="input"/>
It is possible to set a custom whitespace number here in config: ['eol', 1]
GOOD:
<input name="input" />
BAD:
<input name="input"
/>
Forces closing bracket >
or />
to have a new line before closing with same whitespace as tag.
GOOD:
<input
name="input"
/>
<input
name="input"
/>
BAD:
<input name="input"/>
Forces all void elements to be self closed.
Config defaults
"no-void-tag-close": {
severity: 'error',
}
GOOD:
<br/>
<hr/>
BAD:
<br>
<hr>
Forces all flow elements to be closed.
Config defaults
"no-flow-tag-close": {
severity: 'error',
}
GOOD:
<p>Hello</p>
<p>World</p>
BAD:
<p>Hello
<p>World
Forces all tags to be closed.
Config defaults
"no-unclosed-tag": {
severity: 'error',
}
GOOD:
<p>Hello <strong>World</strong></p>
BAD:
<p>Hello <strong>World</p>
All img tags must have alt attribute.
Config defaults
"alt-require": {
severity: 'error',
}
GOOD:
<img src="image.png" alt="description"/>
BAD:
<img src="image.png"/>
All attribute names must be lowercase.
Config defaults
"attr-lowercase": {
severity: 'error',
options: {
ignore: ['viewBox'],
},
}
Options interface:
{
ignore: string[],
}
GOOD:
<tag attr="test"/>
BAD:
<tag ATTR="test"/>
Attributes must not be duplicated.
Config defaults
"attr-no-duplication": {
severity: 'error',
options: {
ignore: ['custom-attr'],
},
}
Options interface:
{
ignore: string[],
}
GOOD:
<tag class="one two"/>
BAD:
<tag class="one" class="two"/>
All attributes must have values.
By default ignores all boolean attributes like "disabled", "checked", "hidden" etc.
Config defaults
"attr-value-not-empty": {
severity: 'error',
options: {
ignore: ['disabled'],
},
}
Options interface:
{
ignore: string[],
}
GOOD:
<input name="myname"/>
BAD:
<input name=""/>
Forces all attribute values to have double quotes.
Config defaults
"attr-value-double-quotes": {
severity: 'error',
}
GOOD:
<input name="test"/>
BAD:
<input name='test'/>
Forces style tag not to be used.
Config defaults
"style-disabled": {
severity: 'error',
}
BAD:
<style>
.bg-red {
background-color: red;
}
</style>
Forces style attribute not to be used.
Config defaults
"inline-style-disabled": {
severity: 'error',
}
BAD:
<h1 style="background: red;">hello</h1>
Forces tag indentation in depth based on editorconfig or overwritten options.
Config defaults
"tag-indent": {
"severity": "error",
"options": {
"type": "space",
"newline": 2,
"ignore": [
"pre",
"script",
"style"
]
}
}
GOOD:
<strong>
text
</strong>
<strong>text</strong>
BAD:
<strong>
text</strong>
<strong>
text
</strong>
<strong>
text
</strong>
Forces all comments to have spaces in start and end.
Config defaults
"comment-format": {
"severity": "warning",
"options": {
"start": 1,
"end": 1
}
}
GOOD:
<!-- Comment -->
BAD:
<!-- Comment-->