--- source: crates/biome_js_analyze/tests/spec_tests.rs expression: logicalAndCases1.js --- # Input ```jsx // base cases // chained members foo && foo.bar foo.bar && foo.bar.baz foo && foo() foo.bar && foo.bar() foo && foo.bar && foo.bar.baz && foo.bar.baz.buzz foo.bar && foo.bar.baz && foo.bar.baz.buzz // case with a jump (i.e. a non-nullish prop) foo && foo.bar && foo.bar.baz.buzz foo.bar && foo.bar.baz.buzz // case where for some reason there is a doubled up expression foo && foo.bar && foo.bar.baz && foo.bar.baz && foo.bar.baz.buzz foo.bar && foo.bar.baz && foo.bar.baz && foo.bar.baz.buzz // chained members with element access foo && foo[bar] && foo[bar].baz && foo[bar].baz.buzz // case with a jump (i.e. a non-nullish prop) foo && foo[bar].baz && foo[bar].baz.buzz // chained calls foo && foo.bar && foo.bar.baz && foo.bar.baz.buzz() foo && foo.bar && foo.bar.baz && foo.bar.baz.buzz && foo.bar.baz.buzz() foo.bar && foo.bar.baz && foo.bar.baz.buzz && foo.bar.baz.buzz() // case with a jump (i.e. a non-nullish prop) foo && foo.bar && foo.bar.baz.buzz() foo.bar && foo.bar.baz.buzz() // case with a jump (i.e. a non-nullish prop) foo && foo.bar && foo.bar.baz.buzz && foo.bar.baz.buzz() // case with a call expr inside the chain for some inefficient reason foo && foo.bar() && foo.bar().baz && foo.bar().baz.buzz && foo.bar().baz.buzz() // chained calls with element access foo && foo.bar && foo.bar.baz && foo.bar.baz[buzz]() foo && foo.bar && foo.bar.baz && foo.bar.baz[buzz] && foo.bar.baz[buzz]() // (partially) pre-optional chained foo && foo?.bar && foo?.bar.baz && foo?.bar.baz[buzz] && foo?.bar.baz[buzz]() foo && foo?.bar.baz && foo?.bar.baz[buzz] foo && foo?.() && foo?.().bar foo.bar && foo.bar?.() && foo.bar?.().baz // it should ignore parts of the expression that aren't part of the expression chain // chained members foo && foo.bar && bing foo.bar && foo.bar.baz && bing foo && foo() && bing foo.bar && foo.bar() && bing foo && foo.bar && foo.bar.baz && foo.bar.baz.buzz && bing foo.bar && foo.bar.baz && foo.bar.baz.buzz && bing ``` # Diagnostics ``` logicalAndCases1.js:4:1 lint/complexity/useOptionalChain FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! Change to an optional chain. 3 │ // chained members > 4 │ foo && foo.bar │ ^^^^^^^^^^^^^^ 5 │ foo.bar && foo.bar.baz 6 │ foo && foo() i Unsafe fix: Change to an optional chain. 2 2 │ 3 3 │ // chained members 4 │ - foo·&&·foo.bar 4 │ + foo?.bar 5 5 │ foo.bar && foo.bar.baz 6 6 │ foo && foo() ``` ``` logicalAndCases1.js:5:1 lint/complexity/useOptionalChain FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! Change to an optional chain. 3 │ // chained members 4 │ foo && foo.bar > 5 │ foo.bar && foo.bar.baz │ ^^^^^^^^^^^^^^^^^^^^^^ 6 │ foo && foo() 7 │ foo.bar && foo.bar() i Unsafe fix: Change to an optional chain. 3 3 │ // chained members 4 4 │ foo && foo.bar 5 │ - foo.bar·&&·foo.bar.baz 5 │ + foo.bar?.baz 6 6 │ foo && foo() 7 7 │ foo.bar && foo.bar() ``` ``` logicalAndCases1.js:6:1 lint/complexity/useOptionalChain FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! Change to an optional chain. 4 │ foo && foo.bar 5 │ foo.bar && foo.bar.baz > 6 │ foo && foo() │ ^^^^^^^^^^^^ 7 │ foo.bar && foo.bar() 8 │ foo && foo.bar && foo.bar.baz && foo.bar.baz.buzz i Unsafe fix: Change to an optional chain. 4 4 │ foo && foo.bar 5 5 │ foo.bar && foo.bar.baz 6 │ - foo·&&·foo() 6 │ + foo?.() 7 7 │ foo.bar && foo.bar() 8 8 │ foo && foo.bar && foo.bar.baz && foo.bar.baz.buzz ``` ``` logicalAndCases1.js:7:1 lint/complexity/useOptionalChain FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! Change to an optional chain. 5 │ foo.bar && foo.bar.baz 6 │ foo && foo() > 7 │ foo.bar && foo.bar() │ ^^^^^^^^^^^^^^^^^^^^ 8 │ foo && foo.bar && foo.bar.baz && foo.bar.baz.buzz 9 │ foo.bar && foo.bar.baz && foo.bar.baz.buzz i Unsafe fix: Change to an optional chain. 5 5 │ foo.bar && foo.bar.baz 6 6 │ foo && foo() 7 │ - foo.bar·&&·foo.bar() 7 │ + foo.bar?.() 8 8 │ foo && foo.bar && foo.bar.baz && foo.bar.baz.buzz 9 9 │ foo.bar && foo.bar.baz && foo.bar.baz.buzz ``` ``` logicalAndCases1.js:8:1 lint/complexity/useOptionalChain FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! Change to an optional chain. 6 │ foo && foo() 7 │ foo.bar && foo.bar() > 8 │ foo && foo.bar && foo.bar.baz && foo.bar.baz.buzz │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 9 │ foo.bar && foo.bar.baz && foo.bar.baz.buzz 10 │ i Unsafe fix: Change to an optional chain. 6 6 │ foo && foo() 7 7 │ foo.bar && foo.bar() 8 │ - foo·&&·foo.bar·&&·foo.bar.baz·&&·foo.bar.baz.buzz 8 │ + foo?.bar?.baz?.buzz 9 9 │ foo.bar && foo.bar.baz && foo.bar.baz.buzz 10 10 │ ``` ``` logicalAndCases1.js:9:1 lint/complexity/useOptionalChain FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! Change to an optional chain. 7 │ foo.bar && foo.bar() 8 │ foo && foo.bar && foo.bar.baz && foo.bar.baz.buzz > 9 │ foo.bar && foo.bar.baz && foo.bar.baz.buzz │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 10 │ 11 │ // case with a jump (i.e. a non-nullish prop) i Unsafe fix: Change to an optional chain. 7 7 │ foo.bar && foo.bar() 8 8 │ foo && foo.bar && foo.bar.baz && foo.bar.baz.buzz 9 │ - foo.bar·&&·foo.bar.baz·&&·foo.bar.baz.buzz 9 │ + foo.bar?.baz?.buzz 10 10 │ 11 11 │ // case with a jump (i.e. a non-nullish prop) ``` ``` logicalAndCases1.js:12:1 lint/complexity/useOptionalChain FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! Change to an optional chain. 11 │ // case with a jump (i.e. a non-nullish prop) > 12 │ foo && foo.bar && foo.bar.baz.buzz │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 13 │ foo.bar && foo.bar.baz.buzz 14 │ i Unsafe fix: Change to an optional chain. 10 10 │ 11 11 │ // case with a jump (i.e. a non-nullish prop) 12 │ - foo·&&·foo.bar·&&·foo.bar.baz.buzz 12 │ + foo?.bar?.baz.buzz 13 13 │ foo.bar && foo.bar.baz.buzz 14 14 │ ``` ``` logicalAndCases1.js:13:1 lint/complexity/useOptionalChain FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! Change to an optional chain. 11 │ // case with a jump (i.e. a non-nullish prop) 12 │ foo && foo.bar && foo.bar.baz.buzz > 13 │ foo.bar && foo.bar.baz.buzz │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ 14 │ 15 │ // case where for some reason there is a doubled up expression i Unsafe fix: Change to an optional chain. 11 11 │ // case with a jump (i.e. a non-nullish prop) 12 12 │ foo && foo.bar && foo.bar.baz.buzz 13 │ - foo.bar·&&·foo.bar.baz.buzz 13 │ + foo.bar?.baz.buzz 14 14 │ 15 15 │ // case where for some reason there is a doubled up expression ``` ``` logicalAndCases1.js:16:1 lint/complexity/useOptionalChain FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! Change to an optional chain. 15 │ // case where for some reason there is a doubled up expression > 16 │ foo && foo.bar && foo.bar.baz && foo.bar.baz && foo.bar.baz.buzz │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 17 │ foo.bar && foo.bar.baz && foo.bar.baz && foo.bar.baz.buzz 18 │ i Unsafe fix: Change to an optional chain. 14 14 │ 15 15 │ // case where for some reason there is a doubled up expression 16 │ - foo·&&·foo.bar·&&·foo.bar.baz·&&·foo.bar.baz·&&·foo.bar.baz.buzz 16 │ + foo?.bar?.baz?.buzz 17 17 │ foo.bar && foo.bar.baz && foo.bar.baz && foo.bar.baz.buzz 18 18 │ ``` ``` logicalAndCases1.js:17:1 lint/complexity/useOptionalChain FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! Change to an optional chain. 15 │ // case where for some reason there is a doubled up expression 16 │ foo && foo.bar && foo.bar.baz && foo.bar.baz && foo.bar.baz.buzz > 17 │ foo.bar && foo.bar.baz && foo.bar.baz && foo.bar.baz.buzz │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 18 │ 19 │ // chained members with element access i Unsafe fix: Change to an optional chain. 15 15 │ // case where for some reason there is a doubled up expression 16 16 │ foo && foo.bar && foo.bar.baz && foo.bar.baz && foo.bar.baz.buzz 17 │ - foo.bar·&&·foo.bar.baz·&&·foo.bar.baz·&&·foo.bar.baz.buzz 17 │ + foo.bar?.baz?.buzz 18 18 │ 19 19 │ // chained members with element access ``` ``` logicalAndCases1.js:20:1 lint/complexity/useOptionalChain FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! Change to an optional chain. 19 │ // chained members with element access > 20 │ foo && foo[bar] && foo[bar].baz && foo[bar].baz.buzz │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 21 │ 22 │ // case with a jump (i.e. a non-nullish prop) i Unsafe fix: Change to an optional chain. 18 18 │ 19 19 │ // chained members with element access 20 │ - foo·&&·foo[bar]·&&·foo[bar].baz·&&·foo[bar].baz.buzz 20 │ + foo?.[bar]?.baz?.buzz 21 21 │ 22 22 │ // case with a jump (i.e. a non-nullish prop) ``` ``` logicalAndCases1.js:23:1 lint/complexity/useOptionalChain FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! Change to an optional chain. 22 │ // case with a jump (i.e. a non-nullish prop) > 23 │ foo && foo[bar].baz && foo[bar].baz.buzz │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 24 │ 25 │ // chained calls i Unsafe fix: Change to an optional chain. 21 21 │ 22 22 │ // case with a jump (i.e. a non-nullish prop) 23 │ - foo·&&·foo[bar].baz·&&·foo[bar].baz.buzz 23 │ + foo?.[bar].baz?.buzz 24 24 │ 25 25 │ // chained calls ``` ``` logicalAndCases1.js:26:1 lint/complexity/useOptionalChain FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! Change to an optional chain. 25 │ // chained calls > 26 │ foo && foo.bar && foo.bar.baz && foo.bar.baz.buzz() │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 27 │ foo && foo.bar && foo.bar.baz && foo.bar.baz.buzz && foo.bar.baz.buzz() 28 │ foo.bar && foo.bar.baz && foo.bar.baz.buzz && foo.bar.baz.buzz() i Unsafe fix: Change to an optional chain. 24 24 │ 25 25 │ // chained calls 26 │ - foo·&&·foo.bar·&&·foo.bar.baz·&&·foo.bar.baz.buzz() 26 │ + foo?.bar?.baz?.buzz() 27 27 │ foo && foo.bar && foo.bar.baz && foo.bar.baz.buzz && foo.bar.baz.buzz() 28 28 │ foo.bar && foo.bar.baz && foo.bar.baz.buzz && foo.bar.baz.buzz() ``` ``` logicalAndCases1.js:27:1 lint/complexity/useOptionalChain FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! Change to an optional chain. 25 │ // chained calls 26 │ foo && foo.bar && foo.bar.baz && foo.bar.baz.buzz() > 27 │ foo && foo.bar && foo.bar.baz && foo.bar.baz.buzz && foo.bar.baz.buzz() │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 28 │ foo.bar && foo.bar.baz && foo.bar.baz.buzz && foo.bar.baz.buzz() 29 │ i Unsafe fix: Change to an optional chain. 25 25 │ // chained calls 26 26 │ foo && foo.bar && foo.bar.baz && foo.bar.baz.buzz() 27 │ - foo·&&·foo.bar·&&·foo.bar.baz·&&·foo.bar.baz.buzz·&&·foo.bar.baz.buzz() 27 │ + foo?.bar?.baz?.buzz?.() 28 28 │ foo.bar && foo.bar.baz && foo.bar.baz.buzz && foo.bar.baz.buzz() 29 29 │ ``` ``` logicalAndCases1.js:28:1 lint/complexity/useOptionalChain FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! Change to an optional chain. 26 │ foo && foo.bar && foo.bar.baz && foo.bar.baz.buzz() 27 │ foo && foo.bar && foo.bar.baz && foo.bar.baz.buzz && foo.bar.baz.buzz() > 28 │ foo.bar && foo.bar.baz && foo.bar.baz.buzz && foo.bar.baz.buzz() │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 29 │ 30 │ // case with a jump (i.e. a non-nullish prop) i Unsafe fix: Change to an optional chain. 26 26 │ foo && foo.bar && foo.bar.baz && foo.bar.baz.buzz() 27 27 │ foo && foo.bar && foo.bar.baz && foo.bar.baz.buzz && foo.bar.baz.buzz() 28 │ - foo.bar·&&·foo.bar.baz·&&·foo.bar.baz.buzz·&&·foo.bar.baz.buzz() 28 │ + foo.bar?.baz?.buzz?.() 29 29 │ 30 30 │ // case with a jump (i.e. a non-nullish prop) ``` ``` logicalAndCases1.js:31:1 lint/complexity/useOptionalChain FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! Change to an optional chain. 30 │ // case with a jump (i.e. a non-nullish prop) > 31 │ foo && foo.bar && foo.bar.baz.buzz() │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 32 │ foo.bar && foo.bar.baz.buzz() 33 │ i Unsafe fix: Change to an optional chain. 29 29 │ 30 30 │ // case with a jump (i.e. a non-nullish prop) 31 │ - foo·&&·foo.bar·&&·foo.bar.baz.buzz() 31 │ + foo?.bar?.baz.buzz() 32 32 │ foo.bar && foo.bar.baz.buzz() 33 33 │ ``` ``` logicalAndCases1.js:32:1 lint/complexity/useOptionalChain FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! Change to an optional chain. 30 │ // case with a jump (i.e. a non-nullish prop) 31 │ foo && foo.bar && foo.bar.baz.buzz() > 32 │ foo.bar && foo.bar.baz.buzz() │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 33 │ 34 │ // case with a jump (i.e. a non-nullish prop) i Unsafe fix: Change to an optional chain. 30 30 │ // case with a jump (i.e. a non-nullish prop) 31 31 │ foo && foo.bar && foo.bar.baz.buzz() 32 │ - foo.bar·&&·foo.bar.baz.buzz() 32 │ + foo.bar?.baz.buzz() 33 33 │ 34 34 │ // case with a jump (i.e. a non-nullish prop) ``` ``` logicalAndCases1.js:35:1 lint/complexity/useOptionalChain FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! Change to an optional chain. 34 │ // case with a jump (i.e. a non-nullish prop) > 35 │ foo && foo.bar && foo.bar.baz.buzz && foo.bar.baz.buzz() │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 36 │ 37 │ // case with a call expr inside the chain for some inefficient reason i Unsafe fix: Change to an optional chain. 33 33 │ 34 34 │ // case with a jump (i.e. a non-nullish prop) 35 │ - foo·&&·foo.bar·&&·foo.bar.baz.buzz·&&·foo.bar.baz.buzz() 35 │ + foo?.bar?.baz.buzz?.() 36 36 │ 37 37 │ // case with a call expr inside the chain for some inefficient reason ``` ``` logicalAndCases1.js:38:1 lint/complexity/useOptionalChain FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! Change to an optional chain. 37 │ // case with a call expr inside the chain for some inefficient reason > 38 │ foo && foo.bar() && foo.bar().baz && foo.bar().baz.buzz && foo.bar().baz.buzz() │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 39 │ 40 │ // chained calls with element access i Unsafe fix: Change to an optional chain. 36 36 │ 37 37 │ // case with a call expr inside the chain for some inefficient reason 38 │ - foo·&&·foo.bar()·&&·foo.bar().baz·&&·foo.bar().baz.buzz·&&·foo.bar().baz.buzz() 38 │ + foo?.bar()?.baz?.buzz?.() 39 39 │ 40 40 │ // chained calls with element access ``` ``` logicalAndCases1.js:41:1 lint/complexity/useOptionalChain FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! Change to an optional chain. 40 │ // chained calls with element access > 41 │ foo && foo.bar && foo.bar.baz && foo.bar.baz[buzz]() │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 42 │ foo && foo.bar && foo.bar.baz && foo.bar.baz[buzz] && foo.bar.baz[buzz]() 43 │ i Unsafe fix: Change to an optional chain. 39 39 │ 40 40 │ // chained calls with element access 41 │ - foo·&&·foo.bar·&&·foo.bar.baz·&&·foo.bar.baz[buzz]() 41 │ + foo?.bar?.baz?.[buzz]() 42 42 │ foo && foo.bar && foo.bar.baz && foo.bar.baz[buzz] && foo.bar.baz[buzz]() 43 43 │ ``` ``` logicalAndCases1.js:42:1 lint/complexity/useOptionalChain FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! Change to an optional chain. 40 │ // chained calls with element access 41 │ foo && foo.bar && foo.bar.baz && foo.bar.baz[buzz]() > 42 │ foo && foo.bar && foo.bar.baz && foo.bar.baz[buzz] && foo.bar.baz[buzz]() │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 43 │ 44 │ // (partially) pre-optional chained i Unsafe fix: Change to an optional chain. 40 40 │ // chained calls with element access 41 41 │ foo && foo.bar && foo.bar.baz && foo.bar.baz[buzz]() 42 │ - foo·&&·foo.bar·&&·foo.bar.baz·&&·foo.bar.baz[buzz]·&&·foo.bar.baz[buzz]() 42 │ + foo?.bar?.baz?.[buzz]?.() 43 43 │ 44 44 │ // (partially) pre-optional chained ``` ``` logicalAndCases1.js:45:1 lint/complexity/useOptionalChain FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! Change to an optional chain. 44 │ // (partially) pre-optional chained > 45 │ foo && foo?.bar && foo?.bar.baz && foo?.bar.baz[buzz] && foo?.bar.baz[buzz]() │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 46 │ foo && foo?.bar.baz && foo?.bar.baz[buzz] 47 │ foo && foo?.() && foo?.().bar i Unsafe fix: Change to an optional chain. 43 43 │ 44 44 │ // (partially) pre-optional chained 45 │ - foo·&&·foo?.bar·&&·foo?.bar.baz·&&·foo?.bar.baz[buzz]·&&·foo?.bar.baz[buzz]() 45 │ + foo?.bar?.baz?.[buzz]?.() 46 46 │ foo && foo?.bar.baz && foo?.bar.baz[buzz] 47 47 │ foo && foo?.() && foo?.().bar ``` ``` logicalAndCases1.js:46:1 lint/complexity/useOptionalChain FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! Change to an optional chain. 44 │ // (partially) pre-optional chained 45 │ foo && foo?.bar && foo?.bar.baz && foo?.bar.baz[buzz] && foo?.bar.baz[buzz]() > 46 │ foo && foo?.bar.baz && foo?.bar.baz[buzz] │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 47 │ foo && foo?.() && foo?.().bar 48 │ foo.bar && foo.bar?.() && foo.bar?.().baz i Unsafe fix: Change to an optional chain. 46 │ foo·&&·foo?.bar.baz·&&·foo?.bar.baz[buzz] │ ------- ------- ------- ``` ``` logicalAndCases1.js:47:1 lint/complexity/useOptionalChain FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! Change to an optional chain. 45 │ foo && foo?.bar && foo?.bar.baz && foo?.bar.baz[buzz] && foo?.bar.baz[buzz]() 46 │ foo && foo?.bar.baz && foo?.bar.baz[buzz] > 47 │ foo && foo?.() && foo?.().bar │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 48 │ foo.bar && foo.bar?.() && foo.bar?.().baz 49 │ i Unsafe fix: Change to an optional chain. 47 │ foo·&&·foo?.()·&&·foo?.().bar │ ------- ------- --- ``` ``` logicalAndCases1.js:48:1 lint/complexity/useOptionalChain FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! Change to an optional chain. 46 │ foo && foo?.bar.baz && foo?.bar.baz[buzz] 47 │ foo && foo?.() && foo?.().bar > 48 │ foo.bar && foo.bar?.() && foo.bar?.().baz │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 49 │ i Unsafe fix: Change to an optional chain. 48 │ foo.bar·&&·foo.bar?.()·&&·foo.bar?.().baz │ ----------- ----------- --- ``` ``` logicalAndCases1.js:54:1 lint/complexity/useOptionalChain FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! Change to an optional chain. 53 │ // chained members > 54 │ foo && foo.bar && bing │ ^^^^^^^^^^^^^^ 55 │ foo.bar && foo.bar.baz && bing 56 │ foo && foo() && bing i Unsafe fix: Change to an optional chain. 52 52 │ 53 53 │ // chained members 54 │ - foo·&&·foo.bar·&&·bing 54 │ + foo?.bar·&&·bing 55 55 │ foo.bar && foo.bar.baz && bing 56 56 │ foo && foo() && bing ``` ``` logicalAndCases1.js:55:1 lint/complexity/useOptionalChain FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! Change to an optional chain. 53 │ // chained members 54 │ foo && foo.bar && bing > 55 │ foo.bar && foo.bar.baz && bing │ ^^^^^^^^^^^^^^^^^^^^^^ 56 │ foo && foo() && bing 57 │ foo.bar && foo.bar() && bing i Unsafe fix: Change to an optional chain. 53 53 │ // chained members 54 54 │ foo && foo.bar && bing 55 │ - foo.bar·&&·foo.bar.baz·&&·bing 55 │ + foo.bar?.baz·&&·bing 56 56 │ foo && foo() && bing 57 57 │ foo.bar && foo.bar() && bing ``` ``` logicalAndCases1.js:56:1 lint/complexity/useOptionalChain FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! Change to an optional chain. 54 │ foo && foo.bar && bing 55 │ foo.bar && foo.bar.baz && bing > 56 │ foo && foo() && bing │ ^^^^^^^^^^^^ 57 │ foo.bar && foo.bar() && bing 58 │ foo && foo.bar && foo.bar.baz && foo.bar.baz.buzz && bing i Unsafe fix: Change to an optional chain. 54 54 │ foo && foo.bar && bing 55 55 │ foo.bar && foo.bar.baz && bing 56 │ - foo·&&·foo()·&&·bing 56 │ + foo?.()·&&·bing 57 57 │ foo.bar && foo.bar() && bing 58 58 │ foo && foo.bar && foo.bar.baz && foo.bar.baz.buzz && bing ``` ``` logicalAndCases1.js:57:1 lint/complexity/useOptionalChain FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! Change to an optional chain. 55 │ foo.bar && foo.bar.baz && bing 56 │ foo && foo() && bing > 57 │ foo.bar && foo.bar() && bing │ ^^^^^^^^^^^^^^^^^^^^ 58 │ foo && foo.bar && foo.bar.baz && foo.bar.baz.buzz && bing 59 │ foo.bar && foo.bar.baz && foo.bar.baz.buzz && bing i Unsafe fix: Change to an optional chain. 55 55 │ foo.bar && foo.bar.baz && bing 56 56 │ foo && foo() && bing 57 │ - foo.bar·&&·foo.bar()·&&·bing 57 │ + foo.bar?.()·&&·bing 58 58 │ foo && foo.bar && foo.bar.baz && foo.bar.baz.buzz && bing 59 59 │ foo.bar && foo.bar.baz && foo.bar.baz.buzz && bing ``` ``` logicalAndCases1.js:58:1 lint/complexity/useOptionalChain FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! Change to an optional chain. 56 │ foo && foo() && bing 57 │ foo.bar && foo.bar() && bing > 58 │ foo && foo.bar && foo.bar.baz && foo.bar.baz.buzz && bing │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 59 │ foo.bar && foo.bar.baz && foo.bar.baz.buzz && bing 60 │ i Unsafe fix: Change to an optional chain. 56 56 │ foo && foo() && bing 57 57 │ foo.bar && foo.bar() && bing 58 │ - foo·&&·foo.bar·&&·foo.bar.baz·&&·foo.bar.baz.buzz·&&·bing 58 │ + foo?.bar?.baz?.buzz·&&·bing 59 59 │ foo.bar && foo.bar.baz && foo.bar.baz.buzz && bing 60 60 │ ``` ``` logicalAndCases1.js:59:1 lint/complexity/useOptionalChain FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! Change to an optional chain. 57 │ foo.bar && foo.bar() && bing 58 │ foo && foo.bar && foo.bar.baz && foo.bar.baz.buzz && bing > 59 │ foo.bar && foo.bar.baz && foo.bar.baz.buzz && bing │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 60 │ i Unsafe fix: Change to an optional chain. 57 57 │ foo.bar && foo.bar() && bing 58 58 │ foo && foo.bar && foo.bar.baz && foo.bar.baz.buzz && bing 59 │ - foo.bar·&&·foo.bar.baz·&&·foo.bar.baz.buzz·&&·bing 59 │ + foo.bar?.baz?.buzz·&&·bing 60 60 │ ```