File tree Expand file tree Collapse file tree 1 file changed +4
-28
lines changed
projects/eslint-plugin/rules/general/docs/rules Expand file tree Collapse file tree 1 file changed +4
-28
lines changed Original file line number Diff line number Diff line change @@ -7,54 +7,30 @@ This rule enforces that engineers don't use a truthy or falsy value that `Object
77Examples of ** incorrect** code for this rule:
88
99``` js
10- if (! Object .keys ({foo: ' bar' })) {
10+ if (Object .keys ({foo: ' bar' })) {
1111 // do your magic
1212}
13- ```
1413
15- or
14+ if (! Object .keys ({foo: ' bar' })) {
15+ // do your magic
16+ }
1617
17- ``` js
1818!! Object .keys ({foo: ' bar' }) && ' test' ;
19- ```
20-
21- or
2219
23- ``` js
2420const negatedObjectKeys = ! Object .keys ({foo: ' bar' });
25- ```
26-
27- or
2821
29- ``` js
3022! Object .keys ({foo: ' bar' }) && true ;
3123```
3224
3325Examples of ** correct** code for this rule:
3426
35- ``` js
36- if (Object .keys ({foo: ' bar' })) {
37- // do your magic
38- }
39- ```
40-
41- or
42-
4327``` js
4428if (Object .keys ({foo: ' bar' }).length ) {
4529 // do your magic
4630}
47- ```
48-
49- or
5031
51- ``` js
5232Object .keys ({foo: ' bar' }) && ' test' ;
53- ```
54-
55- or
5633
57- ``` js
5834if (Object .keys ({foo: ' bar' }).find ((i ) => true )) {
5935 // do your magic
6036}
You can’t perform that action at this time.
0 commit comments