Alignment

  • Follow these alignment styles for JSX syntax. eslint: react/jsx-closing-bracket-location

    1. // bad
    2. <Foo superLongParam="bar"
    3. anotherSuperLongParam="baz" />
    4. // good
    5. <Foo
    6. superLongParam="bar"
    7. anotherSuperLongParam="baz"
    8. />
    9. // if props fit in one line then keep it on the same line
    10. // children get indented normally
    11. <Foo
    12. superLongParam="bar"
    13. anotherSuperLongParam="baz"
    14. >
    15. <Quux />
    16. </Foo>
    17. // bad
    18. {showButton &&
    19. <Button />
    20. // bad
    21. {
    22. showButton &&
    23. <Button />
    24. }
    25. // good
    26. {showButton && (
    27. <Button />
    28. )}
    29. {showButton && <Button />}