Skip to main content

noUselessFragments (since v0.10.0)

Disallow unnecessary fragments

Examples

Invalid

<>
foo
</>
nursery/noUselessFragments.js:1:1 lint/nursery/noUselessFragments ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

   Avoid using unnecessary Fragment.
  
     nursery/noUselessFragments.js:1:1
      
  1   <>
  2   foo
  3   </>
     ^
  
<React.Fragment>
foo
</React.Fragment>
nursery/noUselessFragments.js:1:1 lint/nursery/noUselessFragments ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

   Avoid using unnecessary Fragment.
  
     nursery/noUselessFragments.js:1:1
      
  1   <React.Fragment>
  2   foo
  3   </React.Fragment>
     ^
  
<></>
nursery/noUselessFragments.js:1:1 lint/nursery/noUselessFragments ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

   Avoid using unnecessary Fragment.
  
     nursery/noUselessFragments.js:1:1
    
  1  <></>
     ^^^^^