@@ -228,7 +228,7 @@ const menuConfig = {
228
228
body: ' Bar' ,
229
229
buttonText: ' Baz' ,
230
230
cancellable: true
231
- }
231
+ };
232
232
233
233
function createMenu (config ) {
234
234
// ...
@@ -314,7 +314,7 @@ function parseBetterJSAlternative(code) {
314
314
REGEXES .forEach ((REGEX ) => {
315
315
statements .forEach ((statement ) => {
316
316
// ...
317
- })
317
+ });
318
318
});
319
319
320
320
const ast = [];
@@ -324,7 +324,7 @@ function parseBetterJSAlternative(code) {
324
324
325
325
ast .forEach ((node ) => {
326
326
// parse...
327
- })
327
+ });
328
328
}
329
329
```
330
330
@@ -340,7 +340,7 @@ function tokenize(code) {
340
340
REGEXES .forEach ((REGEX ) => {
341
341
statements .forEach ((statement ) => {
342
342
tokens .push ( /* ... */ );
343
- })
343
+ });
344
344
});
345
345
346
346
return tokens;
@@ -360,7 +360,7 @@ function parseBetterJSAlternative(code) {
360
360
const ast = lexer (tokens);
361
361
ast .forEach ((node ) => {
362
362
// parse...
363
- })
363
+ });
364
364
}
365
365
```
366
366
** [ ⬆ back to top] ( #table-of-contents ) **
@@ -441,12 +441,12 @@ const menuConfig = {
441
441
body: ' Bar' ,
442
442
buttonText: null ,
443
443
cancellable: true
444
- }
444
+ };
445
445
446
446
function createMenu (config ) {
447
- config .title = config .title || ' Foo'
448
- config .body = config .body || ' Bar'
449
- config .buttonText = config .buttonText || ' Baz'
447
+ config .title = config .title || ' Foo' ;
448
+ config .body = config .body || ' Bar' ;
449
+ config .buttonText = config .buttonText || ' Baz' ;
450
450
config .cancellable = config .cancellable === undefined ? config .cancellable : true ;
451
451
452
452
}
@@ -461,7 +461,7 @@ const menuConfig = {
461
461
// User did not include 'body' key
462
462
buttonText: ' Send' ,
463
463
cancellable: true
464
- }
464
+ };
465
465
466
466
function createMenu (config ) {
467
467
config = Object .assign ({
@@ -543,7 +543,7 @@ function splitIntoFirstAndLastName(name) {
543
543
return name .split (' ' );
544
544
}
545
545
546
- const name = ' Ryan McDermott'
546
+ const name = ' Ryan McDermott' ;
547
547
const newName = splitIntoFirstAndLastName (name);
548
548
549
549
console .log (name); // 'Ryan McDermott';
@@ -579,7 +579,7 @@ Array.prototype.diff = function diff(comparisonArray) {
579
579
}
580
580
581
581
return values;
582
- }
582
+ };
583
583
```
584
584
585
585
** Good:**
@@ -952,11 +952,11 @@ This can be accomplished through closures (for ES5 and below).
952
952
953
953
const Employee = function (name ) {
954
954
this .name = name;
955
- }
955
+ };
956
956
957
957
Employee .prototype .getName = function getName () {
958
958
return this .name ;
959
- }
959
+ };
960
960
961
961
const employee = new Employee (' John Doe' );
962
962
console .log (` Employee name: ${ employee .getName ()} ` ); // Employee name: John Doe
@@ -1026,7 +1026,7 @@ class UserAuth {
1026
1026
class UserSettings {
1027
1027
constructor (user ) {
1028
1028
this .user = user;
1029
- this .auth = new UserAuth (user)
1029
+ this .auth = new UserAuth (user);
1030
1030
}
1031
1031
1032
1032
changeSettings (settings ) {
@@ -1145,7 +1145,7 @@ function renderLargeRectangles(rectangles) {
1145
1145
rectangle .setHeight (5 );
1146
1146
const area = rectangle .getArea (); // BAD: Will return 25 for Square. Should be 20.
1147
1147
rectangle .render (area);
1148
- })
1148
+ });
1149
1149
}
1150
1150
1151
1151
const rectangles = [new Rectangle (), new Rectangle (), new Square ()];
@@ -1214,7 +1214,7 @@ function renderLargeShapes(shapes) {
1214
1214
1215
1215
const area = shape .getArea ();
1216
1216
shape .render (area);
1217
- })
1217
+ });
1218
1218
}
1219
1219
1220
1220
const shapes = [new Rectangle (), new Rectangle (), new Square ()];
@@ -1505,7 +1505,7 @@ class Car {
1505
1505
const car = new Car ();
1506
1506
car .setColor (' pink' );
1507
1507
car .setMake (' Ford' );
1508
- car .setModel (' F-150' )
1508
+ car .setModel (' F-150' );
1509
1509
car .save ();
1510
1510
```
1511
1511
@@ -1703,9 +1703,9 @@ require('request').get('https://en.wikipedia.org/wiki/Robert_Cecil_Martin', (req
1703
1703
} else {
1704
1704
console .log (' File written' );
1705
1705
}
1706
- })
1706
+ });
1707
1707
}
1708
- })
1708
+ });
1709
1709
1710
1710
```
1711
1711
@@ -1720,7 +1720,7 @@ require('request-promise').get('https://en.wikipedia.org/wiki/Robert_Cecil_Marti
1720
1720
})
1721
1721
.catch ((err ) => {
1722
1722
console .error (err);
1723
- })
1723
+ });
1724
1724
1725
1725
```
1726
1726
** [ ⬆ back to top] ( #table-of-contents ) **
@@ -1743,15 +1743,15 @@ require('request-promise').get('https://en.wikipedia.org/wiki/Robert_Cecil_Marti
1743
1743
})
1744
1744
.catch ((err ) => {
1745
1745
console .error (err);
1746
- })
1746
+ });
1747
1747
1748
1748
```
1749
1749
1750
1750
** Good** :
1751
1751
``` javascript
1752
1752
async function getCleanCodeArticle () {
1753
1753
try {
1754
- const request = await require (' request-promise' )
1754
+ const request = await require (' request-promise' );
1755
1755
const response = await request .get (' https://en.wikipedia.org/wiki/Robert_Cecil_Martin' );
1756
1756
const fileHandle = await require (' fs-promise' );
1757
1757
@@ -2075,7 +2075,7 @@ $scope.model = {
2075
2075
// //////////////////////////////////////////////////////////////////////////////
2076
2076
const actions = function () {
2077
2077
// ...
2078
- }
2078
+ };
2079
2079
```
2080
2080
2081
2081
** Good** :
@@ -2087,6 +2087,6 @@ $scope.model = {
2087
2087
2088
2088
const actions = function () {
2089
2089
// ...
2090
- }
2090
+ };
2091
2091
```
2092
2092
** [ ⬆ back to top] ( #table-of-contents ) **
0 commit comments