aboutsummaryrefslogtreecommitdiff
path: root/node_modules/tslint/lib/enableDisableRules.js
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/tslint/lib/enableDisableRules.js')
-rw-r--r--node_modules/tslint/lib/enableDisableRules.js15
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;
}