Skip to content

Commit

Permalink
Merge pull request airbnb#1505 from asherdale/master
Browse files Browse the repository at this point in the history
Update README, fixed badly-styled eslint links
  • Loading branch information
ljharb authored Jul 26, 2017
2 parents 3cc6269 + 9393e6a commit abeb313
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit abeb313

Please sign in to comment.