Skip to content

Commit

Permalink
Update 17.2 to allow comments in the first line of a block
Browse files Browse the repository at this point in the history
In airbnb#483, justjake said that we should update the style guide to allow
single line comments in the first line of a block.
chrisngobanh authored and dustinmartin committed Jan 4, 2016

Verified

This commit was signed with the committer’s verified signature.
BryanttV Bryann Valderrama
1 parent 2bfb396 commit 947e084
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1248,7 +1248,7 @@ Other Style Guides
}
```
- [17.2](#17.2) <a name='17.2'></a> Use `//` for single line comments. Place single line comments on a newline above the subject of the comment. Put an empty line before the comment.
- [17.2](#17.2) <a name='17.2'></a> Use `//` for single line comments. Place single line comments on a newline above the subject of the comment. Put an empty line before the comment unless it's on the first line of a block.

```javascript
// bad
@@ -1276,6 +1276,14 @@ Other Style Guides
return type;
}
// also good
function getType() {
// set the default type to 'no type'
const type = this._type || 'no type';
return type;
}
```

- [17.3](#17.3) <a name='17.3'></a> Prefixing your comments with `FIXME` or `TODO` helps other developers quickly understand if you're pointing out a problem that needs to be revisited, or if you're suggesting a solution to the problem that needs to be implemented. These are different than regular comments because they are actionable. The actions are `FIXME -- need to figure this out` or `TODO -- need to implement`.

0 comments on commit 947e084

Please sign in to comment.