Skip to content

Commit

Permalink
Fix: eol-last allow empty-string to always pass (refs #9534) (#9696)
Browse files Browse the repository at this point in the history
Note that there are already tests asserting this behavior, but they aren't actually run in the rules. See #9534
  • Loading branch information
platinumazure authored and ilyavolodin committed Dec 11, 2017
1 parent d80aa7c commit b72dc83
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions lib/rules/eol-last.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,14 @@ module.exports = {
CRLF = `\r${LF}`,
endsWithNewline = lodash.endsWith(src, LF);

/*
* Empty source is always valid: No content in file so we don't
* need to lint for a newline on the last line of content.
*/
if (!src.length) {
return;
}

let mode = context.options[0] || "always",
appendCRLF = false;

Expand Down

0 comments on commit b72dc83

Please sign in to comment.