Skip to content
This repository has been archived by the owner on Mar 23, 2024. It is now read-only.

Commit

Permalink
Fix disallowMultipleLineBreaks with shebang line
Browse files Browse the repository at this point in the history
Previously failing when there was a blank line between the shebang and
the following code.

Fixes #634
  • Loading branch information
Nicolas Gallagher authored and mikesherov committed Sep 17, 2014
1 parent 15dee23 commit 3505d48
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/string-checker.js
Expand Up @@ -226,7 +226,7 @@ StringChecker.prototype = {
*/
checkString: function(str, filename) {
filename = filename || 'input';
str = str.replace(/^#!?[^\n]+\n/gm, '\n');
str = str.replace(/^#!?[^\n]+\n/gm, '');

var tree;
var parseError;
Expand Down
1 change: 1 addition & 0 deletions test/rules/disallow-multiple-line-breaks.js
Expand Up @@ -18,6 +18,7 @@ describe('rules/disallow-multiple-line-breaks', function() {
it('should not report single line break when first line starts with #!', function() {
checker.configure({ disallowMultipleLineBreaks: true });
assert(checker.checkString('#!/usr/bin/env node\nx = 1;').isEmpty());
assert(checker.checkString('#!/usr/bin/env node\n\nx = 1;').isEmpty());
});
it('should report only once per each sequence of line breaks', function() {
checker.configure({ disallowMultipleLineBreaks: true });
Expand Down

0 comments on commit 3505d48

Please sign in to comment.