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

Commit

Permalink
fix[file-header]: fix enforce-trailing-newline (#4890)
Browse files Browse the repository at this point in the history
  • Loading branch information
tanmoyopenroot authored and Josh Goldberg committed Nov 10, 2019
1 parent 8c2ac95 commit b5de3dd
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
4 changes: 1 addition & 3 deletions src/rules/fileHeaderRule.ts
Expand Up @@ -244,9 +244,7 @@ export class Rule extends Lint.Rules.AbstractRule {
);

const NEW_LINE_FOLLOWING_HEADER = /^.*((\r)?\n){2,}$/gm;
return (
entireComment !== undefined && NEW_LINE_FOLLOWING_HEADER.test(entireComment) !== null
);
return entireComment !== undefined && !NEW_LINE_FOLLOWING_HEADER.test(entireComment);
}

private getFileHeaderText(
Expand Down
3 changes: 3 additions & 0 deletions test/rules/file-header/good-newline/test.ts.lint
@@ -0,0 +1,3 @@
/* Copyright 2019 */

class Foo {}
10 changes: 10 additions & 0 deletions test/rules/file-header/good-newline/tslint.json
@@ -0,0 +1,10 @@
{
"rules": {
"file-header": [
true,
"Copyright \\d{4}",
"Copyright 2019",
"enforce-trailing-newline"
]
}
}

0 comments on commit b5de3dd

Please sign in to comment.