Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 26a6468

Browse files
authored
Removed section and fixed anchors
1 parent 2204bc6 commit 26a6468

File tree

1 file changed

+38
-54
lines changed

1 file changed

+38
-54
lines changed

README.md

Lines changed: 38 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,7 @@ $ `npm i` - and you're ready to go!
5151

5252
- [2.1](#references--prefer-const) Prefer `const`
5353
- [2.2](#references--disallow-var) Disallow `var`
54-
- [2.3](#references--let-require) `let` for `require()`
55-
- [2.4](#references--block-scope) Block scope
54+
- [2.3](#references--block-scope) Block scope
5655

5756
</details>
5857

@@ -257,13 +256,13 @@ $ `npm i` - and you're ready to go!
257256
<details>
258257
<summary>View contents</summary>
259258

260-
- [18.0](#comments--language) Language
261-
- [18.1](#comments--multiline) Multi-line
262-
- [18.2](#comments--singleline) Single-line
263-
- [18.3](#comments--spaces) Spaces
264-
- [18.4](#comments--actionitems) Prefixing / Action-items
265-
- [18.5](#comments--fixme) FixMe
266-
- [18.6](#comments--todo) ToDo
259+
- [18.1](#comments--language) Language
260+
- [18.2](#comments--multiline) Multi-line
261+
- [18.3](#comments--singleline) Single-line
262+
- [18.4](#comments--spaces) Spaces
263+
- [18.5](#comments--actionitems) Prefixing / Action-items
264+
- [18.6](#comments--fixme) FixMe
265+
- [18.7](#comments--todo) ToDo
267266

268267
</details>
269268

@@ -526,24 +525,9 @@ $ `npm i` - and you're ready to go!
526525
count += 1;
527526
}
528527
```
529-
530-
<a name="references--let-require"></a><a name="2.3"></a>
531-
- [2.3](#references--let-require) Use `let` for `require()` imports in NodeJS.
532-
533-
> Why? Modules are rather dynamic in nature. If you want to add functionality dynamically later on, it's easier if the module isn't imported as `const`. Also, in some cases `let` is faster than `const` when used on `require()` ([Source](https://stackoverflow.com/a/42767905/7575111)).
534-
535-
```javascript
536-
// bad
537-
var x = require("x");
538-
const y = require("y");
539-
540-
// good
541-
let x = require("x");
542-
let y = require("y");
543-
```
544528
545529
<a name="references--block-scope"></a><a name="2.3"></a>
546-
- [2.4](#references--block-scope) Note that both `let` and `const` are block-scoped.
530+
- [2.3](#references--block-scope) Note that both `let` and `const` are block-scoped.
547531
548532
```javascript
549533
// const and let only exist in the blocks they are defined in.
@@ -572,7 +556,7 @@ $ `npm i` - and you're ready to go!
572556
const item = {};
573557
```
574558
575-
<a name="es6-computed-properties"></a><a name="3.4"></a>
559+
<a name="es6-computed-properties"></a><a name="3.2"></a>
576560
- [3.2](#es6-computed-properties) Use computed property names when creating objects with dynamic property names.
577561
578562
> Why? They allow you to define all the properties of an object in one place.
@@ -598,7 +582,7 @@ $ `npm i` - and you're ready to go!
598582
};
599583
```
600584
601-
<a name="es6-object-shorthand"></a><a name="3.5"></a>
585+
<a name="es6-object-shorthand"></a><a name="3.3"></a>
602586
- [3.3](#es6-object-shorthand) Use object method shorthand. eslint: [`object-shorthand`](https://eslint.org/docs/rules/object-shorthand.html)
603587
604588
```javascript
@@ -621,7 +605,7 @@ $ `npm i` - and you're ready to go!
621605
};
622606
```
623607
624-
<a name="es6-object-concise"></a><a name="3.6"></a>
608+
<a name="es6-object-concise"></a><a name="3.4"></a>
625609
- [3.4](#es6-object-concise) Use property value shorthand. eslint: [`object-shorthand`](https://eslint.org/docs/rules/object-shorthand.html)
626610
627611
> Why? It is shorter and descriptive.
@@ -640,7 +624,7 @@ $ `npm i` - and you're ready to go!
640624
};
641625
```
642626
643-
<a name="objects--grouped-shorthand"></a><a name="3.7"></a>
627+
<a name="objects--grouped-shorthand"></a><a name="3.5"></a>
644628
- [3.5](#objects--grouped-shorthand) Group your shorthand properties at the beginning of your object declaration.
645629
646630
> Why? It’s easier to tell which properties are using the shorthand.
@@ -670,7 +654,7 @@ $ `npm i` - and you're ready to go!
670654
};
671655
```
672656
673-
<a name="objects--quoted-props"></a><a name="3.8"></a>
657+
<a name="objects--quoted-props"></a><a name="3.6"></a>
674658
- [3.6](#objects--quoted-props) Only quote properties that are invalid identifiers. eslint: [`quote-props`](https://eslint.org/docs/rules/quote-props.html)
675659
676660
> Why? In general it is subjectively easier to read. It improves syntax highlighting, and is also more easily optimized by many JS engines.
@@ -691,7 +675,7 @@ $ `npm i` - and you're ready to go!
691675
};
692676
```
693677
694-
<a name="objects--prototype-builtins"></a>
678+
<a name="objects--prototype-builtins"></a><a name="3.7"></a>
695679
- [3.7](#objects--prototype-builtins) Do not call `Object.prototype` methods directly, such as `hasOwnProperty`, `propertyIsEnumerable`, and `isPrototypeOf`. eslint: [`no-prototype-builtins`](https://eslint.org/docs/rules/no-prototype-builtins)
696680
697681
> Why? These methods may be shadowed by properties on the object in question - consider `{ hasOwnProperty: false }` - or, the object may be a null object (`Object.create(null)`).
@@ -708,7 +692,7 @@ $ `npm i` - and you're ready to go!
708692
Object.hasOwn(object, key);
709693
```
710694
711-
<a name="objects--rest-spread"></a>
695+
<a name="objects--rest-spread"></a><a name="3.8"></a>
712696
- [3.8](#objects--rest-spread) Prefer the object spread operator over [`Object.assign`](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Object/assign) to shallow-copy objects. Use the object rest operator to get a new object with certain properties omitted.
713697
714698
```javascript
@@ -787,7 +771,7 @@ $ `npm i` - and you're ready to go!
787771
const nodes = [...foo];
788772
```
789773
790-
<a name="arrays--from-array-like"></a>
774+
<a name="arrays--from-array-like"></a><a name="4.5"></a>
791775
- [4.5](#arrays--from-array-like) Use [`Array.from`](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Array/from) for converting an array-like object to an array.
792776
793777
```javascript
@@ -800,7 +784,7 @@ $ `npm i` - and you're ready to go!
800784
const arr = Array.from(arrLike);
801785
```
802786
803-
<a name="arrays--mapping"></a>
787+
<a name="arrays--mapping"></a><a name="4.6"></a>
804788
- [4.6](#arrays--mapping) Use [`Array.from`](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Array/from) instead of spread `...` for mapping over iterables, because it avoids creating an intermediate array.
805789
806790
```javascript
@@ -811,7 +795,7 @@ $ `npm i` - and you're ready to go!
811795
const baz = Array.from(foo, bar);
812796
```
813797
814-
<a name="arrays--callback-return"></a><a name="4.5"></a>
798+
<a name="arrays--callback-return"></a><a name="4.7"></a>
815799
- [4.7](#arrays--callback-return) Use return statements in array method callbacks. It’s ok to omit the return if the function body consists of a single statement returning an expression without side effects, following [8.2](#arrows--implicit-return). eslint: [`array-callback-return`](https://eslint.org/docs/rules/array-callback-return)
816800
817801
```javascript
@@ -850,7 +834,7 @@ $ `npm i` - and you're ready to go!
850834
});
851835
```
852836
853-
<a name="arrays--bracket-newline"></a>
837+
<a name="arrays--bracket-newline"></a><a name="4.8"></a>
854838
- [4.8](#arrays--bracket-newline) Use line breaks after open and before close array brackets if an array has multiple lines
855839
856840
```javascript
@@ -1050,7 +1034,7 @@ $ `npm i` - and you're ready to go!
10501034
const foo = `my name is "${name}"`;
10511035
```
10521036
1053-
<a name="strings--regex"></a></a><a name="6.6"></a>
1037+
<a name="strings--regex"></a><a name="6.6"></a>
10541038
- [6.6](#strings--regex) Do not split regular expressions, even if some parts are used multiple times. The only exception are computed RegEx'es.
10551039
10561040
> Why? It has a great impact on readability and can lead to extremely confusing code
@@ -1549,7 +1533,7 @@ $ `npm i` - and you're ready to go!
15491533
};
15501534
```
15511535
1552-
<a name="whitespace--implicit-arrow-linebreak"></a>
1536+
<a name="whitespace--implicit-arrow-linebreak"></a><a name="8.6"></a>
15531537
- [8.6](#whitespace--implicit-arrow-linebreak) Enforce the location of arrow function bodies with implicit returns. eslint: [`implicit-arrow-linebreak`](https://eslint.org/docs/rules/implicit-arrow-linebreak)
15541538
15551539
```javascript
@@ -1846,7 +1830,7 @@ $ `npm i` - and you're ready to go!
18461830
foo.init();
18471831
```
18481832

1849-
<a name="modules--import-extensions"></a>
1833+
<a name="modules--import-extensions"></a><a name="10.5"></a>
18501834
- [10.5](#modules--import-extensions) Do not include JavaScript filename extensions
18511835
eslint: [`import/extensions`](https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/extensions.md)
18521836
> Why? Including extensions inhibits refactoring, and inappropriately hardcodes implementation details of the module you're importing in every consumer.
@@ -2535,7 +2519,7 @@ $ `npm i` - and you're ready to go!
25352519
const baz = !c;
25362520
```
25372521
2538-
<a name="comparison--no-mixed-operators"></a>
2522+
<a name="comparison--no-mixed-operators"></a><a name="15.8"></a>
25392523
- [15.8](#comparison--no-mixed-operators) When mixing operators, enclose them in parentheses. The only exception is the standard arithmetic operators (`+`, `-`, `*`, & `/`) since their precedence is broadly understood. eslint: [`no-mixed-operators`](https://eslint.org/docs/rules/no-mixed-operators.html)
25402524
25412525
> Why? This improves readability and clarifies the developer’s intention.
@@ -2764,17 +2748,17 @@ $ `npm i` - and you're ready to go!
27642748
27652749
## Comments
27662750
2767-
<a name="comments--language"></a><a name="18.0"></a>
2768-
- [18.0](#comments--language) Stick to the english language. Always write variable names, function names, comments and co in english.
2751+
<a name="comments--language"></a><a name="18.1"></a>
2752+
- [18.1](#comments--language) Stick to the english language. Always write variable names, function names, comments and co in english.
27692753
27702754
> Why? Some reasons:
27712755
> - Consistency.
27722756
> - English is a global language. What if you're part of a german developer team, write code in german and then want to hire someone from another country?
27732757
> - JavaScript's keywords are english.
27742758
> - Some languages use symbols from different charsets (ö, ä, ü, ß, Ѱ, Ω, etc. pp.). Some of them are illegal as variable/function names and others could break your encoding.
27752759
2776-
<a name="comments--multiline"></a><a name="18.1"></a>
2777-
- [18.1](#comments--multiline) Use `/** ... */` for multi-line comments.
2760+
<a name="comments--multiline"></a><a name="18.2"></a>
2761+
- [18.2](#comments--multiline) Use `/** ... */` for multi-line comments.
27782762
27792763
```javascript
27802764
// bad
@@ -2803,8 +2787,8 @@ $ `npm i` - and you're ready to go!
28032787
}
28042788
```
28052789
2806-
<a name="comments--singleline"></a><a name="18.2"></a>
2807-
- [18.2](#comments--singleline) Use `//` for single line comments. Place single line comments on a newline above the subject of the comment. Put an empty line before the comment unless it’s on the first line of a block.
2790+
<a name="comments--singleline"></a><a name="18.3"></a>
2791+
- [18.3](#comments--singleline) Use `//` for single line comments. Place single line comments on a newline above the subject of the comment. Put an empty line before the comment unless it’s on the first line of a block.
28082792

28092793
```javascript
28102794
// bad
@@ -2842,8 +2826,8 @@ $ `npm i` - and you're ready to go!
28422826
}
28432827
```
28442828

2845-
<a name="comments--spaces"></a><a name="18.3"></a>
2846-
- [18.3](#comments--spaces) Start all comments with a space to make it easier to read. eslint: [`spaced-comment`](https://eslint.org/docs/rules/spaced-comment)
2829+
<a name="comments--spaces"></a><a name="18.4"></a>
2830+
- [18.4](#comments--spaces) Start all comments with a space to make it easier to read. eslint: [`spaced-comment`](https://eslint.org/docs/rules/spaced-comment)
28472831

28482832
```javascript
28492833
// bad
@@ -2879,11 +2863,11 @@ $ `npm i` - and you're ready to go!
28792863
}
28802864
```
28812865

2882-
<a name="comments--actionitems"></a><a name="18.4"></a>
2883-
- [18.4](#comments--actionitems) Prefixing your comments with `FIXME` or `TODO` (action-items) helps other developers quickly understand if you're pointing out a problem that needs to be revisited, or if you're suggesting a solution to the problem that needs to be implemented. These are different than regular comments because they are actionable. The actions are `FIXME: -- need to figure this out` or `TODO: -- need to implement`.
2866+
<a name="comments--actionitems"></a><a name="18.5"></a>
2867+
- [18.5](#comments--actionitems) Prefixing your comments with `FIXME` or `TODO` (action-items) helps other developers quickly understand if you're pointing out a problem that needs to be revisited, or if you're suggesting a solution to the problem that needs to be implemented. These are different than regular comments because they are actionable. The actions are `FIXME: -- need to figure this out` or `TODO: -- need to implement`.
28842868

2885-
<a name="comments--fixme"></a><a name="18.5"></a>
2886-
- [18.5](#comments--fixme) Use `// FIXME:` to annotate problems.
2869+
<a name="comments--fixme"></a><a name="18.6"></a>
2870+
- [18.6](#comments--fixme) Use `// FIXME:` to annotate problems.
28872871

28882872
```javascript
28892873
class Calculator extends Abacus {
@@ -2896,8 +2880,8 @@ $ `npm i` - and you're ready to go!
28962880
}
28972881
```
28982882

2899-
<a name="comments--todo"></a><a name="18.6"></a>
2900-
- [18.6](#comments--todo) Use `// TODO:` to annotate solutions to problems.
2883+
<a name="comments--todo"></a><a name="18.7"></a>
2884+
- [18.7](#comments--todo) Use `// TODO:` to annotate solutions to problems.
29012885

29022886
```javascript
29032887
class Calculator extends Abacus {

0 commit comments

Comments
 (0)