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