max-empty-lines
Limit the number of adjacent empty lines.
a {}
/* ← */
/* ← */
a {} /* ↑ */
/** ↑
* These lines */Where the option allows an empty line at all, the one a file ends on is counted like any other, spaces or tabs behind the last line break included. The 0 option does not count the end of the file, so a file closed by a single break is no problem to it. A file holding nothing but whitespace counts each of its line breaks as an empty line.
Inside an embedded stylesheet, the line breaks a <style> element's block opens with count as a file's do, while the first break of an inline style attribute or a CSS-in-JS template closes the host's line rather than an empty one.
The fix option can automatically fix all of the problems reported by this rule.
The message secondary option can accept the arguments of this rule.
Options
int: Maximum number of adjacent empty lines allowed.
For example, with 2:
The following patterns are considered problems:
a {}
b {}Comment strings are also checked -- so the following is a problem:
/*
Call me Ishmael.
Some years ago--never mind how long precisely-—...
*/The following patterns are not considered problems:
a {}
b {}a {}
b {}a {}
b {}Optional secondary options
ignore: ["comments"]
Only enforce the adjacent empty lines limit for lines that are not comments.
For example, with 2 adjacent empty lines:
The following patterns are considered problems:
/* horse */
a {}
b {}The following patterns are not considered problems:
/*
Call me Ishmael.
Some years ago -- never mind how long precisely -- ...
*/a {
/*
Comment
inside the declaration with a lot of empty lines...
*/
color: pink;
}