Skip to content

Commit b60970a

Browse files
committed
Merge pull request airbnb#239 from TheSavior/block-spacing
Adding comments about spacing between blocks
2 parents 4503923 + 80e698e commit b60970a

File tree

1 file changed

+39
-1
lines changed

1 file changed

+39
-1
lines changed

README.md

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@
369369
- Use one `var` declaration per variable.
370370
It's easier to add new variable declarations this way, and you never have
371371
to worry about swapping out a `;` for a `,` or introducing punctuation-only
372-
diffs.
372+
diffs.
373373
374374
```javascript
375375
// bad
@@ -854,6 +854,44 @@
854854
.call(tron.led);
855855
```
856856

857+
- Leave a blank line after blocks and before the next statement
858+
859+
```javascript
860+
// bad
861+
if (foo) {
862+
return bar;
863+
}
864+
return baz;
865+
866+
// good
867+
if (foo) {
868+
return bar;
869+
}
870+
871+
return baz
872+
873+
// bad
874+
var obj = {
875+
foo: function() {
876+
},
877+
bar: function() {
878+
}
879+
};
880+
return obj;
881+
882+
// good
883+
var obj = {
884+
foo: function() {
885+
},
886+
887+
bar: function() {
888+
}
889+
};
890+
891+
return obj;
892+
```
893+
894+
857895
**[⬆ back to top](#table-of-contents)**
858896

859897
## Commas

0 commit comments

Comments
 (0)