Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/src/rules/class-methods-use-this.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ further_reading:
---


If a class method does not use `this`, it can *sometimes* be made into a static function. If you do convert the method into a static function, instances of the class that call that particular method have to be converted to a static call as well (`MyClass.callStaticMethod()`)
If a class method does not use `this`, it can *sometimes* be made into a static function. If you do convert the method into a static function, instances of the class that call that particular method have to be converted to a static call as well (`MyClass.callStaticMethod()`).

It's possible to have a class method which doesn't use `this`, such as:

Expand Down
14 changes: 7 additions & 7 deletions docs/src/rules/consistent-return.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@ Unlike statically-typed languages which enforce that a function returns a specif

A confusing aspect of JavaScript is that a function returns `undefined` if any of the following are true:

* it does not execute a `return` statement before it exits
* it executes `return` which does not specify a value explicitly
* it executes `return undefined`
* it executes `return void` followed by an expression (for example, a function call)
* it executes `return` followed by any other expression which evaluates to `undefined`
* It does not execute a `return` statement before it exits.
* It executes `return` which does not specify a value explicitly.
* It executes `return undefined`.
* It executes `return void` followed by an expression (for example, a function call).
* It executes `return` followed by any other expression which evaluates to `undefined`.

If any code paths in a function return a value explicitly but some code path do not return a value explicitly, it might be a typing mistake, especially in a large function. In the following example:

* a code path through the function returns a Boolean value `true`
* another code path does not return a value explicitly, therefore returns `undefined` implicitly
* A code path through the function returns a Boolean value `true`.
* Another code path does not return a value explicitly, therefore returns `undefined` implicitly.

```js
function doSomething(condition) {
Expand Down
2 changes: 1 addition & 1 deletion docs/src/rules/default-case.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ switch (a) {

This rule accepts a single options argument:

* Set the `commentPattern` option to a regular expression string to change the default `/^no default$/i` comment test pattern
* Set the `commentPattern` option to a regular expression string to change the default `/^no default$/i` comment test pattern.

### commentPattern

Expand Down
6 changes: 3 additions & 3 deletions docs/src/rules/func-names.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@ This rule can enforce or disallow the use of named function expressions.

This rule has a string option:

* `"always"` (default) requires function expressions to have a name
* `"always"` (default) requires function expressions to have a name.
* `"as-needed"` requires function expressions to have a name, if the name isn't assigned automatically per the ECMAScript specification.
* `"never"` disallows named function expressions, except in recursive functions, where a name is needed
* `"never"` disallows named function expressions, except in recursive functions, where a name is needed.

This rule has an object option:

* `"generators": "always" | "as-needed" | "never"`
* `"always"` require named generators
* `"always"` require named generators.
* `"as-needed"` require named generators if the name isn't assigned automatically per the ECMAScript specification.
* `"never"` disallow named generators where possible.

Expand Down
4 changes: 2 additions & 2 deletions docs/src/rules/logical-assignment-operators.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ String option:

Object option (only available if string option is set to `"always"`):

* `"enforceForIfStatements": false`(default) Do *not* check for equivalent `if` statements
* `"enforceForIfStatements": true` Check for equivalent `if` statements
* `"enforceForIfStatements": false` (default) Do *not* check for equivalent `if` statements.
* `"enforceForIfStatements": true` Check for equivalent `if` statements.

#### always

Expand Down
4 changes: 2 additions & 2 deletions docs/src/rules/max-lines.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ Please note that most editors show an additional empty line at the end if the fi

This rule has a number or object option:

* `"max"` (default `300`) enforces a maximum number of lines in a file
* `"max"` (default `300`) enforces a maximum number of lines in a file.

* `"skipBlankLines": true` ignore lines made up purely of whitespace.

* `"skipComments": true` ignore lines containing just comments
* `"skipComments": true` ignore lines containing just comments.

### max

Expand Down
4 changes: 2 additions & 2 deletions docs/src/rules/new-cap.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ This rule has an object option:
* `"newIsCapExceptionPattern"` allows any lowercase-started function names that match the specified regex pattern to be called with the `new` operator.
* `"capIsNewExceptions"` allows specified uppercase-started function names to be called without the `new` operator.
* `"capIsNewExceptionPattern"` allows any uppercase-started function names that match the specified regex pattern to be called without the `new` operator.
* `"properties": true` (default) enables checks on object properties
* `"properties": false` disables checks on object properties
* `"properties": true` (default) enables checks on object properties.
* `"properties": false` disables checks on object properties.

### newIsCap

Expand Down
10 changes: 5 additions & 5 deletions docs/src/rules/no-case-declarations.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ related_rules:

This rule disallows lexical declarations (`let`, `const`, `function` and `class`)
in `case`/`default` clauses. The reason is that the lexical declaration is visible
in the entire switch block but it only gets initialized when it is assigned, which
will only happen if the case where it is defined is reached.
in the entire `switch` block but it only gets initialized when it is assigned, which
will only happen if the `case` where it is defined is reached.

To ensure that the lexical declaration only applies to the current case clause
To ensure that the lexical declaration only applies to the current `case` clause
wrap your clauses in blocks.

## Rule Details

This rule aims to prevent access to uninitialized lexical bindings as well as accessing hoisted functions across case clauses.
This rule aims to prevent access to uninitialized lexical bindings as well as accessing hoisted functions across `case` clauses.

Examples of **incorrect** code for this rule:

Expand Down Expand Up @@ -81,4 +81,4 @@ switch (foo) {

## When Not To Use It

If you depend on fall through behavior and want access to bindings introduced in the case block.
If you depend on fall through behavior and want access to bindings introduced in the `case` block.
2 changes: 1 addition & 1 deletion docs/src/rules/no-eq-null.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ related_rules:
---


Comparing to `null` without a type-checking operator (`==` or `!=`), can have unintended results as the comparison will evaluate to true when comparing to not just a `null`, but also an `undefined` value.
Comparing to `null` without a type-checking operator (`==` or `!=`), can have unintended results as the comparison will evaluate to `true` when comparing to not just a `null`, but also an `undefined` value.

```js
if (foo == null) {
Expand Down
4 changes: 2 additions & 2 deletions docs/src/rules/sort-keys.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,14 +93,14 @@ The 2nd option is an object which has the following properties.

Example for a list:

With `natural` as true, the ordering would be
With `natural` as `true`, the ordering would be
1
3
6
8
10

With `natural` as false, the ordering would be
With `natural` as `false`, the ordering would be
1
10
3
Expand Down
Loading