Skip to content

Commit

Permalink
Ignore whitespace only lines too
Browse files Browse the repository at this point in the history
  • Loading branch information
wooorm committed May 26, 2020
1 parent 3c896b3 commit dc4f092
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions packages/remark-lint-no-shell-dollars/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,7 @@ function noShellDollars(tree, file) {

// Check both known shell code and unknown code.
if (!generated(node) && node.lang && flags.indexOf(node.lang) !== -1) {
lines = node.value.split('\n').filter(function (line) {
return line
})
lines = node.value.split('\n').filter(notEmpty)
length = lines.length
index = -1

Expand All @@ -111,4 +109,8 @@ function noShellDollars(tree, file) {
file.message(reason, node)
}
}

function notEmpty(line) {
return line.trim().length !== 0
}
}

0 comments on commit dc4f092

Please sign in to comment.