---
source: crates/oxc_linter/src/tester.rs
---
  ⚠ eslint-plugin-unicorn(no-lonely-if): Unexpected `if` as the only statement in a `if` block without `else`.
   ╭─[no_lonely_if.tsx:2:9]
 1 │ 
 2 │         if (a) {
   ·         ──
 3 │             if (b) {
   ·             ──
 4 │             }
   ╰────
  help: Move the inner `if` test to the outer `if` test.

  ⚠ eslint-plugin-unicorn(no-lonely-if): Unexpected `if` as the only statement in a `if` block without `else`.
   ╭─[no_lonely_if.tsx:2:9]
 1 │ 
 2 │         if (a) if (b) {
   ·         ──     ──
 3 │             foo();
   ╰────
  help: Move the inner `if` test to the outer `if` test.

  ⚠ eslint-plugin-unicorn(no-lonely-if): Unexpected `if` as the only statement in a `if` block without `else`.
   ╭─[no_lonely_if.tsx:2:9]
 1 │ 
 2 │         if (a) {
   ·         ──
 3 │             if (b) foo();
   ·             ──
 4 │         }
   ╰────
  help: Move the inner `if` test to the outer `if` test.

  ⚠ eslint-plugin-unicorn(no-lonely-if): Unexpected `if` as the only statement in a `if` block without `else`.
   ╭─[no_lonely_if.tsx:1:1]
 1 │ if (a) if (b) foo();
   · ──     ──
   ╰────
  help: Move the inner `if` test to the outer `if` test.

  ⚠ eslint-plugin-unicorn(no-lonely-if): Unexpected `if` as the only statement in a `if` block without `else`.
   ╭─[no_lonely_if.tsx:2:9]
 1 │ 
 2 │         if (a) {
   ·         ──
 3 │             if (b) foo()
   ·             ──
 4 │         }
   ╰────
  help: Move the inner `if` test to the outer `if` test.

  ⚠ eslint-plugin-unicorn(no-lonely-if): Unexpected `if` as the only statement in a `if` block without `else`.
   ╭─[no_lonely_if.tsx:1:1]
 1 │ if (a) if (b);
   · ──     ──
   ╰────
  help: Move the inner `if` test to the outer `if` test.

  ⚠ eslint-plugin-unicorn(no-lonely-if): Unexpected `if` as the only statement in a `if` block without `else`.
   ╭─[no_lonely_if.tsx:6:16]
 5 │             }
 6 │         } else if (c) {
   ·                ──
 7 │             if (d) {
   ·             ──
 8 │             }
   ╰────
  help: Move the inner `if` test to the outer `if` test.

  ⚠ eslint-plugin-unicorn(no-lonely-if): Unexpected `if` as the only statement in a `if` block without `else`.
   ╭─[no_lonely_if.tsx:3:13]
 2 │         function * foo() {
 3 │             if (a || b)
   ·             ──
 4 │             if (a ?? b)
   ·             ──
 5 │             if (a ? b : c)
   ╰────
  help: Move the inner `if` test to the outer `if` test.

  ⚠ eslint-plugin-unicorn(no-lonely-if): Unexpected `if` as the only statement in a `if` block without `else`.
   ╭─[no_lonely_if.tsx:4:13]
 3 │             if (a || b)
 4 │             if (a ?? b)
   ·             ──
 5 │             if (a ? b : c)
   ·             ──
 6 │             if (a = b)
   ╰────
  help: Move the inner `if` test to the outer `if` test.

  ⚠ eslint-plugin-unicorn(no-lonely-if): Unexpected `if` as the only statement in a `if` block without `else`.
   ╭─[no_lonely_if.tsx:5:13]
 4 │             if (a ?? b)
 5 │             if (a ? b : c)
   ·             ──
 6 │             if (a = b)
   ·             ──
 7 │             if (a += b)
   ╰────
  help: Move the inner `if` test to the outer `if` test.

  ⚠ eslint-plugin-unicorn(no-lonely-if): Unexpected `if` as the only statement in a `if` block without `else`.
   ╭─[no_lonely_if.tsx:6:13]
 5 │             if (a ? b : c)
 6 │             if (a = b)
   ·             ──
 7 │             if (a += b)
   ·             ──
 8 │             if (a -= b)
   ╰────
  help: Move the inner `if` test to the outer `if` test.

  ⚠ eslint-plugin-unicorn(no-lonely-if): Unexpected `if` as the only statement in a `if` block without `else`.
   ╭─[no_lonely_if.tsx:7:13]
 6 │             if (a = b)
 7 │             if (a += b)
   ·             ──
 8 │             if (a -= b)
   ·             ──
 9 │             if (a &&= b)
   ╰────
  help: Move the inner `if` test to the outer `if` test.

  ⚠ eslint-plugin-unicorn(no-lonely-if): Unexpected `if` as the only statement in a `if` block without `else`.
    ╭─[no_lonely_if.tsx:8:13]
  7 │             if (a += b)
  8 │             if (a -= b)
    ·             ──
  9 │             if (a &&= b)
    ·             ──
 10 │             if (yield a)
    ╰────
  help: Move the inner `if` test to the outer `if` test.

  ⚠ eslint-plugin-unicorn(no-lonely-if): Unexpected `if` as the only statement in a `if` block without `else`.
    ╭─[no_lonely_if.tsx:9:13]
  8 │             if (a -= b)
  9 │             if (a &&= b)
    ·             ──
 10 │             if (yield a)
    ·             ──
 11 │             if (a, b);
    ╰────
  help: Move the inner `if` test to the outer `if` test.

  ⚠ eslint-plugin-unicorn(no-lonely-if): Unexpected `if` as the only statement in a `if` block without `else`.
    ╭─[no_lonely_if.tsx:10:13]
  9 │             if (a &&= b)
 10 │             if (yield a)
    ·             ──
 11 │             if (a, b);
    ·             ──
 12 │         }
    ╰────
  help: Move the inner `if` test to the outer `if` test.

  ⚠ eslint-plugin-unicorn(no-lonely-if): Unexpected `if` as the only statement in a `if` block without `else`.
   ╭─[no_lonely_if.tsx:3:13]
 2 │         async function foo() {
 3 │             if (a)
   ·             ──
 4 │             if (await a)
   ·             ──
 5 │             if (a.b)
   ╰────
  help: Move the inner `if` test to the outer `if` test.

  ⚠ eslint-plugin-unicorn(no-lonely-if): Unexpected `if` as the only statement in a `if` block without `else`.
   ╭─[no_lonely_if.tsx:4:13]
 3 │             if (a)
 4 │             if (await a)
   ·             ──
 5 │             if (a.b)
   ·             ──
 6 │             if (a && b);
   ╰────
  help: Move the inner `if` test to the outer `if` test.

  ⚠ eslint-plugin-unicorn(no-lonely-if): Unexpected `if` as the only statement in a `if` block without `else`.
   ╭─[no_lonely_if.tsx:5:13]
 4 │             if (await a)
 5 │             if (a.b)
   ·             ──
 6 │             if (a && b);
   ·             ──
 7 │         }
   ╰────
  help: Move the inner `if` test to the outer `if` test.

  ⚠ eslint-plugin-unicorn(no-lonely-if): Unexpected `if` as the only statement in a `if` block without `else`.
   ╭─[no_lonely_if.tsx:2:9]
 1 │ 
 2 │         if // 1
   ·         ──
 3 │         (
   ╰────
    ╭─[no_lonely_if.tsx:10:13]
  9 │             // 6
 10 │             if (
    ·             ──
 11 │                 // 7
    ╰────
  help: Move the inner `if` test to the outer `if` test.

  ⚠ eslint-plugin-unicorn(no-lonely-if): Unexpected `if` as the only statement in a `if` block without `else`.
   ╭─[no_lonely_if.tsx:2:9]
 1 │ 
 2 │         if (a) {
   ·         ──
 3 │             if (b) foo()
   ·             ──
 4 │         }
   ╰────
  help: Move the inner `if` test to the outer `if` test.

  ⚠ eslint-plugin-unicorn(no-lonely-if): Unexpected `if` as the only statement in a `if` block without `else`.
   ╭─[no_lonely_if.tsx:2:9]
 1 │ 
 2 │         if (a)
   ·         ──
 3 │             if (b) foo()
   ·             ──
 4 │         ;[].forEach(bar)
   ╰────
  help: Move the inner `if` test to the outer `if` test.

  ⚠ eslint-plugin-unicorn(no-lonely-if): Unexpected `if` as the only statement in a `if` block without `else`.
   ╭─[no_lonely_if.tsx:2:9]
 1 │ 
 2 │         if (a) {
   ·         ──
 3 │             if (b) foo()
   ·             ──
 4 │         }
   ╰────
  help: Move the inner `if` test to the outer `if` test.
