Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

jsx-indent: add optional indentation to logical expressions #2226

Closed
mdnsk opened this issue Apr 3, 2019 · 0 comments
Closed

jsx-indent: add optional indentation to logical expressions #2226

mdnsk opened this issue Apr 3, 2019 · 0 comments

Comments

@mdnsk
Copy link
Contributor

mdnsk commented Apr 3, 2019

Hello!
In out team we use following style of logical expressions:

<App>
  {condition && (
    <Hello />
  )}
</App>

but jsx-indent rule misses indentation inside of the logical expression, so after running eslint with --fix options it looks like this:

<App>
  {condition && (
  <Hello />
  )}
</App>

So, may be adding of an extra option, will solve my problem? I think it would be something like this:

// .eslintrc.js
module.exports = {
  // ...
  rules: {
    'react/jsx-indent': ['error', 2, {
      indentLogicalExpressions: true,
    }],
  }
}
@mdnsk mdnsk changed the title Add optional indentation to logical expressions jsx-indent: add optional indentation to logical expressions Apr 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants