@coffeelint/cli
Version:
Lint your CoffeeScript
33 lines (26 loc) • 776 B
JavaScript
(function() {
var EOLLast;
module.exports = EOLLast = (function() {
class EOLLast {
lintLine(line, lineApi) {
var isNewline, previousIsNewline;
if (!lineApi.isLastLine()) {
return null;
}
isNewline = line.length === 0;
previousIsNewline = lineApi.lineCount > 1 ? lineApi.lines[lineApi.lineNumber - 1].length === 0 : false;
if (!(isNewline && !previousIsNewline)) {
return true;
}
}
};
EOLLast.prototype.rule = {
type: 'style',
name: 'eol_last',
level: 'ignore',
message: 'File does not end with a single newline',
description: `Checks that the file ends with a single newline`
};
return EOLLast;
}).call(this);
}).call(this);