Skip to content

Commit 59c3a26

Browse files
committed
doc(attr-sorted): initial docs
1 parent 3fcee2e commit 59c3a26

File tree

2 files changed

+40
-0
lines changed

2 files changed

+40
-0
lines changed

docs/user-guide/list-rules.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ title: List of rules
2424
- [`attr-value-double-quotes`](/docs/user-guide/rules/attr-value-double-quotes): Attribute values must be in double quotes.
2525
- [`attr-value-single-quotes`](/docs/user-guide/rules/attr-value-single-quotes): Attribute values must be in single quotes.
2626
- [`attr-value-not-empty`](/docs/user-guide/rules/attr-value-not-empty): All attributes must have values.
27+
- [`attr-sorted`](/docs/user-guide/rules/attr-sorted): No leading or trailing spaces in attribute values.
2728
- [`attr-whitespace`](/docs/user-guide/rules/attr-whitespace): No leading or trailing spaces in attribute values.
2829
- [`alt-require`](/docs/user-guide/rules/alt-require): The alt attribute of an element must be present and alt attribute of area[href] and input[type=image] must have a value.
2930
- [`input-requires-label`](/docs/user-guide/rules/input-requires-label): All [ input ] tags must have a corresponding [ label ] tag.

docs/user-guide/rules/attr-sorted.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
---
2+
id: attr-sorted
3+
title: attr-sorted
4+
---
5+
6+
Attributes should be sorted in the following order:
7+
8+
- class
9+
- id
10+
- name
11+
- src
12+
- for
13+
- type
14+
- href
15+
- value
16+
- title
17+
- alt
18+
- role
19+
20+
Level: `error`
21+
22+
## Config value
23+
24+
1. true: enable rule
25+
2. false: disable rule
26+
27+
The following pattern are **not** considered violations:
28+
29+
<!-- prettier-ignore -->
30+
```html
31+
<div img="image" meta="meta" font="font"></div>
32+
```
33+
34+
The following pattern is considered violation:
35+
36+
<!-- prettier-ignore -->
37+
```html
38+
<div type="type" img="image" id="id" font="font"></div>
39+
```

0 commit comments

Comments
 (0)