2018-01-21 21:44:25 -08:00
|
|
|
// @ts-check
|
|
|
|
|
|
|
|
"use strict";
|
|
|
|
|
2018-04-27 22:05:34 -07:00
|
|
|
const shared = require("./shared");
|
2018-01-21 21:44:25 -08:00
|
|
|
|
|
|
|
module.exports = {
|
|
|
|
"names": [ "MD012", "no-multiple-blanks" ],
|
|
|
|
"description": "Multiple consecutive blank lines",
|
|
|
|
"tags": [ "whitespace", "blank_lines" ],
|
|
|
|
"function": function MD012(params, onError) {
|
2018-04-27 22:05:34 -07:00
|
|
|
const maximum = params.config.maximum || 1;
|
|
|
|
let count = 0;
|
2018-03-04 23:06:31 -08:00
|
|
|
shared.forEachLine(function forLine(line, lineIndex, inCode) {
|
2018-01-21 21:44:25 -08:00
|
|
|
count = (inCode || line.trim().length) ? 0 : count + 1;
|
|
|
|
if (maximum < count) {
|
|
|
|
shared.addErrorDetailIf(onError, lineIndex + 1, maximum, count);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
};
|