Skip to content

Commit 61ebfa8

Browse files
mscdexfhinkel
authored andcommitted
tools: add unescaped regexp dot rule to linter
PR-URL: #11834 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Teddy Katz <[email protected]> Reviewed-By: Franziska Hinkelmann <[email protected]>
1 parent 678480e commit 61ebfa8

35 files changed

+214
-47
lines changed

.eslintrc.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ rules:
136136
assert-throws-arguments: [2, { requireTwo: false }]
137137
new-with-error: [2, Error, RangeError, TypeError, SyntaxError, ReferenceError]
138138
timer-arguments: 2
139+
no-unescaped-regexp-dot: 2
139140

140141
# Global scoped method and vars
141142
globals:

benchmark/buffers/buffer-base64-decode.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ const bench = common.createBenchmark(main, {
99
function main(conf) {
1010
const n = +conf.n;
1111
const s = 'abcd'.repeat(8 << 20);
12+
// eslint-disable-next-line no-unescaped-regexp-dot
1213
s.match(/./); // Flatten string.
1314
assert.strictEqual(s.length % 4, 0);
1415
const b = Buffer.allocUnsafe(s.length / 4 * 3);

benchmark/child_process/child-process-exec-stdout.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ function main(conf) {
1818
const len = +conf.len;
1919

2020
const msg = `"${'.'.repeat(len)}"`;
21+
// eslint-disable-next-line no-unescaped-regexp-dot
2122
msg.match(/./);
2223
const options = {'stdio': ['ignore', 'pipe', 'ignore']};
2324
const child = exec(`yes ${msg}`, options);

test/addons/node-module-version/test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ const re = new RegExp(
77
'^Error: The module \'.+\'\n' +
88
'was compiled against a different Node\\.js version using\n' +
99
'NODE_MODULE_VERSION 42\\. This version of Node\\.js requires\n' +
10-
`NODE_MODULE_VERSION ${process.versions.modules}. ` +
10+
`NODE_MODULE_VERSION ${process.versions.modules}\\. ` +
1111
'Please try re-compiling or re-installing\n' +
1212
'the module \\(for instance, using `npm rebuild` or `npm install`\\)\\.$');
1313

test/debugger/test-debugger-repl-break-in-module.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ repl.addTest('restart', [].concat(
5454
],
5555
repl.handshakeLines,
5656
[
57-
/Restoring breakpoint mod.js:2/,
57+
/Restoring breakpoint mod\.js:2/,
5858
/Warning: script 'mod\.js' was not loaded yet\./,
5959
/Restoring breakpoint \).*:\d+/,
6060
/Warning: script '\)[^']*' was not loaded yet\./

test/debugger/test-debugger-repl.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ addTest('sb("setInterval()", "!(setInterval.flag++)")', [
7272

7373
// Continue
7474
addTest('c', [
75-
/break in timers.js:\d+/,
75+
/break in timers\.js:\d+/,
7676
/\d/, /\d/, /\d/, /\d/, /\d/
7777
]);
7878

test/inspector/test-inspector.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ function checkListResponse(err, response) {
1212
assert.ok(response[0]['devtoolsFrontendUrl']);
1313
assert.ok(
1414
response[0]['webSocketDebuggerUrl']
15-
.match(/ws:\/\/127.0.0.1:\d+\/[0-9A-Fa-f]{8}-/));
15+
.match(/ws:\/\/127\.0\.0\.1:\d+\/[0-9A-Fa-f]{8}-/));
1616
}
1717

1818
function checkVersion(err, response) {

test/parallel/test-assert.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,7 @@ assert.doesNotThrow(function() { assert.ifError(); });
406406

407407
assert.throws(() => {
408408
assert.doesNotThrow(makeBlock(thrower, Error), 'user message');
409-
}, /Got unwanted exception. user message/,
409+
}, /Got unwanted exception: user message/,
410410
'a.doesNotThrow ignores user message');
411411

412412
// make sure that validating using constructor really works

test/parallel/test-buffer-alloc.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -923,7 +923,7 @@ assert.throws(() => Buffer.allocUnsafe(10).copy(),
923923
/TypeError: argument should be a Buffer/);
924924

925925
const regErrorMsg = new RegExp('First argument must be a string, Buffer, ' +
926-
'ArrayBuffer, Array, or array-like object.');
926+
'ArrayBuffer, Array, or array-like object\\.');
927927

928928
assert.throws(() => Buffer.from(), regErrorMsg);
929929
assert.throws(() => Buffer.from(null), regErrorMsg);

test/parallel/test-crypto-dh.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ ecdh5.setPrivateKey(cafebabeKey, 'hex');
301301
].forEach((element) => {
302302
assert.throws(() => {
303303
ecdh5.setPrivateKey(element, 'hex');
304-
}, /^Error: Private key is not valid for specified curve.$/);
304+
}, /^Error: Private key is not valid for specified curve\.$/);
305305
// Verify object state did not change.
306306
assert.strictEqual(ecdh5.getPrivateKey('hex'), cafebabeKey);
307307
});

0 commit comments

Comments
 (0)