Skip to content

Commit 45759fc

Browse files
authored
Added bigint primitive. Added section about import extensions. Added rationale about destructuring. Fixed typos
1 parent 44700ce commit 45759fc

File tree

1 file changed

+27
-8
lines changed

1 file changed

+27
-8
lines changed

README.md

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,8 @@
151151
- [10.2](#modules--no-duplicate-imports) Duplicate imports
152152
- [10.3](#modules--no-mutable-exports) Mutable exports
153153
- [10.4](#modules--imports-first) Imports first
154-
- [10.5](#modules--multiline-imports-over-newlines) Multiline imports
154+
- [10.5](#modules--import-extensions) Imports extensions
155+
- [10.6](#modules--multiline-imports-over-newlines) Multiline imports
155156

156157
</details>
157158

@@ -440,6 +441,7 @@
440441
- `null`
441442
- `undefined`
442443
- `symbol`
444+
- `bigint`
443445

444446
```javascript
445447
const foo = 1;
@@ -450,7 +452,7 @@
450452
console.log(foo, bar); // => 1, 9
451453
```
452454

453-
- Symbols cannot be faithfully polyfilled, so they should not be used when targeting browsers/environments that don't support them natively.
455+
- Symbols and BigInts cannot be faithfully polyfilled, so they should not be used when targeting browsers/environments that don't support them natively.
454456
455457
<a name="types--complex"></a><a name="1.2"></a>
456458
- [1.2](#types--complex) **Complex**: When you access a complex type you work on a reference to its value.
@@ -880,7 +882,7 @@
880882
<a name="destructuring--object"></a><a name="5.1"></a>
881883
- [5.1](#destructuring--object) Use object destructuring when accessing and using multiple properties of an object. eslint: [`prefer-destructuring`](https://eslint.org/docs/rules/prefer-destructuring)
882884
883-
> Why? Destructuring saves you from creating temporary references for those properties.
885+
> Why? Destructuring saves you from creating temporary references for those properties, and from repetitive access of the object. Repeating object access creates more repetitive code, requires more reading, and creates more opportunities for mistakes. Destructuring objects also provides a single site of definition of the object structure that is used in the block, rather than requiring reading the entire block to determine what is used.
884886
885887
```javascript
886888
// bad
@@ -1794,9 +1796,26 @@
17941796
17951797
foo.init();
17961798
```
1797-
1798-
<a name="modules--multiline-imports-over-newlines"></a><a name="10.5"></a>
1799-
- [10.5](#modules--multiline-imports-over-newlines) Multiline imports should be indented just like multiline array and object literals.
1799+
1800+
<a name="modules--import-extensions"></a>
1801+
- [10.5](#modules--import-extensions) Do not include JavaScript filename extensions
1802+
eslint: [`import/extensions`](https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/extensions.md)
1803+
> Why? Including extensions inhibits refactoring, and inappropriately hardcodes implementation details of the module you're importing in every consumer.
1804+
1805+
```javascript
1806+
// bad
1807+
import foo from "./foo.js";
1808+
import bar from "./bar.jsx";
1809+
import baz from "./baz/index.jsx";
1810+
1811+
// good
1812+
import foo from "./foo";
1813+
import bar from "./bar";
1814+
import baz from "./baz";
1815+
```
1816+
1817+
<a name="modules--multiline-imports-over-newlines"></a><a name="10.6"></a>
1818+
- [10.6](#modules--multiline-imports-over-newlines) Multiline imports should be indented just like multiline array and object literals. eslint: [`object-curly-newline`](https://eslint.org/docs/rules/object-curly-newline)
18001819
18011820
> Why? The curly braces follow the same indentation rules as every other curly brace block in the style guide.
18021821
@@ -2017,7 +2036,7 @@
20172036
<a name="variables--const-let-group"></a><a name="13.3"></a>
20182037
- [13.3](#variables--const-let-group) Group all your `const`s and then group all your `let`s.
20192038
2020-
> Why? This is helpful when later on you might need to assign a variable depending on one of the previous assigned variables.
2039+
> Why? This is helpful when later on you might need to assign a variable depending on one of the previously assigned variables.
20212040
20222041
```javascript
20232042
// bad
@@ -2226,7 +2245,7 @@
22262245
## Hoisting
22272246
22282247
<a name="hoisting--about"></a><a name="14.1"></a>
2229-
- [14.1](#hoisting--about) `var` declarations get hoisted to the top of their closest enclosing function scope, their assignment does not. `const` and `let` declarations are blessed with a new concept called [Temporal Dead Zones (TDZ)](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/let#Temporal_dead_zone). It’s important to know why [typeof is no longer safe](http://es-discourse.com/t/why-typeof-is-no-longer-safe/15).
2248+
- [14.1](#hoisting--about) `var` declarations get hoisted to the top of their closest enclosing function scope, their assignment does not. `const` and `let` declarations are blessed with a new concept called [Temporal Dead Zones (TDZ)](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/let#Temporal_dead_zone). It’s important to know why [typeof is no longer safe](https://web.archive.org/web/20200121061528/http://es-discourse.com/t/why-typeof-is-no-longer-safe/15).
22302249
22312250
```javascript
22322251
// this wouldn’t work (assuming there

0 commit comments

Comments
 (0)