Skip to content

Commit 5c86d38

Browse files
Merge pull request #3 from chrisfosterelli/misc-changes
Change approval mechanism, standardize comments, standardize component definitions
2 parents dec0049 + 1e07f85 commit 5c86d38

File tree

1 file changed

+53
-12
lines changed

1 file changed

+53
-12
lines changed

README.md

Lines changed: 53 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,10 @@ Thanks to [AirBNB](AirBNB) for heavily inspiring this document.
88
## How to Update This
99

1010
To update this document, make a pull request with your recommended changes. The
11-
pull request must receive a thumbs up emoji (👍) from at least half the active
12-
dev team prior to merging. The pull request itself can be used for discussion,
13-
comments, and iteration on the proposed change.
11+
pull request must receive **an approved review** from at least half the active
12+
development team prior to merging. The pull request itself can be used for
13+
discussion, comments, and iteration on the proposed change. To ensure others
14+
are notified, please request reviews from appropriate developers.
1415

1516
Rules here should be 1) actionable and 2) clearly testable in a PR review.
1617

@@ -45,7 +46,7 @@ why.
4546
- Use a line length of 80 characters.
4647
- Use camelCase when naming objects, functions, and instances.
4748

48-
```jsx
49+
```javascript
4950
// bad
5051
const UsTaxes = 1000
5152
const playerID = 10
@@ -62,7 +63,7 @@ function getUnescoProperties() {}
6263

6364
- Use PascalCase when naming constructors, classes, and components.
6465

65-
```jsx
66+
```javascript
6667
// bad
6768
const myContainer = styled.div`
6869
color: blue;
@@ -76,7 +77,7 @@ const MyContainer = styled.div`
7677

7778
- Group your shorthand properties at the end of your object declaration.
7879

79-
```jsx
80+
```javascript
8081
const anakinSkywalker = 'Anakin Skywalker'
8182
const lukeSkywalker = 'Luke Skywalker'
8283

@@ -106,7 +107,7 @@ const obj = {
106107
- An exception to this is arrow functions, which must be assigned to
107108
variables.
108109

109-
```jsx
110+
```javascript
110111
// bad
111112
const foo = function() {
112113
// ...
@@ -120,7 +121,7 @@ function foo() {
120121

121122
- Never declare functions inside blocks. This might work but is invalid JS.
122123

123-
```jsx
124+
```javascript
124125
// bad
125126
if (currentUser) {
126127
function test() {
@@ -139,7 +140,7 @@ if (currentUser) {
139140

140141
- Always put default parameters last.
141142

142-
```jsx
143+
```javascript
143144
// bad
144145
function handleThings(opts = {}, name) {
145146
// ...
@@ -158,7 +159,7 @@ function handleThings(name, opts = {}) {
158159
UPPERCASE_VARIABLES are letting the programmer know that they can trust
159160
the variable (and its properties) not to change.
160161

161-
```jsx
162+
```javascript
162163
// bad
163164
export const THING_TO_BE_CHANGED = 'should obviously not be uppercased'
164165

@@ -183,7 +184,7 @@ export const API_KEY = 'SOMEKEY'
183184
- Use the `.stories.js` and `test.js` extensions for stories and tests where
184185
applicable.
185186

186-
```jsx
187+
```
187188
// bad
188189
./MyComponent.js
189190
./test/MyComponent.js
@@ -221,14 +222,54 @@ export const API_KEY = 'SOMEKEY'
221222
- We initialize our web applications with create-react-app.
222223
- Next.js and Gatsby are also acceptable.
223224
- Use hooks instead of other state management.
225+
- Use functional components over class components.
226+
227+
```jsx
228+
// bad
229+
class Welcome extends React.Component {
230+
render() {
231+
const greeting = getGreeting()
232+
return <h1>{greeting}</h1>
233+
}
234+
}
235+
236+
// good
237+
function Welcome() {
238+
const greeting = getGreeting()
239+
return <h1>{greeting}</h1>
240+
}
241+
```
242+
243+
- Use named functions over arrow functions unless using an implicit return.
244+
245+
```jsx
246+
// bad
247+
const Welcome = () => {
248+
const greeting = getGreeting()
249+
return (
250+
<h1>{greeting}</h1>
251+
)
252+
}
253+
254+
// good
255+
function Welcome() {
256+
const greeting = getGreeting()
257+
return <h1>{greeting}</h1>
258+
}
259+
260+
// good
261+
const Welcome = () => (
262+
<h1>{getGreeting()}</h1>
263+
)
264+
```
224265

225266
## Component Driven Development
226267

227268
- Practice CDD with Storybook in React applications.
228269
- All component stories should have a `Default` state.
229270
- Put spaces in story component names for consistency with story parsing.
230271

231-
```graphql
272+
```javascript
232273
// bad
233274
export default {
234275
title: 'pages/BrowsePage',

0 commit comments

Comments
 (0)