jsx-eslint/eslint-plugin-react

jsx-indent rule doesn't properly validate ternary (?:) expressions with no parens

Open

#1.315 geöffnet am 22. Juli 2017

Auf GitHub ansehen
 (6 Kommentare) (6 Reaktionen) (0 zugewiesene Personen)JavaScript (8.630 Stars) (2.797 Forks)batch import
bughelp wanted

Beschreibung

Prior related issues:

https://github.com/yannickcr/eslint-plugin-react/issues/540 https://github.com/yannickcr/eslint-plugin-react/issues/625

Patterns:

{ condition
  ? <div>
      <div> something </div>
    </div>
  : <div>
      <div> something </div>
    </div>
}

{ condition
    ? <div>
        <div> something </div>
      </div>
    : <div>
        <div> something </div>
      </div>
}

{
  condition
  ? <div>
      <div> something </div>
    </div>
  : <div>
      <div> something </div>
    </div>
}

{
  condition
    ? <div>
        <div> something </div>
      </div>
    : <div>
        <div> something </div>
      </div>
}

Expected behavior: All of these patterns properly validate and flag no errors.

Actual behavior: All of these patterns flag errors for lines following and indented after the ternary result clauses (after ? and : lines).

Contributor Guide