Alignment 代码对齐

  • 遵循以下的JSX语法缩进/格式. eslint: react/jsx-closing-bracket-location react/jsx-closing-tag-location

    1. // bad
    2. <Foo superLongParam="bar"
    3. anotherSuperLongParam="baz" />
    4. // good, 有多行属性的话, 新建一行关闭标签
    5. <Foo
    6. superLongParam="bar"
    7. anotherSuperLongParam="baz"
    8. />
    9. // 若能在一行中显示, 直接写成一行
    10. <Foo bar="bar" />
    11. // 子元素按照常规方式缩进
    12. <Foo
    13. superLongParam="bar"
    14. anotherSuperLongParam="baz"
    15. >
    16. <Quux />
    17. </Foo>