@yoo-digital/eslint-plugin-angular 3.0.7 → 3.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +28 -20
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -42,6 +42,30 @@ isVegan = input<boolean, BooleanInput>(true|false, { transform: booleanAttribute
|
|
|
42
42
|
@Input({ transform: booleanAttribute }) isVegan: boolean = true|false;
|
|
43
43
|
```
|
|
44
44
|
|
|
45
|
+
### Required boolean input
|
|
46
|
+
|
|
47
|
+
Should be avoided as it might be in conflict with `boolean-attribute-shorthand`
|
|
48
|
+
```typescript
|
|
49
|
+
isVegan = input.required<boolean, BooleanInput>({
|
|
50
|
+
transform: booleanAttribute,
|
|
51
|
+
});
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
```html
|
|
55
|
+
<!-- This will not work : -->
|
|
56
|
+
<!-- True value -->
|
|
57
|
+
<mealComponent isVegan />
|
|
58
|
+
<!-- False value -->
|
|
59
|
+
<mealComponent />
|
|
60
|
+
|
|
61
|
+
<!-- Values must be set, which does not respect boolean-attribute-shorthand : -->
|
|
62
|
+
<!-- True value -->
|
|
63
|
+
<mealComponent [isVegan]="true" />
|
|
64
|
+
<!-- False value -->
|
|
65
|
+
<mealComponent [isVegan]="false" />
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
|
|
45
69
|
## 2️⃣ boolean-attribute-shorthand
|
|
46
70
|
|
|
47
71
|
HTML rule that enforces shorthand syntax for `[attr]="true"` bindings
|
|
@@ -108,28 +132,12 @@ HTML set it true or false this way :
|
|
|
108
132
|
<mealComponent />
|
|
109
133
|
```
|
|
110
134
|
|
|
111
|
-
|
|
135
|
+
#### Computed
|
|
112
136
|
|
|
113
|
-
|
|
114
|
-
```typescript
|
|
115
|
-
isVegan = input.required<boolean, BooleanInput>({
|
|
116
|
-
transform: booleanAttribute,
|
|
117
|
-
});
|
|
118
|
-
```
|
|
137
|
+
Those will raise no lint issues :
|
|
119
138
|
|
|
120
139
|
```html
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
<mealComponent isVegan />
|
|
124
|
-
<!-- False value -->
|
|
125
|
-
<mealComponent />
|
|
140
|
+
<mealComponent [isVegan]="myProperty" />
|
|
141
|
+
<mealComponent [isVegan]="2+2===4" />
|
|
126
142
|
|
|
127
|
-
<!-- Values must be set, which does not respect boolean-attribute-shorthand : -->
|
|
128
|
-
<!-- True value -->
|
|
129
|
-
<mealComponent [isVegan]="true" />
|
|
130
|
-
<!-- False value -->
|
|
131
|
-
<mealComponent [isVegan]="false" />
|
|
132
143
|
```
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
package/package.json
CHANGED