File containing JavaScript must have ".js" extension.
Bad:
index.jsx
Good:
index.js
- Must be written on multiple lines.
Bad:
import {Component, PropTypes} from 'react';
Good:
import {
Component,
PropTypes
} from 'react';
Reason:
Consistent with variable declaration.
- Must be written without using
()
. - Must start inline with the owner of the resuting object.
Bad:
return (
<div>
<p>Hello, World!</p>
</div>
);
let foo;
foo =
<div>
<p>Hello, World!</p>
</div>;
Good:
return <div>
<p>Hello, World!</p>
</div>;
let foo;
foo = <div>
<p>Hello, World!</p>
</div>;
- Must use ES7
static
keyword to declara static properties.
Bad:
class Foo {}
Foo.bar = 'BAR';
Good:
class Foo {
static bar = 'BAR';
}