mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2026-01-28 18:06:10 +01:00
Updated MD047 name, desription and adjusted tests
This commit is contained in:
parent
33eaf0bdda
commit
cf259d4099
9 changed files with 27 additions and 49 deletions
13
lib/md047.js
13
lib/md047.js
|
|
@ -3,20 +3,17 @@
|
|||
"use strict";
|
||||
|
||||
const shared = require("./shared");
|
||||
const { isBlankLine } = shared;
|
||||
const { addError, isBlankLine } = shared;
|
||||
|
||||
module.exports = {
|
||||
"names": [ "MD047", "new-line-eof" ],
|
||||
"description": "New lines at the end of file",
|
||||
"names": [ "MD047", "single-trailing-newline" ],
|
||||
"description": "Files should end with a single newline character",
|
||||
"tags": [ "blank_lines" ],
|
||||
"function": function rule(params, onError) {
|
||||
"function": function MD047(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"
|
||||
});
|
||||
addError(onError, lastLineNumber);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue