Skip to content

Commit 46a7c29

Browse files
vsemozhetbytevanlucas
authored andcommitted
tools: use no-useless-concat ESLint rule
* Add `no-useless-concat: error` to .eslintrc.yaml. * Apply no-useless-concat rule to tests. PR-URL: #12613 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Refael Ackermann <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Gibson Fahnestock <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Teddy Katz <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Brian White <[email protected]>
1 parent 45facc8 commit 46a7c29

8 files changed

+20
-23
lines changed

‎.eslintrc.yaml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ rules:
4545
no-throw-literal: 2
4646
no-unused-labels: 2
4747
no-useless-call: 2
48+
no-useless-concat: 2
4849
no-useless-escape: 2
4950
no-useless-return: 2
5051
no-void: 2

‎test/parallel/test-domain-throw-error-then-throw-from-uncaught-exception-handler.js‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,11 +92,10 @@ function createTestCmdLine(options){
9292
testCmd+=process.argv[0];
9393

9494
if(options&&options.withAbortOnUncaughtException){
95-
testCmd+=' '+'--abort-on-uncaught-exception';
95+
testCmd+=' --abort-on-uncaught-exception';
9696
}
9797

98-
testCmd+=' '+process.argv[1];
99-
testCmd+=' '+'child';
98+
testCmd+=` ${process.argv[1]} child`;
10099

101100
returntestCmd;
102101
}

‎test/parallel/test-http-server-unconsume-consume.js‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ const http = require('http');
44

55
consttestServer=http.createServer(common.mustNotCall());
66
testServer.on('connect',common.mustCall((req,socket,head)=>{
7-
socket.write('HTTP/1.1 200 Connection Established'+'\r\n'+
8-
'Proxy-agent: Node-Proxy'+'\r\n'+
7+
socket.write('HTTP/1.1 200 Connection Established\r\n'+
8+
'Proxy-agent: Node-Proxy\r\n'+
99
'\r\n');
1010
// This shouldn't raise an assertion in StreamBase::Consume.
1111
testServer.emit('connection',socket);

‎test/parallel/test-http-set-trailers.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ let outstanding_reqs = 0;
99
constserver=http.createServer(function(req,res){
1010
res.writeHead(200,[['content-type','text/plain']]);
1111
res.addTrailers({'x-foo': 'bar'});
12-
res.end('stuff'+'\n');
12+
res.end('stuff\n');
1313
});
1414
server.listen(0);
1515

‎test/parallel/test-net-write-connect-write.js‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@ const server = net.createServer(function(socket){
1212
conn.setEncoding('utf8');
1313
conn.write('before');
1414
conn.on('connect',function(){
15-
conn.write('after');
15+
conn.write('after');
1616
});
1717
conn.on('data',function(buf){
1818
received+=buf;
1919
conn.end();
2020
});
2121
conn.on('end',common.mustCall(function(){
2222
server.close();
23-
assert.strictEqual(received,'before'+'after');
23+
assert.strictEqual(received,'beforeafter');
2424
}));
2525
}));

‎test/parallel/test-preload.js‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ interactive.stdin.write('a\n');
128128
interactive.stdin.write('process.exit()\n');
129129

130130
childProcess.exec(
131-
nodeBinary+' '+'--require '+fixture('cluster-preload.js')+' '+
131+
`${nodeBinary}--require ${fixture('cluster-preload.js')} `+
132132
fixture('cluster-preload-test.js'),
133133
function(err,stdout,stderr){
134134
assert.ifError(err);
@@ -139,8 +139,8 @@ childProcess.exec(
139139
// https://github.com/nodejs/node/issues/1691
140140
process.chdir(common.fixturesDir);
141141
childProcess.exec(
142-
nodeBinary+' '+'--expose_natives_as=v8natives '+'--require '+
143-
fixture('cluster-preload.js')+' '+'cluster-preload-test.js',
142+
`${nodeBinary}--expose_natives_as=v8natives --require `+
143+
`${fixture('cluster-preload.js')}cluster-preload-test.js`,
144144
function(err,stdout,stderr){
145145
assert.ifError(err);
146146
assert.ok(/workerterminatedwithcode43/.test(stdout));

‎test/parallel/test-repl.js‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -414,12 +414,12 @@ function tcp_test(){
414414
{client: client_tcp,send: '',
415415
expect: prompt_tcp},
416416
{client: client_tcp,send: 'invoke_me(333)',
417-
expect: ('\''+'invoked 333'+'\'\n'+prompt_tcp)},
417+
expect: (`'invoked 333'\n${prompt_tcp}`)},
418418
{client: client_tcp,send: 'a += 1',
419-
expect: ('12346'+'\n'+prompt_tcp)},
419+
expect: (`12346\n${prompt_tcp}`)},
420420
{client: client_tcp,
421421
send: 'require('+JSON.stringify(moduleFilename)+').number',
422-
expect: ('42'+'\n'+prompt_tcp)}
422+
expect: (`42\n${prompt_tcp}`)}
423423
]);
424424
});
425425

@@ -483,13 +483,13 @@ function unix_test(){
483483
{client: client_unix,send: '',
484484
expect: prompt_unix},
485485
{client: client_unix,send: 'message',
486-
expect: ('\''+message+'\'\n'+prompt_unix)},
486+
expect: (`'${message}'\n${prompt_unix}`)},
487487
{client: client_unix,send: 'invoke_me(987)',
488-
expect: ('\''+'invoked 987'+'\'\n'+prompt_unix)},
488+
expect: (`'invoked 987'\n${prompt_unix}`)},
489489
{client: client_unix,send: 'a = 12345',
490-
expect: ('12345'+'\n'+prompt_unix)},
490+
expect: (`12345\n${prompt_unix}`)},
491491
{client: client_unix,send: '{a:1}',
492-
expect: ('{a: 1 }'+'\n'+prompt_unix)}
492+
expect: (`{a: 1 }\n${prompt_unix}`)}
493493
]);
494494
});
495495

‎test/sequential/test-domain-abort-on-uncaught.js‎

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -239,11 +239,8 @@ if (process.argv[2] === 'child'){
239239
testCmd+='ulimit -c 0 && ';
240240
}
241241

242-
testCmd+=process.argv[0];
243-
testCmd+=' '+'--abort-on-uncaught-exception';
244-
testCmd+=' '+process.argv[1];
245-
testCmd+=' '+'child';
246-
testCmd+=' '+testIndex;
242+
testCmd+=`${process.argv[0]} --abort-on-uncaught-exception `+
243+
`${process.argv[1]} child ${testIndex}`;
247244

248245
constchild=child_process.exec(testCmd);
249246

0 commit comments

Comments
(0)