@yoo-digital/eslint-plugin-angular 0.1.9 → 1.0.0
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 +31 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,6 +1,35 @@
|
|
|
1
1
|
# eslint-plugin-angular
|
|
2
2
|
|
|
3
|
-
##
|
|
3
|
+
## Custom lint purpose
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Here should live all custom Angular lint rules that eslint does not already provide.
|
|
6
6
|
|
|
7
|
+
## Linting
|
|
8
|
+
|
|
9
|
+
Wrong code is yellow underlined in VScode, it can also be raises running : `npm run lint`
|
|
10
|
+
|
|
11
|
+
## Rule 1 : boolean input conversion
|
|
12
|
+
|
|
13
|
+
`booleanAttribute @angular/core`
|
|
14
|
+
|
|
15
|
+
`BooleanInput @angular/cdk/coercion`
|
|
16
|
+
|
|
17
|
+
### Examples
|
|
18
|
+
|
|
19
|
+
`<myComp [myBoolInput]="true" ` must be `<myComp myBoolInput`
|
|
20
|
+
|
|
21
|
+
`<myComp [myBoolInput]="false"` must be `<myComp `
|
|
22
|
+
|
|
23
|
+
`<myComp [myBoolInput]="2+2===4"` is accepted
|
|
24
|
+
|
|
25
|
+
### Decorator
|
|
26
|
+
|
|
27
|
+
`@Input({ transform: booleanAttribute }) myInput: boolean = true;`
|
|
28
|
+
|
|
29
|
+
### Signal
|
|
30
|
+
|
|
31
|
+
`myInput = input<boolean, BooleanInput>(true, {transform: booleanAttribute,});`
|
|
32
|
+
|
|
33
|
+
### Exception
|
|
34
|
+
|
|
35
|
+
If a **required** boolean input needs to be false, no choice, `[myRequiredInput]="false"` must be written. Therefore boolean input should never be required.
|
package/package.json
CHANGED