diff options
author | Florian Dold <florian.dold@gmail.com> | 2017-08-14 05:01:11 +0200 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2017-08-14 05:02:09 +0200 |
commit | 363723fc84f7b8477592e0105aeb331ec9a017af (patch) | |
tree | 29f92724f34131bac64d6a318dd7e30612e631c7 /node_modules/tslint/lib/enableDisableRules.js | |
parent | 5634e77ad96bfe1818f6b6ee70b7379652e5487f (diff) |
node_modules
Diffstat (limited to 'node_modules/tslint/lib/enableDisableRules.js')
-rw-r--r-- | node_modules/tslint/lib/enableDisableRules.js | 15 |
1 files changed, 9 insertions, 6 deletions
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; } |