Skip to content

Commit dc4f092

Browse files
committed
Ignore whitespace only lines too
1 parent 3c896b3 commit dc4f092

File tree

1 file changed

+5
-3
lines changed
  • packages/remark-lint-no-shell-dollars

1 file changed

+5
-3
lines changed

packages/remark-lint-no-shell-dollars/index.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,7 @@ function noShellDollars(tree, file) {
9090

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

@@ -111,4 +109,8 @@ function noShellDollars(tree, file) {
111109
file.message(reason, node)
112110
}
113111
}
112+
113+
function notEmpty(line) {
114+
return line.trim().length !== 0
115+
}
114116
}

0 commit comments

Comments
 (0)