Commit 8d51bd5
Jake Teton-Landis
Switch from single var to one-var-per-variable
Frontenders at Airbnb at have been discussing this change for a bit, and we've come to favor one-var-per-variable over one-var-only declarations. Two things improve the maintainability of this style over one var for multiple variables: 1. You never have a diff of a line that's removing a `;` and inserting a `,`. 2. You can't accidentally declare global variables because you have a one-character mistake (semicolon instead of comma): ```javascript var foo = 1, bar = 2; baz = 3; // added later and (accidentally) declared globally ```1 parent bae9bc6 commit 8d51bd5
1 file changed
+44
-28
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
50 | 50 | | |
51 | 51 | | |
52 | 52 | | |
53 | | - | |
54 | | - | |
| 53 | + | |
| 54 | + | |
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
| |||
64 | 64 | | |
65 | 65 | | |
66 | 66 | | |
67 | | - | |
68 | | - | |
| 67 | + | |
| 68 | + | |
69 | 69 | | |
70 | 70 | | |
71 | 71 | | |
| |||
151 | 151 | | |
152 | 152 | | |
153 | 153 | | |
154 | | - | |
155 | | - | |
156 | | - | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
157 | 157 | | |
158 | 158 | | |
159 | 159 | | |
| |||
216 | 216 | | |
217 | 217 | | |
218 | 218 | | |
219 | | - | |
220 | | - | |
221 | | - | |
222 | | - | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
223 | 223 | | |
224 | 224 | | |
225 | 225 | | |
| |||
366 | 366 | | |
367 | 367 | | |
368 | 368 | | |
369 | | - | |
| 369 | + | |
370 | 370 | | |
371 | 371 | | |
372 | 372 | | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
373 | 378 | | |
374 | 379 | | |
375 | 380 | | |
| 381 | + | |
376 | 382 | | |
377 | | - | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
378 | 389 | | |
379 | | - | |
| 390 | + | |
380 | 391 | | |
381 | 392 | | |
382 | 393 | | |
| |||
389 | 400 | | |
390 | 401 | | |
391 | 402 | | |
392 | | - | |
393 | | - | |
394 | | - | |
395 | | - | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
396 | 408 | | |
397 | 409 | | |
398 | | - | |
399 | | - | |
400 | | - | |
401 | | - | |
402 | | - | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
403 | 415 | | |
404 | 416 | | |
405 | 417 | | |
| |||
843 | 855 | | |
844 | 856 | | |
845 | 857 | | |
846 | | - | |
| 858 | + | |
| 859 | + | |
847 | 860 | | |
848 | | - | |
| 861 | + | |
| 862 | + | |
849 | 863 | | |
850 | 864 | | |
851 | | - | |
852 | | - | |
853 | | - | |
| 865 | + | |
| 866 | + | |
| 867 | + | |
| 868 | + | |
| 869 | + | |
854 | 870 | | |
855 | 871 | | |
856 | 872 | | |
| |||
0 commit comments