|
136 | 136 | const item = {}; |
137 | 137 | ``` |
138 | 138 |
|
139 | | - - [3.2](#3.2) <a name='3.2'></a> Don't use [reserved words](http://es5.github.io/#x7.6.1) as keys. It won't work in IE8. [More info](https://github.com/pebble {code}/javascript/issues/61). |
| 139 | + - [3.2](#3.2) <a name='3.2'></a> Don't use [reserved words](http://es5.github.io/#x7.6.1) as keys. It won't work in IE8. [More info](https://github.com/pebblecode/javascript/issues/61). |
140 | 140 |
|
141 | 141 | ```javascript |
142 | 142 | // bad |
|
400 | 400 | ``` |
401 | 401 |
|
402 | 402 | - [6.2](#6.2) <a name='6.2'></a> Strings longer than 80 characters should be written across multiple lines using string concatenation. |
403 | | - - [6.3](#6.3) <a name='6.3'></a> Note: If overused, long strings with concatenation could impact performance. [jsPerf](http://jsperf.com/ya-string-concat) & [Discussion](https://github.com/pebble {code}/javascript/issues/40). |
| 403 | + - [6.3](#6.3) <a name='6.3'></a> Note: If overused, long strings with concatenation could impact performance. [jsPerf](http://jsperf.com/ya-string-concat) & [Discussion](https://github.com/pebblecode/javascript/issues/40). |
404 | 404 |
|
405 | 405 | ```javascript |
406 | 406 | // bad |
|
725 | 725 |
|
726 | 726 | ```javascript |
727 | 727 | // bad |
728 | | - const pebble {code}StyleGuide = require('./pebble {code}StyleGuide'); |
729 | | - module.exports = pebble {code}StyleGuide.es6; |
| 728 | + const pebbleCodeStyleGuide = require('./pebbleCodeStyleGuide'); |
| 729 | + module.exports = pebbleCodeStyleGuide.es6; |
730 | 730 |
|
731 | 731 | // ok |
732 | | - import pebble {code}StyleGuide from './pebble {code}StyleGuide'; |
733 | | - export default pebble {code}StyleGuide.es6; |
| 732 | + import pebbleCodeStyleGuide from './pebbleCodeStyleGuide'; |
| 733 | + export default pebbleCodeStyleGuide.es6; |
734 | 734 |
|
735 | 735 | // best |
736 | | - import { es6 } from './pebble {code}StyleGuide'; |
| 736 | + import { es6 } from './pebbleCodeStyleGuide'; |
737 | 737 | export default es6; |
738 | 738 | ``` |
739 | 739 |
|
|
743 | 743 |
|
744 | 744 | ```javascript |
745 | 745 | // bad |
746 | | - import * as pebble {code}StyleGuide from './pebble {code}StyleGuide'; |
| 746 | + import * as pebbleCodeStyleGuide from './pebbleCodeStyleGuide'; |
747 | 747 |
|
748 | 748 | // good |
749 | | - import pebble {code}StyleGuide from './pebble {code}StyleGuide'; |
| 749 | + import pebbleCodeStyleGuide from './pebbleCodeStyleGuide'; |
750 | 750 | ``` |
751 | 751 |
|
752 | 752 | - [10.3](#10.3) <a name='10.3'></a>And do not export directly from an import. |
|
756 | 756 | ```javascript |
757 | 757 | // bad |
758 | 758 | // filename es6.js |
759 | | - export { es6 as default } from './pebble {code}StyleGuide'; |
| 759 | + export { es6 as default } from './pebbleCodeStyleGuide'; |
760 | 760 |
|
761 | 761 | // good |
762 | 762 | // filename es6.js |
763 | | - import { es6 } from './pebble {code}StyleGuide'; |
| 763 | + import { es6 } from './pebbleCodeStyleGuide'; |
764 | 764 | export default es6; |
765 | 765 | ``` |
766 | 766 |
|
|
1578 | 1578 | const val = inputValue >> 0; |
1579 | 1579 | ``` |
1580 | 1580 |
|
1581 | | - - [21.5](#21.5) <a name='21.5'></a> **Note:** Be careful when using bitshift operations. Numbers are represented as [64-bit values](http://es5.github.io/#x4.3.19), but Bitshift operations always return a 32-bit integer ([source](http://es5.github.io/#x11.7)). Bitshift can lead to unexpected behavior for integer values larger than 32 bits. [Discussion](https://github.com/pebble {code}/javascript/issues/109). Largest signed 32-bit Int is 2,147,483,647: |
| 1581 | + - [21.5](#21.5) <a name='21.5'></a> **Note:** Be careful when using bitshift operations. Numbers are represented as [64-bit values](http://es5.github.io/#x4.3.19), but Bitshift operations always return a 32-bit integer ([source](http://es5.github.io/#x11.7)). Bitshift can lead to unexpected behavior for integer values larger than 32 bits. [Discussion](https://github.com/pebbleCode/javascript/issues/109). Largest signed 32-bit Int is 2,147,483,647: |
1582 | 1582 |
|
1583 | 1583 | ```javascript |
1584 | 1584 | 2147483647 >> 0 //=> 2147483647 |
|
1726 | 1726 | - [22.8](#22.8) <a name='22.8'></a> Use PascalCase when you export a singleton / function library / bare object. |
1727 | 1727 |
|
1728 | 1728 | ```javascript |
1729 | | - const pebble {code}StyleGuide = { |
| 1729 | + const pebbleCodeStyleGuide = { |
1730 | 1730 | es6: { |
1731 | 1731 | } |
1732 | 1732 | }; |
1733 | 1733 |
|
1734 | | - export default pebble {code}StyleGuide; |
| 1734 | + export default pebbleCodeStyleGuide; |
1735 | 1735 | ``` |
1736 | 1736 |
|
1737 | 1737 |
|
|
1955 | 1955 | **Tools** |
1956 | 1956 |
|
1957 | 1957 | - Code Style Linters |
1958 | | - + [JSHint](http://www.jshint.com/) - [pebble {code} Style .jshintrc](https://github.com/pebble {code}/javascript/blob/master/linters/jshintrc) |
1959 | | - + [JSCS](https://github.com/jscs-dev/node-jscs) - [pebble {code} Style Preset](https://github.com/jscs-dev/node-jscs/blob/master/presets/pebble {code}.json) |
| 1958 | + + [JSHint](http://www.jshint.com/) - [pebble {code} Style .jshintrc](https://github.com/pebblecode/javascript/blob/master/linters/jshintrc) |
| 1959 | + + [JSCS](https://github.com/jscs-dev/node-jscs) - [pebble {code} Style Preset](https://github.com/jscs-dev/node-jscs/blob/master/presets/airbnb.json) |
1960 | 1960 |
|
1961 | 1961 | **Other Styleguides** |
1962 | 1962 |
|
|
1967 | 1967 | **Other Styles** |
1968 | 1968 |
|
1969 | 1969 | - [Naming this in nested functions](https://gist.github.com/4135065) - Christian Johansen |
1970 | | - - [Conditional Callbacks](https://github.com/pebble {code}/javascript/issues/52) - Ross Allen |
| 1970 | + - [Conditional Callbacks](https://github.com/airbnb/javascript/issues/52) - Ross Allen |
1971 | 1971 | - [Popular JavaScript Coding Conventions on Github](http://sideeffect.kr/popularconvention/#javascript) - JeongHoon Byun |
1972 | 1972 | - [Multiple var statements in JavaScript, not superfluous](http://benalman.com/news/2012/05/multiple-var-statements-javascript/) - Ben Alman |
1973 | 1973 |
|
|
0 commit comments