Skip to content
Permalink
Browse files

Docs: some typos and optimization points (#11960)

  • Loading branch information...
molee1905 authored and aladdin-add committed Jul 14, 2019
1 parent 2a10856 commit 4448261f5d217d8a06eb0ef898401928b54a34e3
@@ -61,7 +61,7 @@ var e = [

### never

Examples of **incorrect** code for this rule with the default `"never"` option:
Examples of **incorrect** code for this rule with the `"never"` option:

```js
/*eslint array-element-newline: ["error", "never"]*/
@@ -59,7 +59,7 @@ Foo.prototype.bar = function bar() {};

ECMAScript 6 introduced a `name` property on all functions. The value of `name` is determined by evaluating the code around the function to see if a name can be inferred. For example, a function assigned to a variable will automatically have a `name` property equal to the name of the variable. The value of `name` is then used in stack traces for easier debugging.

Examples of **incorrect** code for this rule with the default `"as-needed"` option:
Examples of **incorrect** code for this rule with the `"as-needed"` option:

```js
/*eslint func-names: ["error", "as-needed"]*/
@@ -71,7 +71,7 @@ Foo.prototype.bar = function() {};
}())
```

Examples of **correct** code for this rule with the default `"as-needed"` option:
Examples of **correct** code for this rule with the `"as-needed"` option:

```js
/*eslint func-names: ["error", "as-needed"]*/
@@ -200,7 +200,7 @@ foo(
});
```

Examples of **correct** code for this rule with the consistent `"consistent"` option:
Examples of **correct** code for this rule with the `"consistent"` option:

```js
/* eslint function-paren-newline: ["error", "consistent"] */
@@ -1,4 +1,4 @@
# Require parentheses when invoking a constructor with no arguments (new-parens)
# require parentheses when invoking a constructor with no arguments (new-parens)

JavaScript allows the omission of parentheses when invoking a function via the `new` keyword and the constructor has no arguments. However, some coders believe that omitting the parentheses is inconsistent with the rest of the language and thus makes code less clear.

@@ -6,15 +6,15 @@ Inside an `async function`, `return await` is seldom useful. Since the return va

This rule aims to prevent a likely common performance hazard due to a lack of understanding of the semantics of `async function`.

The following patterns are considered warnings:
Examples of **incorrect** code for this rule:

```js
async function foo() {
return await bar();
}
```

The following patterns are not warnings:
Examples of **correct** code for this rule:

```js
async function foo() {
@@ -72,7 +72,7 @@ This rule has the option to check properties as well.
Examples of **correct** code with the `{ "props": false }` option:

```js
/*eslint no-self-assign: ["error", {"props": true}]*/
/*eslint no-self-assign: ["error", {"props": false}]*/
// self-assignments with properties.
obj.a = obj.a;
@@ -5,7 +5,7 @@ ECMAScript 6 allows programmers to create strings containing variable or express

## Rule Details

This rule aims to warn when a regular string contains what looks like a template literal placeholder. It will warn when it finds a string containing the template literal place holder (`${something}`) that uses either `"` or `'` for the quotes.
This rule aims to warn when a regular string contains what looks like a template literal placeholder. It will warn when it finds a string containing the template literal placeholder (`${something}`) that uses either `"` or `'` for the quotes.

## Examples

@@ -79,7 +79,7 @@ super._bar();

### enforceInMethodNames

Examples of incorrect code for this rule with the `{ "enforceInMethodNames": true }` option:
Examples of **incorrect** code for this rule with the `{ "enforceInMethodNames": true }` option:

```js
/*eslint no-underscore-dangle: ["error", { "enforceInMethodNames": true }]*/
@@ -14,8 +14,8 @@ This rule has an option.
}
```

- `"last"` (Default) ... enforces that semicolons are at the end of statements.
- `"first"` ... enforces that semicolons are at the beginning of statements. Semicolons of `for` loop heads (`for(a;b;c){}`) should be at the end of lines even if you use this option.
- `"last"` (Default) enforces that semicolons are at the end of statements.
- `"first"` enforces that semicolons are at the beginning of statements. Semicolons of `for` loop heads (`for(a;b;c){}`) should be at the end of lines even if you use this option.

Examples of **incorrect** code for this rule with `"last"` option:

@@ -47,7 +47,7 @@ class Foo{
}
```

Examples of **correct** code for this rule with the "always" option:
Examples of **correct** code for this rule with the `"always"` option:

```js
/*eslint space-before-blocks: "error"*/
@@ -74,7 +74,7 @@ try {} catch(a) {}

### "never"

Examples of **incorrect** code for this rule with the "never" option:
Examples of **incorrect** code for this rule with the `"never"` option:

```js
/*eslint space-before-blocks: ["error", "never"]*/
@@ -92,7 +92,7 @@ for (;;) {
try {} catch(a) {}
```

Examples of **correct** code for this rule with the "never" option:
Examples of **correct** code for this rule with the `"never"` option:

```js
/*eslint space-before-blocks: ["error", "never"]*/
@@ -15,10 +15,10 @@ This rule has 2 options that are boolean value.
}
```

- `"after": true` (Default) ... requires one or more spaces after colons.
- `"after": false` ... disallows spaces after colons.
- `"before": true` ... requires one or more spaces before colons.
- `"before": false` (Default) ... disallows before colons.
- `"after": true` (Default) requires one or more spaces after colons.
- `"after": false` disallows spaces after colons.
- `"before": true` requires one or more spaces before colons.
- `"before": false` (Default) disallows before colons.


Examples of **incorrect** code for this rule:
@@ -21,7 +21,7 @@ This rule aims to maintain consistency around the spacing between template tag f
}
```

This rule has one option whose value can be set to "never" or "always"
This rule has one option whose value can be set to `"never"` or `"always"`

* `"never"` (default) - Disallows spaces between a tag function and its template literal.
* `"always"` - Requires one or more spaces between a tag function and its template literal.
@@ -661,7 +661,7 @@ The complete configuration hierarchy, from highest precedence to lowest preceden
1. Project-level configuration:
1. `.eslintrc.*` or `package.json` file in same directory as linted file
1. Continue searching for `.eslintrc` and `package.json` files in ancestor directories (parent has highest precedence, then grandparent, etc.), up to and including the root directory or until a config with `"root": true` is found.
1. In the absence of any configuration from (1) through (3), fall back to a personal default configuration in `~/.eslintrc`.
1. In the absence of any configuration from (1) through (3), fall back to a personal default configuration in `~/.eslintrc`.

## Extending Configuration Files

0 comments on commit 4448261

Please sign in to comment.
You can’t perform that action at this time.