Skip to content

tools: enforce consistent operator linebreak style #10178

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Dec 10, 2016
Merged
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
1 change: 1 addition & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ rules:
no-multiple-empty-lines: [2, {max: 2, maxEOF: 0, maxBOF: 0}]
no-tabs: 2
no-trailing-spaces: 2
operator-linebreak: [2, after, {overrides: {'?': ignore, ':': ignore}}]
quotes: [2, single, avoid-escape]
semi: 2
semi-spacing: 2
Expand Down
4 changes: 2 additions & 2 deletions lib/timers.js
Original file line number Diff line number Diff line change
Expand Up @@ -473,8 +473,8 @@ function unrefdHandle() {

// Make sure we clean up if the callback is no longer a function
// even if the timer is an interval.
if (!this.owner._repeat
|| typeof this.owner._onTimeout !== 'function') {
if (!this.owner._repeat ||
typeof this.owner._onTimeout !== 'function') {
this.owner.close();
}
}
Expand Down
52 changes: 26 additions & 26 deletions test/parallel/test-preload.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,27 +32,27 @@ const fixtureD = fixture('define-global.js');
const fixtureThrows = fixture('throws_error4.js');

// test preloading a single module works
childProcess.exec(nodeBinary + ' '
+ preloadOption([fixtureA]) + ' '
+ fixtureB,
childProcess.exec(nodeBinary + ' ' +
preloadOption([fixtureA]) + ' ' +
fixtureB,
function(err, stdout, stderr) {
if (err) throw err;
assert.strictEqual(stdout, 'A\nB\n');
});

// test preloading multiple modules works
childProcess.exec(nodeBinary + ' '
+ preloadOption([fixtureA, fixtureB]) + ' '
+ fixtureC,
childProcess.exec(nodeBinary + ' ' +
preloadOption([fixtureA, fixtureB]) + ' ' +
fixtureC,
function(err, stdout, stderr) {
if (err) throw err;
assert.strictEqual(stdout, 'A\nB\nC\n');
});

// test that preloading a throwing module aborts
childProcess.exec(nodeBinary + ' '
+ preloadOption([fixtureA, fixtureThrows]) + ' '
+ fixtureB,
childProcess.exec(nodeBinary + ' ' +
preloadOption([fixtureA, fixtureThrows]) + ' ' +
fixtureB,
function(err, stdout, stderr) {
if (err) {
assert.strictEqual(stdout, 'A\n');
Expand All @@ -62,9 +62,9 @@ childProcess.exec(nodeBinary + ' '
});

// test that preload can be used with --eval
childProcess.exec(nodeBinary + ' '
+ preloadOption([fixtureA])
+ '-e "console.log(\'hello\');"',
childProcess.exec(nodeBinary + ' ' +
preloadOption([fixtureA]) +
'-e "console.log(\'hello\');"',
function(err, stdout, stderr) {
if (err) throw err;
assert.strictEqual(stdout, 'A\nhello\n');
Expand Down Expand Up @@ -108,19 +108,19 @@ replProc.on('close', function(code) {

// test that preload placement at other points in the cmdline
// also test that duplicated preload only gets loaded once
childProcess.exec(nodeBinary + ' '
+ preloadOption([fixtureA])
+ '-e "console.log(\'hello\');" '
+ preloadOption([fixtureA, fixtureB]),
childProcess.exec(nodeBinary + ' ' +
preloadOption([fixtureA]) +
'-e "console.log(\'hello\');" ' +
preloadOption([fixtureA, fixtureB]),
function(err, stdout, stderr) {
if (err) throw err;
assert.strictEqual(stdout, 'A\nB\nhello\n');
});

// test that preload works with -i
const interactive = childProcess.exec(nodeBinary + ' '
+ preloadOption([fixtureD])
+ '-i',
const interactive = childProcess.exec(nodeBinary + ' ' +
preloadOption([fixtureD]) +
'-i',
common.mustCall(function(err, stdout, stderr) {
assert.ifError(err);
assert.strictEqual(stdout, "> 'test'\n> ");
Expand All @@ -129,20 +129,20 @@ const interactive = childProcess.exec(nodeBinary + ' '
interactive.stdin.write('a\n');
interactive.stdin.write('process.exit()\n');

childProcess.exec(nodeBinary + ' '
+ '--require ' + fixture('cluster-preload.js') + ' '
+ fixture('cluster-preload-test.js'),
childProcess.exec(nodeBinary + ' ' +
'--require ' + fixture('cluster-preload.js') + ' ' +
fixture('cluster-preload-test.js'),
function(err, stdout, stderr) {
if (err) throw err;
assert.ok(/worker terminated with code 43/.test(stdout));
});

// https://github.com/nodejs/node/issues/1691
process.chdir(common.fixturesDir);
childProcess.exec(nodeBinary + ' '
+ '--expose_debug_as=v8debug '
+ '--require ' + fixture('cluster-preload.js') + ' '
+ 'cluster-preload-test.js',
childProcess.exec(nodeBinary + ' ' +
'--expose_debug_as=v8debug ' +
'--require ' + fixture('cluster-preload.js') + ' ' +
'cluster-preload-test.js',
function(err, stdout, stderr) {
if (err) throw err;
assert.ok(/worker terminated with code 43/.test(stdout));
Expand Down
4 changes: 2 additions & 2 deletions test/parallel/test-repl-domain.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ putIn.write = function(data) {
};

putIn.run([
'require("domain").create().on("error", function() { console.log("OK") })'
+ '.run(function() { throw new Error("threw") })'
'require("domain").create().on("error", function() { console.log("OK") })' +
'.run(function() { throw new Error("threw") })'
]);
4 changes: 2 additions & 2 deletions test/parallel/test-tls-client-mindhsize.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ function test(size, err, next) {
if (err) {
client.on('error', function(e) {
nerror++;
assert.strictEqual(e.message, 'DH parameter size 1024 is less'
+ ' than 2048');
assert.strictEqual(e.message, 'DH parameter size 1024 is less' +
' than 2048');
server.close();
});
}
Expand Down