From 2c2e09cdaf505ca8cc2d36043fd31166d90ce8db Mon Sep 17 00:00:00 2001 From: Ghislain Nadeau Date: Sun, 4 Sep 2016 23:33:58 -0400 Subject: [PATCH] fix unexpected eslint error with eol-last rule cherry-pick and squash of #200 by @JSlain - Fix Issue #198 - Fix test --- lib/plato.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/plato.js b/lib/plato.js index 92993b4a..ce6974a7 100644 --- a/lib/plato.js +++ b/lib/plato.js @@ -114,15 +114,15 @@ exports.inspect = function(files, outputDir, options, done) { var fileShort = file.replace(commonBasePath, ''); var fileSafe = fileShort.replace(/[^a-zA-Z0-9]/g,'_'); - var source = fs.readFileSync(file).toString().trim(); - if (!source) { + var source = fs.readFileSync(file).toString(); + if (!source.trim()) { log.info('Not parsing empty file "%s"', file); return; } // if skip empty line option if(options.noempty) { - source = source.replace(/^\s*[\r\n]/gm ,""); + source = source.replace(/^\s*[\r\n]/gm ,"").trim(); } // if begins with shebang