Skip to content

Commit

Permalink
[eslint] remove useless regex escapes
Browse files Browse the repository at this point in the history
  • Loading branch information
ljharb committed May 25, 2020
1 parent 1700642 commit 1515ff4
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions .eslintrc
Expand Up @@ -11,5 +11,6 @@
"anonymous": "always",
"named": "never",
}],
"no-useless-escape": "error",
},
}
2 changes: 1 addition & 1 deletion lib/results.js
Expand Up @@ -7,7 +7,7 @@ var inspect = require('object-inspect');
var bind = require('function-bind');
var has = require('has');
var regexpTest = bind.call(Function.call, RegExp.prototype.test);
var yamlIndicators = /\:|\-|\?/;
var yamlIndicators = /:|-|\?/;
var nextTick = typeof setImmediate !== 'undefined'
? setImmediate
: process.nextTick
Expand Down
4 changes: 2 additions & 2 deletions lib/test.js
Expand Up @@ -269,8 +269,8 @@ Test.prototype._assert = function assert(ok, opts) {
/((?:\/|[a-zA-Z]:\\)[^:\)]+:(\d+)(?::(\d+))?)\)?/
*/
var re = /^(?:[^\s]*\s*\bat\s+)(?:(.*)\s+\()?((?:\/|[a-zA-Z]:\\)[^:\)]+:(\d+)(?::(\d+))?)\)?$/;
var lineWithTokens = err[i].replace(process.cwd(), '/\$CWD').replace(__dirname, '/\$TEST');
var re = /^(?:[^\s]*\s*\bat\s+)(?:(.*)\s+\()?((?:\/|[a-zA-Z]:\\)[^:)]+:(\d+)(?::(\d+))?)\)?$/;
var lineWithTokens = err[i].replace(process.cwd(), '/$CWD').replace(__dirname, '/$TEST');
var m = re.exec(lineWithTokens);

if (!m) {
Expand Down
2 changes: 1 addition & 1 deletion test/common.js
Expand Up @@ -37,7 +37,7 @@ var stripChangingData = function (line) {
var withoutPackageDir = withoutTestDir.replace(path.dirname(__dirname), '$TAPE');
var withoutPathSep = withoutPackageDir.replace(new RegExp('\\' + path.sep, 'g'), '/');
var withoutLineNumbers = withoutPathSep.replace(/:\d+:\d+/g, ':$LINE:$COL');
var withoutNestedLineNumbers = withoutLineNumbers.replace(/, \<anonymous\>:\$LINE:\$COL\)$/, ')');
var withoutNestedLineNumbers = withoutLineNumbers.replace(/, <anonymous>:\$LINE:\$COL\)$/, ')');
return withoutNestedLineNumbers;
};

Expand Down

0 comments on commit 1515ff4

Please sign in to comment.