Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docs: On maxEOF with eol-last (fixes #12742) #13374

Merged
merged 6 commits into from Jun 11, 2020
Merged
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
35 changes: 31 additions & 4 deletions docs/rules/no-multiple-empty-lines.md
Expand Up @@ -41,10 +41,10 @@ var bar = 3;

### maxEOF

Examples of **incorrect** code for this rule with the `{ max: 2, maxEOF: 1 }` options:
Examples of **incorrect** code for this rule with the `{ max: 2, maxEOF: 0 }` options:

```js
/*eslint no-multiple-empty-lines: ["error", { "max": 2, "maxEOF": 1 }]*/
/*eslint no-multiple-empty-lines: ["error", { "max": 2, "maxEOF": 0 }]*/

var foo = 5;

Expand All @@ -54,16 +54,43 @@ var bar = 3;

```

Examples of **correct** code for this rule with the `{ max: 2, maxEOF: 1 }` options:
Examples of **correct** code for this rule with the `{ max: 2, maxEOF: 0 }` options:

```js
/*eslint no-multiple-empty-lines: ["error", { "max": 2, "maxEOF": 1 }]*/
/*eslint no-multiple-empty-lines: ["error", { "max": 2, "maxEOF": 0 }]*/

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`.
nzakas marked this conversation as resolved.
Show resolved Hide resolved


**Incorrect**:

```
1 /*eslint no-multiple-empty-lines: ["error", { "max": 2, "maxEOF": 0 }]*/⏎
2 ⏎
3 var foo = 5;⏎
4 ⏎
5 ⏎
6 var bar = 3;⏎
7 ⏎
8
```

**Correct**:

```
1 /*eslint no-multiple-empty-lines: ["error", { "max": 2, "maxEOF": 0 }]*/⏎
2 ⏎
3 var foo = 5;⏎
4 ⏎
5 ⏎
6 var bar = 3;⏎
7
```

### maxBOF
Expand Down