Skip to content

Commit cb612d1

Browse files
authored
Add values, additional example (#9)
1 parent 737cba3 commit cb612d1

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

docs/rules/strict-logical-expressions.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ Examples of **incorrect** code for this rule:
1111

1212
```js
1313
// Potentially falsey strings are not allowed
14-
let str;
14+
let str = '';
1515
<App>{str && <Foo />}</App>;
1616

1717
// Potentially falsey numbers are not allowed
18-
let num;
18+
let num = 0;
1919
<App>{num && <Foo />}</App>;
2020

2121
// Includes types that may be a string or number
@@ -37,6 +37,10 @@ let str = "Foo";
3737
// Constant values are ok
3838
const str = "Foo";
3939
<App>{str && <Foo />}</App>;
40+
41+
// Constant values are ok
42+
const num = 1;
43+
<App>{num && <Foo />}</App>;
4044
```
4145

4246
### Options

0 commit comments

Comments
 (0)