Skip to content

Commit 1515ff4

Browse files
committed
[eslint] remove useless regex escapes
1 parent 1700642 commit 1515ff4

File tree

4 files changed

+5
-4
lines changed

4 files changed

+5
-4
lines changed

.eslintrc

+1
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,6 @@
1111
"anonymous": "always",
1212
"named": "never",
1313
}],
14+
"no-useless-escape": "error",
1415
},
1516
}

lib/results.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ var inspect = require('object-inspect');
77
var bind = require('function-bind');
88
var has = require('has');
99
var regexpTest = bind.call(Function.call, RegExp.prototype.test);
10-
var yamlIndicators = /\:|\-|\?/;
10+
var yamlIndicators = /:|-|\?/;
1111
var nextTick = typeof setImmediate !== 'undefined'
1212
? setImmediate
1313
: process.nextTick

lib/test.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -269,8 +269,8 @@ Test.prototype._assert = function assert(ok, opts) {
269269
270270
/((?:\/|[a-zA-Z]:\\)[^:\)]+:(\d+)(?::(\d+))?)\)?/
271271
*/
272-
var re = /^(?:[^\s]*\s*\bat\s+)(?:(.*)\s+\()?((?:\/|[a-zA-Z]:\\)[^:\)]+:(\d+)(?::(\d+))?)\)?$/;
273-
var lineWithTokens = err[i].replace(process.cwd(), '/\$CWD').replace(__dirname, '/\$TEST');
272+
var re = /^(?:[^\s]*\s*\bat\s+)(?:(.*)\s+\()?((?:\/|[a-zA-Z]:\\)[^:)]+:(\d+)(?::(\d+))?)\)?$/;
273+
var lineWithTokens = err[i].replace(process.cwd(), '/$CWD').replace(__dirname, '/$TEST');
274274
var m = re.exec(lineWithTokens);
275275

276276
if (!m) {

test/common.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ var stripChangingData = function (line) {
3737
var withoutPackageDir = withoutTestDir.replace(path.dirname(__dirname), '$TAPE');
3838
var withoutPathSep = withoutPackageDir.replace(new RegExp('\\' + path.sep, 'g'), '/');
3939
var withoutLineNumbers = withoutPathSep.replace(/:\d+:\d+/g, ':$LINE:$COL');
40-
var withoutNestedLineNumbers = withoutLineNumbers.replace(/, \<anonymous\>:\$LINE:\$COL\)$/, ')');
40+
var withoutNestedLineNumbers = withoutLineNumbers.replace(/, <anonymous>:\$LINE:\$COL\)$/, ')');
4141
return withoutNestedLineNumbers;
4242
};
4343

0 commit comments

Comments
 (0)