jsx-eslint/eslint-plugin-react

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

Open

#1,315 建立於 2017年7月22日

在 GitHub 查看
 (6 留言) (6 反應) (0 負責人)JavaScript (8,630 star) (2,797 fork)batch import
bughelp wanted

描述

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).

貢獻者指南

jsx-indent rule doesn't properly validate ternary (?:) expressions with no parens · jsx-eslint/eslint-plugin-react#1315 | Good First Issue