mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-12-18 06:50:12 +01:00
22 lines
548 B
JavaScript
22 lines
548 B
JavaScript
// @ts-check
|
|
|
|
"use strict";
|
|
|
|
const shared = require("./shared");
|
|
const { isBlankLine } = shared;
|
|
|
|
module.exports = {
|
|
"names": [ "MD047", "new-line-eof" ],
|
|
"description": "New lines at the end of file",
|
|
"tags": [ "blank_lines" ],
|
|
"function": function rule(params, onError) {
|
|
const lastLineNumber = params.lines.length;
|
|
const lastLine = params.lines[lastLineNumber - 1];
|
|
if (!isBlankLine(lastLine)) {
|
|
onError({
|
|
"lineNumber": lastLineNumber,
|
|
"detail": "file does not end with new line"
|
|
});
|
|
}
|
|
}
|
|
};
|