Skip to content

Commit

Permalink
lib,test: lint fixes for linter upgrade
Browse files Browse the repository at this point in the history
ESLint 4.19.1 fixes some bugs in rules. These changes prepare us for the
upgrade.

PR-URL: #19528
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information
Trott authored and targos committed Mar 27, 2018
1 parent ae0e243 commit 419e88e
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 26 deletions.
1 change: 1 addition & 0 deletions lib/_http_client.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ function ClientRequest(options, cb) {
if (path.length <= 39) { // Determined experimentally in V8 5.4
invalidPath = isInvalidPath(path);
} else {
// eslint-disable-next-line no-control-regex
invalidPath = /[\u0000-\u0020]/.test(path);
}
if (invalidPath)
Expand Down
2 changes: 2 additions & 0 deletions lib/internal/readline.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@
// Adopted from https://github.com/chalk/ansi-regex/blob/master/index.js
// License: MIT, authors: @sindresorhus, Qix-, and arjunmehta
// Matches all ansi escape code sequences in a string
/* eslint-disable no-control-regex */
const ansi =
/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g;
/* eslint-enable no-control-regex */

const kEscape = '\x1b';

Expand Down
2 changes: 1 addition & 1 deletion lib/internal/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const noCrypto = !process.versions.openssl;

const experimentalWarnings = new Set();

const colorRegExp = /\u001b\[\d\d?m/g;
const colorRegExp = /\u001b\[\d\d?m/g; // eslint-disable-line no-control-regex

function removeColors(str) {
return str.replace(colorRegExp, '');
Expand Down
2 changes: 2 additions & 0 deletions test/parallel/test-require-nul.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ require('../common');
const assert = require('assert');

// Nul bytes should throw, not abort.
/* eslint-disable no-control-regex */
assert.throws(() => require('\u0000ab'), /Cannot find module '\u0000ab'/);
assert.throws(() => require('a\u0000b'), /Cannot find module 'a\u0000b'/);
assert.throws(() => require('ab\u0000'), /Cannot find module 'ab\u0000'/);
/* eslint-enable no-control-regex */
50 changes: 25 additions & 25 deletions test/parallel/test-tls-client-verify.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,37 +28,37 @@ const assert = require('assert');
const tls = require('tls');
const fixtures = require('../common/fixtures');

const testCases =
[{ ca: ['ca1-cert'],
key: 'agent2-key',
cert: 'agent2-cert',
servers: [
const testCases = [
{ ca: ['ca1-cert'],
key: 'agent2-key',
cert: 'agent2-cert',
servers: [
{ ok: true, key: 'agent1-key', cert: 'agent1-cert' },
{ ok: false, key: 'agent2-key', cert: 'agent2-cert' },
{ ok: false, key: 'agent3-key', cert: 'agent3-cert' }
]
},

{ ca: [],
key: 'agent2-key',
cert: 'agent2-cert',
servers: [
{ ok: false, key: 'agent1-key', cert: 'agent1-cert' },
{ ok: false, key: 'agent2-key', cert: 'agent2-cert' },
{ ok: false, key: 'agent3-key', cert: 'agent3-cert' }
]
},

{ ca: ['ca1-cert', 'ca2-cert'],
key: 'agent2-key',
cert: 'agent2-cert',
servers: [
{ ok: true, key: 'agent1-key', cert: 'agent1-cert' },
{ ok: false, key: 'agent2-key', cert: 'agent2-cert' },
{ ok: true, key: 'agent3-key', cert: 'agent3-cert' }
]
}
];
{ ca: [],
key: 'agent2-key',
cert: 'agent2-cert',
servers: [
{ ok: false, key: 'agent1-key', cert: 'agent1-cert' },
{ ok: false, key: 'agent2-key', cert: 'agent2-cert' },
{ ok: false, key: 'agent3-key', cert: 'agent3-cert' }
]
},

{ ca: ['ca1-cert', 'ca2-cert'],
key: 'agent2-key',
cert: 'agent2-cert',
servers: [
{ ok: true, key: 'agent1-key', cert: 'agent1-cert' },
{ ok: false, key: 'agent2-key', cert: 'agent2-cert' },
{ ok: true, key: 'agent3-key', cert: 'agent3-cert' }
]
}
];


function loadPEM(n) {
Expand Down

0 comments on commit 419e88e

Please sign in to comment.