]> git.proxmox.com Git - pve-eslint.git/blob - eslint/docs/rules/no-multiple-empty-lines.md
first commit
[pve-eslint.git] / eslint / docs / rules / no-multiple-empty-lines.md
1 # disallow multiple empty lines (no-multiple-empty-lines)
2
3 Some developers prefer to have multiple blank lines removed, while others feel that it helps improve readability. Whitespace is useful for separating logical sections of code, but excess whitespace takes up more of the screen.
4
5 ## Rule Details
6
7 This rule aims to reduce the scrolling required when reading through your code. It will warn when the maximum amount of empty lines has been exceeded.
8
9 ## Options
10
11 This rule has an object option:
12
13 * `"max"` (default: `2`) enforces a maximum number of consecutive empty lines.
14 * `"maxEOF"` enforces a maximum number of consecutive empty lines at the end of files.
15 * `"maxBOF"` enforces a maximum number of consecutive empty lines at the beginning of files.
16
17 ### max
18
19 Examples of **incorrect** code for this rule with the default `{ "max": 2 }` option:
20
21 ```js
22 /*eslint no-multiple-empty-lines: "error"*/
23
24 var foo = 5;
25
26
27
28 var bar = 3;
29 ```
30
31 Examples of **correct** code for this rule with the default `{ "max": 2 }` option:
32
33 ```js
34 /*eslint no-multiple-empty-lines: "error"*/
35
36 var foo = 5;
37
38
39 var bar = 3;
40 ```
41
42 ### maxEOF
43
44 Examples of **incorrect** code for this rule with the `{ max: 2, maxEOF: 1 }` options:
45
46 ```js
47 /*eslint no-multiple-empty-lines: ["error", { "max": 2, "maxEOF": 1 }]*/
48
49 var foo = 5;
50
51
52 var bar = 3;
53
54
55 ```
56
57 Examples of **correct** code for this rule with the `{ max: 2, maxEOF: 1 }` options:
58
59 ```js
60 /*eslint no-multiple-empty-lines: ["error", { "max": 2, "maxEOF": 1 }]*/
61
62 var foo = 5;
63
64
65 var bar = 3;
66
67 ```
68
69 ### maxBOF
70
71 Examples of **incorrect** code for this rule with the `{ max: 2, maxBOF: 1 }` options:
72
73 ```js
74 /*eslint no-multiple-empty-lines: ["error", { "max": 2, "maxBOF": 1 }]*/
75
76
77 var foo = 5;
78
79
80 var bar = 3;
81 ```
82
83 Examples of **correct** code for this rule with the `{ max: 2, maxBOF: 1 }` options:
84
85 ```js
86 /*eslint no-multiple-empty-lines: ["error", { "max": 2, "maxBOF": 1}]*/
87
88 var foo = 5;
89
90
91 var bar = 3;
92 ```
93
94 ## When Not To Use It
95
96 If you do not care about extra blank lines, turn this off.