Eslint-plugin-react: Better formatting for jsx ternary operator

Created on 18 Feb 2016  路  2Comments  路  Source: yannickcr/eslint-plugin-react

Simple rule: One line can contain only JS or HTML exclusively.

{viewer ?
  <b>foo</b>
:
  <b>bar</b>
}

Related to https://github.com/este/este/issues/724

All 2 comments

I kinda like:

{
foo
? <b>bar</b>
: <b>baz</b>
}

I generally prefer to avoid the ternary altogether:

{foo && <b>bar</b>}
{!foo && <b>baz</b>}
Was this page helpful?
0 / 5 - 0 ratings