Skip to content

Commit 9ebee24

Browse files
committed
Fix docs
1 parent f7bd840 commit 9ebee24

17 files changed

Lines changed: 95 additions & 104 deletions

docs/rules/template-attribute-indentation.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,13 @@ HTML element (> 80 characters):
5252

5353
Examples of **correct** code for this rule:
5454

55-
Non-block form:
55+
Non-block form (attributes on separate lines):
5656

5757
```hbs
5858
{{employee-details firstName=firstName lastName=lastName age=age avatarUrl=avatarUrl}}
5959
```
6060

61-
Block form:
61+
Block form (attributes on separate lines):
6262

6363
```hbs
6464
{{#employee-details
@@ -69,7 +69,7 @@ Block form:
6969
{{/employee-details}}
7070
```
7171

72-
HTML element:
72+
HTML element (attributes on separate lines):
7373

7474
```hbs
7575
<input disabled id='firstName' value={{firstName}} class='input-field first-name' type='text' />

docs/rules/template-block-indentation.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,7 @@ Examples of **incorrect** code for this rule:
3838

3939
```hbs
4040
<div>
41-
<p>{{t 'Stuff here!'}}</p>
42-
</div>
41+
<p>{{t 'Stuff here!'}}</p></div>
4342
```
4443

4544
Examples of **correct** code for this rule:

docs/rules/template-modifier-name-case.md

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,6 @@ This rule **forbids** the following:
2020
<template><div {{onFocus}}></div></template>
2121
```
2222

23-
```gjs
24-
<template><div {{modifier 'didInsert'}}></div></template>
25-
```
26-
2723
This rule **allows** the following:
2824

2925
```gjs
@@ -34,10 +30,6 @@ This rule **allows** the following:
3430
<template><div {{on-focus}}></div></template>
3531
```
3632

37-
```gjs
38-
<template><div {{modifier 'did-insert'}}></div></template>
39-
```
40-
4133
## See Also
4234

4335
- [named-functions-in-promises](named-functions-in-promises.md)

docs/rules/template-no-bare-strings.md

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ This rule disallows text content in templates that isn't wrapped in a translatio
1313
The following are allowed:
1414

1515
- Whitespace-only strings
16-
- Strings containing only numbers and punctuation
17-
- Strings in an allowlist (configurable)
16+
- Strings in the default allowlist (punctuation characters like `(`, `)`, `.`, `&`, etc.)
17+
- Strings in a custom allowlist (configurable)
1818

1919
## Examples
2020

@@ -52,12 +52,6 @@ Examples of **correct** code for this rule:
5252
</template>
5353
```
5454

55-
```gjs
56-
<template>
57-
<div>123</div>
58-
</template>
59-
```
60-
6155
```gjs
6256
<template>
6357
<div> </div>

docs/rules/template-no-empty-headings.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,37 +11,37 @@ Disallow headings (h1, h2, etc.) with no accessible text content.
1111
This rule **forbids** the following:
1212

1313
```gjs
14-
<template><h*></h*></template>
14+
<template><h1></h1></template>
1515
```
1616

1717
```gjs
1818
<template><div role='heading' aria-level='1'></div></template>
1919
```
2020

2121
```gjs
22-
<template><h*><span aria-hidden='true'>Inaccessible text</span></h*></template>
22+
<template><h2><span aria-hidden='true'>Inaccessible text</span></h2></template>
2323
```
2424

2525
This rule **allows** the following:
2626

2727
```gjs
28-
<template><h*>Heading Content</h*></template>
28+
<template><h1>Heading Content</h1></template>
2929
```
3030

3131
```gjs
32-
<template><h*><span>Text</span><h*></template>
32+
<template><h2><span>Text</span></h2></template>
3333
```
3434

3535
```gjs
3636
<template><div role='heading' aria-level='1'>Heading Content</div></template>
3737
```
3838

3939
```gjs
40-
<template><h* aria-hidden='true'>Heading Content</h*></template>
40+
<template><h3 aria-hidden='true'>Heading Content</h3></template>
4141
```
4242

4343
```gjs
44-
<template><h* hidden>Heading Content</h*></template>
44+
<template><h1 hidden>Heading Content</h1></template>
4545
```
4646

4747
## Migration

docs/rules/template-no-mut-helper.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ the lint violations.
7070
```
7171

7272
```hbs
73-
<Input @value={{this.name}} @onChange={{fn (mut this 'name')}} />
73+
<Input @value={{this.name}} @onChange={{fn this.updateName}} />
7474
```
7575

7676
```hbs

docs/rules/template-no-nested-landmark.md

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22

33
<!-- end auto-generated rule header -->
44

5-
Disallows nested landmark elements.
5+
Disallows nesting landmark elements of the same type.
66

7-
Landmark elements should not be nested within other landmarks. This creates confusion for screen reader users navigating by landmarks.
7+
Landmark elements should not be nested within other landmarks of the same name. This creates confusion for screen reader users navigating by landmarks.
88

99
## Rule Details
1010

11-
This rule disallows nesting landmark elements or roles within other landmark elements or roles.
11+
This rule disallows nesting landmark elements or roles within other landmark elements or roles of the same type.
1212

1313
Landmark elements include:
1414

