Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • Overview

    • All variables, functions, props, should be lowerCamelCased

    • Components should be CamelCased

    • Use all single quotes instead of double quotes in js files

    • Spread objects and lists instead of mutating them

    • Some general spacing guidelines are listed below

      Code Block
      languagejs
      // bad
      <Foo/>
      // good 
      <Foo />
      
      // bad
      <Foo bar={ baz } />
      // good
      <Foo bar={baz} />
      
      // bad
      <Foo superLongParam="bar"
           anotherSuperLongParam="baz" />
      
      // good
      <Foo
        superLongParam="bar"
        anotherSuperLongParam="baz"
      />
      
      // if props fit in one line then keep it on the same line
      <Foo bar="bar" />
      
      // children get indented normally
      <Foo
        superLongParam="bar"
        anotherSuperLongParam="baz"
      >
        <Quux />
      </Foo>
    • Always self-close tags that have no children

  • https://airbnb.io/javascript/react/

  • https://medium.com/docon/airbnb-javascript-style-guide-key-takeaways-ffd0370c053

...