From 363723fc84f7b8477592e0105aeb331ec9a017af Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Mon, 14 Aug 2017 05:01:11 +0200 Subject: node_modules --- node_modules/tslint/lib/enableDisableRules.js | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'node_modules/tslint/lib/enableDisableRules.js') diff --git a/node_modules/tslint/lib/enableDisableRules.js b/node_modules/tslint/lib/enableDisableRules.js index e76cb63bd..27c58d5d8 100644 --- a/node_modules/tslint/lib/enableDisableRules.js +++ b/node_modules/tslint/lib/enableDisableRules.js @@ -19,6 +19,14 @@ Object.defineProperty(exports, "__esModule", { value: true }); // tslint:disable object-literal-sort-keys var utils = require("tsutils"); var ts = require("typescript"); +/** + * regex is: start of string followed by any amount of whitespace + * followed by tslint and colon + * followed by either "enable" or "disable" + * followed optionally by -line or -next-line + * followed by either colon, whitespace or end of string + */ +exports.ENABLE_DISABLE_REGEX = /^\s*tslint:(enable|disable)(?:-(line|next-line))?(:|\s|$)/; function removeDisabledFailures(sourceFile, failures) { if (failures.length === 0) { // Usually there won't be failures anyway, so no need to look for "tslint:disable". @@ -118,12 +126,7 @@ function getSwitchRange(modifier, range, sourceFile) { } } function parseComment(commentText) { - // regex is: start of string followed by any amount of whitespace - // followed by tslint and colon - // followed by either "enable" or "disable" - // followed optionally by -line or -next-line - // followed by either colon, whitespace or end of string - var match = /^\s*tslint:(enable|disable)(?:-(line|next-line))?(:|\s|$)/.exec(commentText); + var match = exports.ENABLE_DISABLE_REGEX.exec(commentText); if (match === null) { return undefined; } -- cgit v1.2.3