You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: JavaScript/Javascript.md
+11-6Lines changed: 11 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -676,7 +676,7 @@ Heavily inspired by and partly composed of [Airbnb JavaScript Style Guide
676
676
## Arrow Functions
677
677
678
678
<aname="arrows--use-them"></a>
679
-
-[8.1](arrows--use-them) When you must use an anonymous function (as when passing an inline callback), use arrow function notation. eslint: [`prefer-arrow-callback`](https://eslint.org/docs/rules/prefer-arrow-callback), [`arrow-spacing`](https://eslint.org/docs/rules/arrow-spacing)
679
+
-[8.1](#arrows--use-them) When you must use an anonymous function (as when passing an inline callback), use arrow function notation. eslint: [`prefer-arrow-callback`](https://eslint.org/docs/rules/prefer-arrow-callback), [`arrow-spacing`](https://eslint.org/docs/rules/arrow-spacing)
680
680
681
681
> Why? It creates a version of the function that executes in the context of `this`, which is usually what you want, and is a more concise syntax.
682
682
@@ -943,7 +943,7 @@ Heavily inspired by and partly composed of [Airbnb JavaScript Style Guide
943
943
```
944
944
945
945
<aname="modules--no-export-from-import"></a>
946
-
-[10.3](modules--no-export-from-import) And do not export directly from an import.
946
+
-[10.3](#modules--no-export-from-import) And do not export directly from an import.
947
947
948
948
> Why? Although the one-liner is concise, having one clear way to import and one clear way to export makes things consistent.
949
949
@@ -1718,7 +1718,7 @@ Heavily inspired by and partly composed of [Airbnb JavaScript Style Guide
1718
1718
## Control Statements
1719
1719
1720
1720
<aname="control-statements"></a>
1721
-
-[16.1]($control-statements) In case your control statement (`if`, `while` etc.) gets too long or exceeds the maximum line length, each (grouped) condition could be put into a new line. The logical operator should begin the line.
1721
+
-[16.1](#control-statements) In case your control statement (`if`, `while` etc.) gets too long or exceeds the maximum line length, each (grouped) condition could be put into a new line. The logical operator should begin the line.
1722
1722
1723
1723
> Why? Requiring operators at the beginning of the line keeps the operators aligned and follows a pattern similar to method chaining. This also improves readability by making it easier to visually follow complex logic.
1724
1724
@@ -1771,7 +1771,7 @@ Heavily inspired by and partly composed of [Airbnb JavaScript Style Guide
-[16.2](#control-statement--value-selection) Don't use selection operators in place of control statements.
1776
1776
1777
1777
```javascript
@@ -2958,6 +2958,8 @@ Sample config can be found [here](./.eslintrc.js). Feel free to copy it and thou
2958
2958
In TypeScript we use the same rules as in JavaScript, but we also have some additional guidelines that are specific to typescript.
2959
2959
2960
2960
### Naming conventions
2961
+
2962
+
<aname="typescript--enum-naming-conventions"></a>
2961
2963
-[25.1](#typescript--enum-naming-conventions) Use `PascalCase` enum names and enum properties.
2962
2964
2963
2965
```typescript
@@ -2996,7 +2998,9 @@ In TypeScript we use the same rules as in JavaScript, but we also have some addi
2996
2998
```
2997
2999
2998
3000
### tsconfig flags
2999
-
-[26.1](#typescript--tsconfig-flags-) Use `strict: true` in your `tsconfig.json` file.
3001
+
3002
+
<aname="typescript--tsconfig-strict"></a>
3003
+
-[26.1](#typescript--tsconfig-strict) Use `strict: true` in your `tsconfig.json` file.
3000
3004
3001
3005
```json
3002
3006
{
@@ -3006,7 +3010,8 @@ In TypeScript we use the same rules as in JavaScript, but we also have some addi
3006
3010
}
3007
3011
```
3008
3012
3009
-
-[26.2](#typescript--tsconfig-flags-) Use `"noUncheckedIndexedAccess": true` in your `tsconfig.json` file. This is a good practice because it prevents you from accessing elements that don't exist. Read more about it [here](https://www.typescriptlang.org/tsconfig#noUncheckedIndexedAccess).
-[26.2](#typescript--tsconfig-nouncheckedindexedaccess) Use `"noUncheckedIndexedAccess": true` in your `tsconfig.json` file. This is a good practice because it prevents you from accessing elements that don't exist. Read more about it [here](https://www.typescriptlang.org/tsconfig#noUncheckedIndexedAccess).
0 commit comments