Skip to content

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

Closed
@mdnsk

Description

@mdnsk

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,
    }],
  }
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions