mirror of
https://github.com/airbnb/javascript.git
synced 2026-01-13 21:48:05 -05:00
Merge pull request #1505 from asherdale/master
Update README, fixed badly-styled eslint links
This commit is contained in:
12
README.md
12
README.md
@@ -1838,12 +1838,10 @@ Other Style Guides
|
||||
- [15.4](#comparison--moreinfo) For more information see [Truth Equality and JavaScript](https://javascriptweblog.wordpress.com/2011/02/07/truth-equality-and-javascript/#more-2108) by Angus Croll.
|
||||
|
||||
<a name="comparison--switch-blocks"></a><a name="15.5"></a>
|
||||
- [15.5](#comparison--switch-blocks) Use braces to create blocks in `case` and `default` clauses that contain lexical declarations (e.g. `let`, `const`, `function`, and `class`).
|
||||
- [15.5](#comparison--switch-blocks) Use braces to create blocks in `case` and `default` clauses that contain lexical declarations (e.g. `let`, `const`, `function`, and `class`). eslint: [`no-case-declarations`](http://eslint.org/docs/rules/no-case-declarations.html)
|
||||
|
||||
> Why? Lexical declarations are visible in the entire `switch` block but only get initialized when assigned, which only happens when its `case` is reached. This causes problems when multiple `case` clauses attempt to define the same thing.
|
||||
|
||||
eslint rules: [`no-case-declarations`](http://eslint.org/docs/rules/no-case-declarations.html).
|
||||
|
||||
```javascript
|
||||
// bad
|
||||
switch (foo) {
|
||||
@@ -1888,9 +1886,7 @@ Other Style Guides
|
||||
```
|
||||
|
||||
<a name="comparison--nested-ternaries"></a><a name="15.6"></a>
|
||||
- [15.6](#comparison--nested-ternaries) Ternaries should not be nested and generally be single line expressions.
|
||||
|
||||
eslint rules: [`no-nested-ternary`](http://eslint.org/docs/rules/no-nested-ternary.html).
|
||||
- [15.6](#comparison--nested-ternaries) Ternaries should not be nested and generally be single line expressions. eslint: [`no-nested-ternary`](http://eslint.org/docs/rules/no-nested-ternary.html)
|
||||
|
||||
```javascript
|
||||
// bad
|
||||
@@ -1912,9 +1908,7 @@ Other Style Guides
|
||||
```
|
||||
|
||||
<a name="comparison--unneeded-ternary"></a><a name="15.7"></a>
|
||||
- [15.7](#comparison--unneeded-ternary) Avoid unneeded ternary statements.
|
||||
|
||||
eslint rules: [`no-unneeded-ternary`](http://eslint.org/docs/rules/no-unneeded-ternary.html).
|
||||
- [15.7](#comparison--unneeded-ternary) Avoid unneeded ternary statements. eslint: [`no-unneeded-ternary`](http://eslint.org/docs/rules/no-unneeded-ternary.html)
|
||||
|
||||
```javascript
|
||||
// bad
|
||||
|
||||
Reference in New Issue
Block a user