@yoo-digital/eslint-plugin-angular 3.0.5 → 3.0.8
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 +27 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -6,7 +6,8 @@ Here should live all ***custom Angular lint rules*** that eslint does not alread
|
|
|
6
6
|
|
|
7
7
|
## Use
|
|
8
8
|
|
|
9
|
-
Wrong code is yellow/red underlined in VScode, it can also be raised running : `npm run lint
|
|
9
|
+
Wrong code is yellow/red underlined in VScode, it can also be raised running : `npm run lint`
|
|
10
|
+
Autofixing lint issues with : `npm run lint:fix`
|
|
10
11
|
|
|
11
12
|
## 1️⃣ boolean-input
|
|
12
13
|
|
|
@@ -41,6 +42,30 @@ isVegan = input<boolean, BooleanInput>(true|false, { transform: booleanAttribute
|
|
|
41
42
|
@Input({ transform: booleanAttribute }) isVegan: boolean = true|false;
|
|
42
43
|
```
|
|
43
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
|
+
|
|
44
69
|
## 2️⃣ boolean-attribute-shorthand
|
|
45
70
|
|
|
46
71
|
HTML rule that enforces shorthand syntax for `[attr]="true"` bindings
|
|
@@ -105,4 +130,4 @@ HTML set it true or false this way :
|
|
|
105
130
|
<mealComponent isVegan />
|
|
106
131
|
<!-- False value -->
|
|
107
132
|
<mealComponent />
|
|
108
|
-
```
|
|
133
|
+
```
|
package/package.json
CHANGED