Skip to content

Commit

Permalink
Docs: On maxEOF with eol-last (fixes eslint#12742)
Browse files Browse the repository at this point in the history
Added an explanation on how and why maxEOF should be set to 0 to work with the eol-last rule.
  • Loading branch information
arthurdias-trad committed Jun 5, 2020
1 parent 0d47c93 commit 0e8cf53
Showing 1 changed file with 4 additions and 15 deletions.
19 changes: 4 additions & 15 deletions docs/rules/no-multiple-empty-lines.md
Expand Up @@ -10,9 +10,9 @@ This rule aims to reduce the scrolling required when reading through your code.

This rule has an object option:

* `"max"` (default: `2`) enforces a maximum number of consecutive empty lines.
* `"maxEOF"` enforces a maximum number of consecutive empty lines at the end of files.
* `"maxBOF"` enforces a maximum number of consecutive empty lines at the beginning of files.
- `"max"` (default: `2`) enforces a maximum number of consecutive empty lines.
- `"maxEOF"` enforces a maximum number of consecutive empty lines at the end of files.
- `"maxBOF"` enforces a maximum number of consecutive empty lines at the beginning of files.

### max

Expand All @@ -23,8 +23,6 @@ Examples of **incorrect** code for this rule with the default `{ "max": 2 }` opt

var foo = 5;



var bar = 3;
```

Expand All @@ -35,7 +33,6 @@ Examples of **correct** code for this rule with the default `{ "max": 2 }` optio

var foo = 5;


var bar = 3;
```

Expand All @@ -48,10 +45,7 @@ Examples of **incorrect** code for this rule with the `{ max: 2, maxEOF: 0 }` op

var foo = 5;


var bar = 3;


```

Examples of **correct** code for this rule with the `{ max: 2, maxEOF: 0 }` options:
Expand All @@ -61,12 +55,10 @@ Examples of **correct** code for this rule with the `{ max: 2, maxEOF: 0 }` opti

var foo = 5;


var bar = 3;
```

**Note**: Although this ensures zero empty lines at the EOF, most editors will still show one empty line at the end, as illustrated below. There is no empty line at the end of a file after the last `\n`, although editors may show an additional line. A true additional line would be represented by `\n\n`.

**Note**: Although this ensures zero empty lines at the EOF, most editors will still show one empty line at the end if the file ends with a line break, as illustrated below. There is no empty line at the end of a file after the last `\n`, although editors may show an additional line. A true additional line would be represented by `\n\n`.

**Incorrect**:

Expand Down Expand Up @@ -100,10 +92,8 @@ Examples of **incorrect** code for this rule with the `{ max: 2, maxBOF: 1 }` op
```js
/*eslint no-multiple-empty-lines: ["error", { "max": 2, "maxBOF": 1 }]*/


var foo = 5;


var bar = 3;
```

Expand All @@ -114,7 +104,6 @@ Examples of **correct** code for this rule with the `{ max: 2, maxBOF: 1 }` opti

var foo = 5;


var bar = 3;
```

Expand Down

0 comments on commit 0e8cf53

Please sign in to comment.