mirror of
https://github.com/airbnb/javascript.git
synced 2026-04-25 03:00:19 -04:00
[guide] remove redundant spaces
This commit is contained in:
committed by
Jordan Harband
parent
19701d4a0c
commit
4539dbcf17
@@ -3073,7 +3073,7 @@ Other Style Guides
|
|||||||
- [22.1](#coercion--explicit) Perform type coercion at the beginning of the statement.
|
- [22.1](#coercion--explicit) Perform type coercion at the beginning of the statement.
|
||||||
|
|
||||||
<a name="coercion--strings"></a><a name="21.2"></a>
|
<a name="coercion--strings"></a><a name="21.2"></a>
|
||||||
- [22.2](#coercion--strings) Strings: eslint: [`no-new-wrappers`](https://eslint.org/docs/rules/no-new-wrappers)
|
- [22.2](#coercion--strings) Strings: eslint: [`no-new-wrappers`](https://eslint.org/docs/rules/no-new-wrappers)
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
// => this.reviewScore = 9;
|
// => this.reviewScore = 9;
|
||||||
@@ -3360,7 +3360,7 @@ Other Style Guides
|
|||||||
|
|
||||||
> Why? This is an additional tool to assist in situations where the programmer would be unsure if a variable might ever change. UPPERCASE_VARIABLES are letting the programmer know that they can trust the variable (and its properties) not to change.
|
> Why? This is an additional tool to assist in situations where the programmer would be unsure if a variable might ever change. UPPERCASE_VARIABLES are letting the programmer know that they can trust the variable (and its properties) not to change.
|
||||||
- What about all `const` variables? - This is unnecessary, so uppercasing should not be used for constants within a file. It should be used for exported constants however.
|
- What about all `const` variables? - This is unnecessary, so uppercasing should not be used for constants within a file. It should be used for exported constants however.
|
||||||
- What about exported objects? - Uppercase at the top level of export (e.g. `EXPORTED_OBJECT.key`) and maintain that all nested properties do not change.
|
- What about exported objects? - Uppercase at the top level of export (e.g. `EXPORTED_OBJECT.key`) and maintain that all nested properties do not change.
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
// bad
|
// bad
|
||||||
@@ -3467,7 +3467,7 @@ Other Style Guides
|
|||||||
## Events
|
## Events
|
||||||
|
|
||||||
<a name="events--hash"></a><a name="24.1"></a>
|
<a name="events--hash"></a><a name="24.1"></a>
|
||||||
- [25.1](#events--hash) When attaching data payloads to events (whether DOM events or something more proprietary like Backbone events), pass an object literal (also known as a "hash") instead of a raw value. This allows a subsequent contributor to add more data to the event payload without finding and updating every handler for the event. For example, instead of:
|
- [25.1](#events--hash) When attaching data payloads to events (whether DOM events or something more proprietary like Backbone events), pass an object literal (also known as a "hash") instead of a raw value. This allows a subsequent contributor to add more data to the event payload without finding and updating every handler for the event. For example, instead of:
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
// bad
|
// bad
|
||||||
@@ -3721,7 +3721,7 @@ Other Style Guides
|
|||||||
|
|
||||||
- [JavaScript: The Good Parts](https://www.amazon.com/JavaScript-Good-Parts-Douglas-Crockford/dp/0596517742) - Douglas Crockford
|
- [JavaScript: The Good Parts](https://www.amazon.com/JavaScript-Good-Parts-Douglas-Crockford/dp/0596517742) - Douglas Crockford
|
||||||
- [JavaScript Patterns](https://www.amazon.com/JavaScript-Patterns-Stoyan-Stefanov/dp/0596806752) - Stoyan Stefanov
|
- [JavaScript Patterns](https://www.amazon.com/JavaScript-Patterns-Stoyan-Stefanov/dp/0596806752) - Stoyan Stefanov
|
||||||
- [Pro JavaScript Design Patterns](https://www.amazon.com/JavaScript-Design-Patterns-Recipes-Problem-Solution/dp/159059908X) - Ross Harmes and Dustin Diaz
|
- [Pro JavaScript Design Patterns](https://www.amazon.com/JavaScript-Design-Patterns-Recipes-Problem-Solution/dp/159059908X) - Ross Harmes and Dustin Diaz
|
||||||
- [High Performance Web Sites: Essential Knowledge for Front-End Engineers](https://www.amazon.com/High-Performance-Web-Sites-Essential/dp/0596529309) - Steve Souders
|
- [High Performance Web Sites: Essential Knowledge for Front-End Engineers](https://www.amazon.com/High-Performance-Web-Sites-Essential/dp/0596529309) - Steve Souders
|
||||||
- [Maintainable JavaScript](https://www.amazon.com/Maintainable-JavaScript-Nicholas-C-Zakas/dp/1449327680) - Nicholas C. Zakas
|
- [Maintainable JavaScript](https://www.amazon.com/Maintainable-JavaScript-Nicholas-C-Zakas/dp/1449327680) - Nicholas C. Zakas
|
||||||
- [JavaScript Web Applications](https://www.amazon.com/JavaScript-Web-Applications-Alex-MacCaw/dp/144930351X) - Alex MacCaw
|
- [JavaScript Web Applications](https://www.amazon.com/JavaScript-Web-Applications-Alex-MacCaw/dp/144930351X) - Alex MacCaw
|
||||||
|
|||||||
@@ -447,13 +447,13 @@ We don’t recommend using indexes for keys if the order of items may change.
|
|||||||
```jsx
|
```jsx
|
||||||
// bad
|
// bad
|
||||||
render() {
|
render() {
|
||||||
const { irrelevantProp, ...relevantProps } = this.props;
|
const { irrelevantProp, ...relevantProps } = this.props;
|
||||||
return <WrappedComponent {...this.props} />
|
return <WrappedComponent {...this.props} />
|
||||||
}
|
}
|
||||||
|
|
||||||
// good
|
// good
|
||||||
render() {
|
render() {
|
||||||
const { irrelevantProp, ...relevantProps } = this.props;
|
const { irrelevantProp, ...relevantProps } = this.props;
|
||||||
return <WrappedComponent {...relevantProps} />
|
return <WrappedComponent {...relevantProps} />
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|||||||
Reference in New Issue
Block a user