diff options
Diffstat (limited to 'node_modules/tslint/lib/rules/fileHeaderRule.js')
-rw-r--r-- | node_modules/tslint/lib/rules/fileHeaderRule.js | 32 |
1 files changed, 15 insertions, 17 deletions
diff --git a/node_modules/tslint/lib/rules/fileHeaderRule.js b/node_modules/tslint/lib/rules/fileHeaderRule.js index 8cd3d11eb..ff8a24b62 100644 --- a/node_modules/tslint/lib/rules/fileHeaderRule.js +++ b/node_modules/tslint/lib/rules/fileHeaderRule.js @@ -29,9 +29,7 @@ var Rule = (function (_super) { // ignore shebang if it exists var offset = text.startsWith("#!") ? text.indexOf("\n") : 0; // returns the text of the first comment or undefined - var commentText = ts.forEachLeadingCommentRange(text, offset, function (pos, end, kind) { - return text.substring(pos + 2, kind === ts.SyntaxKind.SingleLineCommentTrivia ? end : end - 2); - }); + var commentText = ts.forEachLeadingCommentRange(text, offset, function (pos, end, kind) { return text.substring(pos + 2, kind === ts.SyntaxKind.SingleLineCommentTrivia ? end : end - 2); }); if (commentText === undefined || !new RegExp(this.ruleArguments[0]).test(commentText)) { if (offset !== 0) { ++offset; // show warning in next line after shebang @@ -40,20 +38,20 @@ var Rule = (function (_super) { } return []; }; + /* tslint:disable:object-literal-sort-keys */ + Rule.metadata = { + ruleName: "file-header", + description: "Enforces a certain header comment for all files, matched by a regular expression.", + optionsDescription: "Regular expression to match the header.", + options: { + type: "string", + }, + optionExamples: [[true, "Copyright \\d{4}"]], + type: "style", + typescriptOnly: false, + }; + /* tslint:enable:object-literal-sort-keys */ + Rule.FAILURE_STRING = "missing file header"; return Rule; }(Lint.Rules.AbstractRule)); -/* tslint:disable:object-literal-sort-keys */ -Rule.metadata = { - ruleName: "file-header", - description: "Enforces a certain header comment for all files, matched by a regular expression.", - optionsDescription: "Regular expression to match the header.", - options: { - type: "string", - }, - optionExamples: [[true, "Copyright \\d{4}"]], - type: "style", - typescriptOnly: false, -}; -/* tslint:enable:object-literal-sort-keys */ -Rule.FAILURE_STRING = "missing file header"; exports.Rule = Rule; |