Skip to content

react/jsx-indent not working when using string literal as a child #1136

Closed
@dnalborczyk

Description

@dnalborczyk

eslint 3.19.0, eslint-plugin-react 6.10.3

setting:

rules
  react/jsx-indent: [ error, 2 ]

minimal test using a string literal which causes no error:

(
  <div>
  1
  <div>Car</div>
  </div>
)

expected this to be correct:

(
  <div>
    1
    <div>Car</div>
  </div>
)

though the error is correctly thrown when you are using an expression:

(
  <div>
  {`1`}
  <div>Car</div>
  </div>
)
22:3  error  Expected indentation of 4 space characters but found 2  react/jsx-indent
23:3  error  Expected indentation of 4 space characters but found 2  react/jsx-indent

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