10000 Merge branch 'master' into fix/sort-ngmodule-metadata-arrays-part-3 · angular-eslint/angular-eslint@115d84a · GitHub
[go: up one dir, main page]

Skip to content

Commit 115d84a

Browse files
authored
Merge branch 'master' into fix/sort-ngmodule-metadata-arrays-part-3
2 parents c935b91 + 8ac2193 commit 115d84a

File tree

55 files changed

+19970
-139
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+19970
-139
lines changed

packages/eslint-plugin-template/docs/rules/accessibility-alt-text.md

Lines changed: 444 additions & 2 deletions
Large diffs are not rendered by default.

packages/eslint-plugin-template/docs/rules/accessibility-elements-content.md

Lines changed: 356 additions & 2 deletions
Large diffs are not rendered by default.

packages/eslint-plugin-template/docs/rules/accessibility-label-for.md

Lines changed: 168 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
1212
-->
1313

14+
<br>
15+
1416
# `@angular-eslint/template/accessibility-label-for`
1517

1618
## ⚠️ THIS RULE IS DEPRECATED
@@ -56,25 +58,95 @@ interface Options {
5658
5759
<br>
5860

59-
❌ - Examples of **incorrect** code for this rule:
61+
<details>
62+
<summary>❌ - Toggle examples of <strong>incorrect</strong> code for this rule</summary>
63+
64+
<br>
65+
66+
#### Default Config
67+
68+
```json
69+
{
70+
"rules": {
71+
"@angular-eslint/template/accessibility-label-for": [
72+
"error"
73+
]
74+
}
75+
}
76+
```
77+
78+
<br>
79+
80+
#### ❌ Invalid Code
6081

6182
```html
6283
<label>Label</label>
6384
~~~~~~~~~~~~~~~~~~~~
6485
```
6586

87+
<br>
88+
89+
---
90+
91+
<br>
92+
93+
#### Custom Config
94+
95+
```json
96+
{
97+
"rules": {
98+
"@angular-eslint/template/accessibility-label-for": [
99+
"error",
100+
{
101+
"labelAttributes": [
102+
"id"
103+
],
104+
"labelComponents": [
105+
"app-label"
106+
]
107+
}
108+
]
109+
}
110+
}
111+
```
112+
113+
<br>
114+
115+
#### ❌ Invalid Code
116+
66117
```html
67118
<app-label anotherAttribute="id"></app-label>
68119
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
69120
```
70121

122+
</details>
123+
71124
<br>
72125

73126
---
74127

75128
<br>
76129

77-
✅ - Examples of **correct** code for this rule:
130+
<details>
131+
<summary>✅ - Toggle examples of <strong>correct</strong> code for this rule</summary>
132+
133+
<br>
134+
135+
#### Default Config
136+
137+
```json
138+
{
139+
"rules": {
140+
"@angular-eslint/template/accessibility-label-for": [
141+
"error"
142+
]
143+
}
144+
}
145+
```
146+
147+
<br>
148+
149+
#### ✅ Valid Code
78150

79151
```html
80152
<ng-container *ngFor="let item of items; index as index">
@@ -86,3 +158,97 @@ interface Options {
86158
<label [attr.for]="id"></label>
87159
<label [htmlFor]="id"></label>
88160
```
161+
162+
<br>
163+
164+
---
165+
166+
<br>
167+
168+
#### Custom Config
169+
170+
```json
171+
{
172+
"rules": {
173+
"@angular-eslint/template/accessibility-label-for": [
174+
"error",
175+
{
176+
"labelAttributes": [
177+
"id"
178+
],
179+
"labelComponents": [
180+
"app-label"
181+
]
182+
}
183+
]
184+
}
185+
}
186+
```
187+
188+
<br>
189+
190+
#### ✅ Valid Code
191+
192+
```html
193+
<app-label id="name"></app-label>
194+
<app-label id="{{name}}"></app-label>
195+
<app-label [id]="name"></app-label>
196+
```
197+
198+
<br>
199+
200+
---
201+
202+
<br>
203+
204+
#### Custom Config
205+
206+
```json
207+
{
208+
"rules": {
209+
"@angular-eslint/template/accessibility-label-for": [
210+
"error",
211+
{
212+
"controlComponents": [
213+
"app-input"
214+
],
215+
"labelComponents": [
216+
"app-label"
217+
]
218+
}
219+
]
220+
}
221+
}
222+
```
223+
224+
<br>
225+
226+
#### ✅ Valid Code
227+
228+
```html
229+
<label><button>Button</button></label>
230+
<label><input type="radio"></label>
231+
<label><meter></meter></label>
232+
<label><output></output></label>
233+
<label><progress></progress></label>
234+
<label><select><option>1</option></select></label>
235+
<label><textarea></textarea></label>
236+
<a-label><input></a-label>
237+
<label>
238+
Label
239+
<input>
240+
</label>
241+
<label>
242+
Label
243+
<span><input></span>
244+
</label>
245+
<app-label>
246+
<span>
247+
<app-input></app-input>
248+
</span>
249+
</app-label>
250+
```
251+
252+
</details>
253+
384A
254+
<br>

0 commit comments

Comments
 (0)
0