Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,10 @@ module.exports = {
'one-var-declaration-per-line': 'error',
'operator-linebreak': ['error', 'after'],
'prefer-const': ['error', { ignoreReadBeforeAssign: true }],
'quotes': ['error', 'single', { avoidEscape: true }],
'quotes': ['error', 'single', {
avoidEscape: true,
allowTemplateLiterals: true
}],
'quote-props': ['error', 'consistent'],
'rest-spread-spacing': 'error',
'semi': 'error',
Expand Down
2 changes: 1 addition & 1 deletion doc/api/assert.md
Original file line number Diff line number Diff line change
Expand Up @@ -883,7 +883,7 @@ assert.ok();
// throws:
// "AssertionError: No value argument passed to `assert.ok`.

assert.ok(false, 'it\'s false');
assert.ok(false, "it's false");
// throws "AssertionError: it's false"

// In the repl:
Expand Down
2 changes: 1 addition & 1 deletion doc/api/console.md
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ used as the error message.
```js
console.assert(true, 'does nothing');
// OK
console.assert(false, 'Whoops %s work', 'didn\'t');
console.assert(false, 'Whoops %s work', "didn't");
// Assertion failed: Whoops didn't work
```

Expand Down
2 changes: 1 addition & 1 deletion doc/api/fs.md
Original file line number Diff line number Diff line change
Expand Up @@ -1419,7 +1419,7 @@ Then call the `callback` argument with either true or false. Example:

```js
fs.exists('/etc/passwd', (exists) => {
console.log(exists ? 'it\'s there' : 'no passwd!');
console.log(exists ? "it's there" : 'no passwd!');
});
```

Expand Down
2 changes: 1 addition & 1 deletion doc/api/util.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ The `section` supports wildcard also:
const util = require('util');
const debuglog = util.debuglog('foo-bar');

debuglog('hi there, it\'s foo-bar [%d]', 2333);
debuglog("hi there, it's foo-bar [%d]", 2333);
```

if it is run with `NODE_DEBUG=foo*` in the environment, then it will output
Expand Down
2 changes: 1 addition & 1 deletion doc/guides/using-internal-errors.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ message string. A simple example is:
// Test ERR_TLS_CERT_ALTNAME_INVALID
assert.strictEqual(
errors.message('ERR_TLS_CERT_ALTNAME_INVALID', ['altname']),
'Hostname/IP does not match certificate\'s altnames: altname');
"Hostname/IP does not match certificate's altnames: altname");
```

In addition, there should also be tests which validate the use of the
Expand Down
2 changes: 1 addition & 1 deletion lib/_http_server.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ const STATUS_CODES = {
415: 'Unsupported Media Type',
416: 'Range Not Satisfiable',
417: 'Expectation Failed',
418: 'I\'m a teapot', // RFC 2324
418: "I'm a teapot", // RFC 2324
421: 'Misdirected Request',
422: 'Unprocessable Entity', // RFC 4918
423: 'Locked', // RFC 4918
Expand Down
2 changes: 1 addition & 1 deletion lib/events.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ function longestSeqContainedIn(a, b) {
}

function enhanceStackTrace(err, own) {
const sep = '\nEmitted \'error\' event at:\n';
const sep = "\nEmitted 'error' event at:\n";

const errStack = err.stack.split('\n').slice(1);
const ownStack = own.stack.split('\n').slice(1);
Expand Down
2 changes: 1 addition & 1 deletion lib/internal/errors.js
Original file line number Diff line number Diff line change
Expand Up @@ -982,7 +982,7 @@ E('ERR_STREAM_WRAP', 'Stream has StringDecoder set or is in objectMode', Error);
E('ERR_STREAM_WRITE_AFTER_END', 'write after end', Error);
E('ERR_SYSTEM_ERROR', 'A system error occurred', SystemError);
E('ERR_TLS_CERT_ALTNAME_INVALID',
'Hostname/IP does not match certificate\'s altnames: %s', Error);
"Hostname/IP does not match certificate's altnames: %s", Error);
E('ERR_TLS_DH_PARAM_SIZE', 'DH parameter size %s is less than 2048', Error);
E('ERR_TLS_HANDSHAKE_TIMEOUT', 'TLS handshake timeout', Error);
E('ERR_TLS_RENEGOTIATION_DISABLED',
Expand Down
2 changes: 1 addition & 1 deletion lib/internal/modules/cjs/loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ Module._findPath = function(request, paths, isMain) {
if (!warned) {
warned = true;
process.emitWarning(
'warning: require(\'.\') resolved outside the package ' +
"warning: require('.') resolved outside the package " +
'directory. This functionality is deprecated and will be removed ' +
'soon.',
'DeprecationWarning', 'DEP0019');
Expand Down
2 changes: 1 addition & 1 deletion lib/repl.js
Original file line number Diff line number Diff line change
Expand Up @@ -1539,7 +1539,7 @@ function isCodeRecoverable(code) {
}
} else {
if (current.trim()) prevTokenChar = current;
if (current === '\'' || current === '"') {
if (current === "'" || current === '"') {
stringLiteral = current;
}
}
Expand Down
2 changes: 1 addition & 1 deletion test/addons-napi/test_promise/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ common.crashOnUnhandledRejection();

// A rejection
{
const expected_result = 'It\'s not you, it\'s me.';
const expected_result = "It's not you, it's me.";
const promise = test_promise.createPromise();
promise.then(
common.mustNotCall(),
Expand Down
2 changes: 1 addition & 1 deletion test/addons-napi/test_string/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ assert.strictEqual(test_string.TestUtf16Insufficient(str2), str2.slice(0, 3));
assert.strictEqual(test_string.Utf16Length(str2), 62);
assert.strictEqual(test_string.Utf8Length(str2), 62);

const str3 = '?!@#$%^&*()_+-=[]{}/.,<>\'"\\';
const str3 = `?!@#$%^&*()_+-=[]{}/.,<>'"\\`;
assert.strictEqual(test_string.TestLatin1(str3), str3);
assert.strictEqual(test_string.TestUtf8(str3), str3);
assert.strictEqual(test_string.TestUtf16(str3), str3);
Expand Down
2 changes: 1 addition & 1 deletion test/addons/load-long-path/test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict';
const common = require('../../common');
if (common.isWOW64)
common.skip('doesn\'t work on WOW64');
common.skip("doesn't work on WOW64");

const fs = require('fs');
const path = require('path');
Expand Down
2 changes: 1 addition & 1 deletion test/addons/node-module-version/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const common = require('../../common');
const assert = require('assert');

const re = new RegExp(
'^Error: The module \'.+\'\n' +
"^Error: The module '.+'\n" +
'was compiled against a different Node\\.js version using\n' +
'NODE_MODULE_VERSION 42\\. This version of Node\\.js requires\n' +
`NODE_MODULE_VERSION ${process.versions.modules}\\. ` +
Expand Down
2 changes: 1 addition & 1 deletion test/addons/repl-domain-abort/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ const lines = [
`require('${buildPath}')` +
// Log output to double check callback ran.
'.method(function(v1, v2) {' +
'console.log(\'cb_ran\'); return v1 === true && v2 === false; });',
"console.log('cb_ran'); return v1 === true && v2 === false; });",
];

const dInput = new stream.Readable();
Expand Down
2 changes: 1 addition & 1 deletion test/common/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ Object.defineProperty(exports, 'localhostIPv4', {
if (process.env.LOCALHOST) {
localhostIPv4 = process.env.LOCALHOST;
} else {
console.error('Looks like we\'re in a FreeBSD Jail. ' +
console.error("Looks like we're in a FreeBSD Jail. " +
'Please provide your default interface address ' +
'as LOCALHOST or expect some tests to fail.');
}
Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/url-searchparams.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ module.exports = [
[
"my%20weird%20field=q1!2%22'w%245%267%2Fz8)%3F",
'my+weird+field=q1%212%22%27w%245%267%2Fz8%29%3F',
[['my weird field', 'q1!2"\'w$5&7/z8)?']]
[['my weird field', `q1!2"'w$5&7/z8)?`]]
],
['foo%3Dbaz=bar', 'foo%3Dbaz=bar', [['foo=baz', 'bar']]],
['foo=baz=bar', 'foo=baz%3Dbar', [['foo', 'baz=bar']]],
Expand Down
4 changes: 2 additions & 2 deletions test/parallel/test-assert-deep.js
Original file line number Diff line number Diff line change
Expand Up @@ -666,7 +666,7 @@ assert.deepEqual(4, '4');
assert.deepEqual(true, 1);
assert.throws(() => assert.deepEqual(4, '5'),
AssertionError,
'deepEqual( 4, \'5\')');
"deepEqual( 4, '5')");

// Having the same number of owned properties && the same set of keys.
assert.deepEqual({ a: 4 }, { a: 4 });
Expand Down Expand Up @@ -901,7 +901,7 @@ assert.throws(() => assert.deepStrictEqual(new Boolean(true), {}),
() => assert.deepStrictEqual(a, b),
{
message: `${defaultMsgStart}\n\n` +
' [TypeError: foo] {\n- foo: \'bar\'\n+ foo: \'baz\'\n }'
" [TypeError: foo] {\n- foo: 'bar'\n+ foo: 'baz'\n }"
}
);
}
Expand Down
4 changes: 2 additions & 2 deletions test/parallel/test-assert-fail-deprecation.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ assert.throws(() => {
}, {
code: 'ERR_ASSERTION',
name: 'AssertionError [ERR_ASSERTION]',
message: '\'first\' != \'second\'',
message: "'first' != 'second'",
operator: '!=',
actual: 'first',
expected: 'second'
Expand Down Expand Up @@ -48,7 +48,7 @@ assert.throws(() => {
}, {
code: 'ERR_ASSERTION',
name: 'AssertionError [ERR_ASSERTION]',
message: '\'first\' operator \'second\'',
message: "'first' operator 'second'",
operator: 'operator',
actual: 'first',
expected: 'second'
Expand Down
6 changes: 3 additions & 3 deletions test/parallel/test-assert.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ assert.throws(() => a(false), a.AssertionError, 'ok(false)');
assert.throws(() => a.ok(false), a.AssertionError, 'ok(false)');

a(true);
a('test', 'ok(\'test\')');
a('test', "ok('test')");
a.ok(true);
a.ok('test');

Expand All @@ -62,7 +62,7 @@ assert.throws(() => a.notEqual(true, true),
a.AssertionError, 'notEqual(true, true)');

assert.throws(() => a.strictEqual(2, '2'),
a.AssertionError, 'strictEqual(2, \'2\')');
a.AssertionError, "strictEqual(2, '2')");

assert.throws(() => a.strictEqual(null, undefined),
a.AssertionError, 'strictEqual(null, undefined)');
Expand Down Expand Up @@ -277,7 +277,7 @@ testAssertionMessage(NaN, 'NaN');
testAssertionMessage(Infinity, 'Infinity');
testAssertionMessage(-Infinity, '-Infinity');
testAssertionMessage('', '""');
testAssertionMessage('foo', '\'foo\'');
testAssertionMessage('foo', "'foo'");
testAssertionMessage([], '[]');
testAssertionMessage([1, 2, 3], '[\n- 1,\n- 2,\n- 3\n- ]');
testAssertionMessage(/a/, '/a/');
Expand Down
4 changes: 2 additions & 2 deletions test/parallel/test-cli-eval.js
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ child.exec(`${nodejs} --use-strict -p process.execArgv`,
].forEach(function(args) {

// Ensure that arguments are successfully passed to eval.
const opt = ' --eval "console.log(process.argv.slice(1).join(\' \'))"';
const opt = ` --eval "console.log(process.argv.slice(1).join(' '))"`;
const cmd = `${nodejs}${opt} -- ${args}`;
child.exec(cmd, common.mustCall(function(err, stdout, stderr) {
assert.strictEqual(stdout, `${args}\n`);
Expand All @@ -213,7 +213,7 @@ child.exec(`${nodejs} --use-strict -p process.execArgv`,
}));

// Ensure that arguments are successfully passed to print.
const popt = ' --print "process.argv.slice(1).join(\' \')"';
const popt = ` --print "process.argv.slice(1).join(' ')"`;
const pcmd = `${nodejs}${popt} -- ${args}`;
child.exec(pcmd, common.mustCall(function(err, stdout, stderr) {
assert.strictEqual(stdout, `${args}\n`);
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-cluster-net-listen-relative-path.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const tmpdir = require('../common/tmpdir');

if (common.isWindows)
common.skip('On Windows named pipes live in their own ' +
'filesystem and don\'t have a ~100 byte limit');
"filesystem and don't have a ~100 byte limit");

// Choose a socket name such that the absolute path would exceed 100 bytes.
const socketDir = './unix-socket-dir';
Expand Down
4 changes: 2 additions & 2 deletions test/parallel/test-crypto-binary-default.js
Original file line number Diff line number Diff line change
Expand Up @@ -384,11 +384,11 @@ assert.throws(function() {
// Test SHA512 as assumed latin1
assert.strictEqual(
a3,
'\u00c1(4\u00f1\u0003\u001fd\u0097!O\'\u00d4C/&Qz\u00d4' +
"\u00c1(4\u00f1\u0003\u001fd\u0097!O'\u00d4C/&Qz\u00d4" +
'\u0094\u0015l\u00b8\u008dQ+\u00db\u001d\u00c4\u00b5}\u00b2' +
'\u00d6\u0092\u00a3\u00df\u00a2i\u00a1\u009b\n\n*\u000f' +
'\u00d7\u00d6\u00a2\u00a8\u0085\u00e3<\u0083\u009c\u0093' +
'\u00c2\u0006\u00da0\u00a1\u00879(G\u00ed\''
"\u00c2\u0006\u00da0\u00a1\u00879(G\u00ed'"
);

assert.deepStrictEqual(
Expand Down
4 changes: 2 additions & 2 deletions test/parallel/test-crypto-hash.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,11 @@ digest = 'latin1';
assert.deepStrictEqual(
a3,
Buffer.from(
'\u00c1(4\u00f1\u0003\u001fd\u0097!O\'\u00d4C/&Qz\u00d4' +
"\u00c1(4\u00f1\u0003\u001fd\u0097!O'\u00d4C/&Qz\u00d4" +
'\u0094\u0015l\u00b8\u008dQ+\u00db\u001d\u00c4\u00b5}\u00b2' +
'\u00d6\u0092\u00a3\u00df\u00a2i\u00a1\u009b\n\n*\u000f' +
'\u00d7\u00d6\u00a2\u00a8\u0085\u00e3<\u0083\u009c\u0093' +
'\u00c2\u0006\u00da0\u00a1\u00879(G\u00ed\'',
"\u00c2\u0006\u00da0\u00a1\u00879(G\u00ed'",
'latin1'),
`${cryptoType} with ${digest} digest failed to evaluate to expected hash`);
cryptoType = 'sha1';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@ function runTestWithoutAbortOnUncaughtException() {
// process' uncaughtException handler.
assert(stderr.includes(uncaughtExceptionHandlerErrMsg),
'stderr output must include proper uncaughtException ' +
'handler\'s error\'s message');
"handler's error's message");
assert(!stderr.includes(domainErrMsg),
'stderr output must not include domain\'s error\'s message');
"stderr output must not include domain's error's message");

assert.notStrictEqual(err.code, 0,
'child process should have exited with a ' +
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-errors-systemerror.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ assert.throws(
() => { throw new errors.SystemError(); },
{
name: 'TypeError',
message: 'Cannot read property \'match\' of undefined'
message: "Cannot read property 'match' of undefined"
}
);

Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-eslint-inspector-check.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const rule = require('../../tools/eslint-rules/inspector-check');

const message = 'Please add a skipIfInspectorDisabled() call to allow this ' +
'test to be skippped when Node is built ' +
'\'--without-inspector\'.';
"'--without-inspector'.";

new RuleTester().run('inspector-check', rule, {
valid: [
Expand Down
20 changes: 8 additions & 12 deletions test/parallel/test-eslint-lowercase-name-for-primitive.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,28 +24,24 @@ new RuleTester().run('lowercase-name-for-primitive', rule, {
],
invalid: [
{
code: 'new errors.TypeError(\'ERR_INVALID_ARG_TYPE\', \'a\', ' +
'\'Number\')',
code: "new errors.TypeError('ERR_INVALID_ARG_TYPE', 'a', 'Number')",
errors: [{ message: 'primitive should use lowercase: Number' }],
output: 'new errors.TypeError(\'ERR_INVALID_ARG_TYPE\', \'a\', ' +
'\'number\')'
output: "new errors.TypeError('ERR_INVALID_ARG_TYPE', 'a', 'number')"
},
{
code: 'new errors.TypeError(\'ERR_INVALID_ARG_TYPE\', \'a\', ' +
'\'STRING\')',
code: "new errors.TypeError('ERR_INVALID_ARG_TYPE', 'a', 'STRING')",
errors: [{ message: 'primitive should use lowercase: STRING' }],
output: 'new errors.TypeError(\'ERR_INVALID_ARG_TYPE\', \'a\', ' +
'\'string\')'
output: "new errors.TypeError('ERR_INVALID_ARG_TYPE', 'a', 'string')"
},
{
code: 'new errors.TypeError(\'ERR_INVALID_ARG_TYPE\', \'a\', ' +
'[\'String\', \'Number\']) ',
code: "new errors.TypeError('ERR_INVALID_ARG_TYPE', 'a', " +
"['String', 'Number']) ",
errors: [
{ message: 'primitive should use lowercase: String' },
{ message: 'primitive should use lowercase: Number' }
],
output: 'new errors.TypeError(\'ERR_INVALID_ARG_TYPE\', \'a\', ' +
'[\'string\', \'number\']) '
output: "new errors.TypeError('ERR_INVALID_ARG_TYPE', 'a', " +
"['string', 'number']) "
}
]
});
10 changes: 5 additions & 5 deletions test/parallel/test-eslint-prefer-util-format-errors.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ const rule = require('../../tools/eslint-rules/prefer-util-format-errors');
new RuleTester({ parserOptions: { ecmaVersion: 6 } })
.run('prefer-util-format-errors', rule, {
valid: [
'E(\'ABC\', \'abc\');',
'E(\'ABC\', (arg1, arg2) => `${arg2}${arg1}`);',
'E(\'ABC\', (arg1, arg2) => `${arg1}{arg2.something}`);',
'E(\'ABC\', (arg1, arg2) => fn(arg1, arg2));'
"E('ABC', 'abc');",
"E('ABC', (arg1, arg2) => `${arg2}${arg1}`);",
"E('ABC', (arg1, arg2) => `${arg1}{arg2.something}`);",
"E('ABC', (arg1, arg2) => fn(arg1, arg2));"
],
invalid: [
{
code: 'E(\'ABC\', (arg1, arg2) => `${arg1}${arg2}`);',
code: "E('ABC', (arg1, arg2) => `${arg1}${arg2}`);",
errors: [{
message: 'Please use a printf-like formatted string that ' +
'util.format can consume.'
Expand Down
6 changes: 3 additions & 3 deletions test/parallel/test-eslint-require-buffer.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@ const ruleTester = new RuleTester({
const message = "Use const Buffer = require('buffer').Buffer; " +
'at the beginning of this file';

const useStrict = '\'use strict\';\n\n';
const bufferModule = 'const { Buffer } = require(\'buffer\');\n';
const useStrict = "'use strict';\n\n";
const bufferModule = "const { Buffer } = require('buffer');\n";
const mockComment = '// Some Comment\n//\n// Another Comment\n\n';
const useBuffer = 'Buffer;';
ruleTester.run('require-buffer', rule, {
valid: [
'foo',
'const Buffer = require("Buffer"); Buffer;',
'const { Buffer } = require(\'buffer\'); Buffer;',
"const { Buffer } = require('buffer'); Buffer;",
],
invalid: [
{
Expand Down
4 changes: 2 additions & 2 deletions test/parallel/test-eval-strict-referenceerror.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ function test() {
'var foo = {m: 1};',
'',
'function bar() {',
'\'use strict\';',
'return foo; // foo isn\'t captured in 0.10',
"'use strict';",
"return foo; // foo isn't captured in 0.10",
'};'
].join('\n');

Expand Down
Loading