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

fix[file-header]: fix enforce-trailing-newline option #4890

Merged
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
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"
]
}
}