Skip to content

Commit b72dc83

Browse files
platinumazureilyavolodin
authored andcommittedDec 11, 2017
Fix: eol-last allow empty-string to always pass (refs #9534) (#9696)
Note that there are already tests asserting this behavior, but they aren't actually run in the rules. See #9534
1 parent d80aa7c commit b72dc83

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed
 

‎lib/rules/eol-last.js

+8
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,14 @@ module.exports = {
4646
CRLF = `\r${LF}`,
4747
endsWithNewline = lodash.endsWith(src, LF);
4848

49+
/*
50+
* Empty source is always valid: No content in file so we don't
51+
* need to lint for a newline on the last line of content.
52+
*/
53+
if (!src.length) {
54+
return;
55+
}
56+
4957
let mode = context.options[0] || "always",
5058
appendCRLF = false;
5159

0 commit comments

Comments
 (0)
Please sign in to comment.