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

fix File-Header rule #1913

Merged
merged 3 commits into from
Dec 23, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/rules/fileHeaderRule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class FileHeaderWalker extends Lint.RuleWalker {
} else {
// either the third or fourth capture group contains the comment contents
const comment = match[2] ? match[2] : match[3];
if (comment.search(this.headerRegexp) < 0) {
if (comment !== undefined && comment.search(this.headerRegexp) < 0) {
this.addFailureAt(offset, 0, Rule.FAILURE_STRING);
}
}
Expand Down
1 change: 1 addition & 0 deletions test/rules/file-header/empty-file/test.js.lint
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
// empty.
1 change: 1 addition & 0 deletions test/rules/file-header/empty-file/test.ts.lint
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
// empty.
8 changes: 8 additions & 0 deletions test/rules/file-header/empty-file/tslint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"rules": {
"file-header": [true, "Good header \\d"]
},
"jsRules": {
"file-header": [true, "Good header \\d"]
}
}