@@ -38,23 +38,23 @@ Examples of **incorrect** code for this rule:
3838
```gjs
3939
<template>
4040
<nav>
41-
<main>Content</main>
41+
<nav>Nested navigation</nav>
4242
</nav>
4343
</template>
4444
```
4545

4646
```gjs
4747
<template>
4848
<main>
49-
<nav>Navigation</nav>
49+
<main>Nested main</main>
5050
</main>
5151
</template>
5252
```
5353

5454
```gjs
5555
<template>
56-
<div role="main">
57-
<div role="navigation">Nav</div>
56+
<div role="navigation">
57+
<nav>Nested nav</nav>
5858
</div>
5959
</template>
6060
```
@@ -70,10 +70,9 @@ Examples of **correct** code for this rule:
7070

7171
```gjs
7272
<template>
73-
<div>
74-
<nav>Nav 1</nav>
75-
<nav>Nav 2</nav>
76-
</div>
73+
<main>
74+
<nav>Navigation inside main</nav>
75+
</main>
7776
</template>
7877
```
7978

docs/rules/template-no-nested-splattributes.md

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,42 +4,34 @@
44

55
Disallow nested `...attributes` usage.
66

7-
The `...attributes` syntax is used to pass HTML attributes to components. It should only be used on the top-level element of a component template, not on nested elements. Using it on nested elements can lead to unexpected behavior and makes it unclear which element receives the attributes.
7+
Having `...attributes` on multiple elements nested within each other in a component can cause unintended results. This rule prevents `...attributes` on an element if any of its parent elements already has `...attributes`.
88

99
## Rule Details
1010

11-
This rule disallows using `...attributes` on nested elements within a template.
11+
This rule disallows `...attributes` on an element when an ancestor element already has `...attributes`.
1212

1313
## Examples
1414

1515
### Incorrect ❌
1616

1717
```gjs
1818
<template>
19-
<div>
19+
<div ...attributes>
2020
<span ...attributes>Text</span>
2121
</div>
2222
</template>
2323
```
2424

2525
```gjs
2626
<template>
27-
<section>
27+
<section ...attributes>
2828
<div>
2929
<button ...attributes>Click</button>
3030
</div>
3131
</section>
3232
</template>
3333
```
3434

35-
```gjs
36-
<template>
37-
<div class="wrapper">
38-
<input ...attributes />
39-
</div>
40-
</template>
41-
```
42-
4335
### Correct ✅
4436

4537
```gjs
@@ -50,13 +42,16 @@ This rule disallows using `...attributes` on nested elements within a template.
5042

5143
```gjs
5244
<template>
53-
<button ...attributes>Click</button>
45+
<div ...attributes>
46+
<span>Text</span>
47+
</div>
5448
</template>
5549
```
5650

5751
```gjs
5852
<template>
59-
<MyComponent ...attributes />
53+
<div ...attributes>first</div>
54+
<div ...attributes>second</div>
6055
</template>
6156
```
6257

docs/rules/template-no-pointer-down-event-binding.md

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22

33
<!-- end auto-generated rule header -->
44

5-
Disallows pointer down event bindings.
5+
Disallows pointer down and mouse down event bindings.
66

7-
Pointer down events can cause accessibility issues because they don't work well with keyboard navigation. Use `click` or `keydown` events instead.
7+
Pointer down and mouse down events can cause accessibility issues because they don't work well with keyboard navigation. Use `click` or `keydown` events instead.
88

99
## Rule Details
1010

11-
This rule disallows the use of `pointerdown` events in templates.
11+
This rule disallows the use of `pointerdown` and `mousedown` events in templates.
1212

1313
## Examples
1414

@@ -26,23 +26,29 @@ Examples of **incorrect** code for this rule:
2626
</template>
2727
```
2828

29-
Examples of **correct** code for this rule:
29+
```gjs
30+
<template>
31+
<div {{on "mousedown" this.handleMouseDown}}>Content</div>
32+
</template>
33+
```
3034

3135
```gjs
3236
<template>
33-
<button {{on "click" this.handleClick}}>Click</button>
37+
<div onmousedown={{this.handleMouseDown}}>Content</div>
3438
</template>
3539
```
3640

41+
Examples of **correct** code for this rule:
42+
3743
```gjs
3844
<template>
39-
<button {{on "keydown" this.handleKeyDown}}>Press</button>
45+
<button {{on "click" this.handleClick}}>Click</button>
4046
</template>
4147
```
4248

4349
```gjs
4450
<template>
45-
<div {{on "mousedown" this.handleMouseDown}}>Content</div>
51+
<button {{on "keydown" this.handleKeyDown}}>Press</button>
4652
</template>
4753
```
4854

docs/rules/template-no-quoteless-attributes.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ The following two examples are _identical_ from the perspective of the browser:
1010

1111
```gjs
1212
<template>
13-
<div data-foo="asdf"></div>
13+
<div data-foo=asdf></div>
1414
<div data-foo="asdf"></div>
1515
</template>
1616
```
@@ -32,7 +32,7 @@ This rule attempts to make this situation _slightly_ better by at least ensuring
3232
This rule **forbids** the following (note that `someValue` could have been intended either as a string or expression):
3333

3434
```gjs
35-
<template><div data-foo="someValue"></div></template>
35+
<template><div data-foo=someValue></div></template>
3636
```
3737

3838
This rule **allows** the following:

0 commit comments

Comments
 (0)