jsx-eslint/eslint-plugin-react

jsx-one-expression-per-line should ignore inline elements

Open

#1,848 建立於 2018年6月25日

在 GitHub 查看
 (22 留言) (52 反應) (0 負責人)JavaScript (2,797 fork)batch import
help wanted

倉庫指標

Star
 (8,630 star)
PR 合併指標
 (30 天內沒有已合併 PR)

描述

It doesn't seem to make sense to one-line inline elements.

For example, one-lining the em element in the example below doesn't make sense.

<Styled.PasswordInstructions errored={ !!formErrors.userPassword }>
  Passwords must be at least 8 characters long and can&apos;t be
  things like <em>password</em>, <em>123456</em> or <em>abcdef</em>.
</Styled.PasswordInstructions>

Here is the "fixed" version.

<Styled.PasswordInstructions errored={ !!formErrors.userPassword }>
  Passwords must be at least 8 characters long and can&apos;t be
  things like
  <em>
    password
  </em>
  ,
  <em>
    123456
  </em>
  or
  <em>
    abcdef
  </em>
  .
</Styled.PasswordInstructions>

I could also see an option allowing the developer to choose which elements to ignore along with an ignoreInline option.

貢獻者指南