tools: replace concatenation with string templates
Replace string concatenation in `tools/lint-js.js` with template literals. PR-URL: https://github.com/nodejs/node/pull/15858 Reviewed-By: Rich Trott <rtrott@gmail.com>
This commit is contained in:
parent
7ba896e407
commit
27b5bf14ca
@ -155,7 +155,7 @@ if (cluster.isMaster) {
|
|||||||
} else {
|
} else {
|
||||||
failures += results.length;
|
failures += results.length;
|
||||||
}
|
}
|
||||||
outFn(formatter(results) + '\r\n');
|
outFn(`${formatter(results)}\r\n`);
|
||||||
printProgress();
|
printProgress();
|
||||||
} else {
|
} else {
|
||||||
successes += results;
|
successes += results;
|
||||||
@ -211,7 +211,7 @@ if (cluster.isMaster) {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
// Clear line
|
// Clear line
|
||||||
outFn('\r' + ' '.repeat(lastLineLen) + '\r');
|
outFn(`\r ${' '.repeat(lastLineLen)}\r`);
|
||||||
|
|
||||||
// Calculate and format the data for displaying
|
// Calculate and format the data for displaying
|
||||||
const elapsed = process.hrtime(startTime)[0];
|
const elapsed = process.hrtime(startTime)[0];
|
||||||
@ -226,7 +226,7 @@ if (cluster.isMaster) {
|
|||||||
|
|
||||||
// Truncate line like cpplint does in case it gets too long
|
// Truncate line like cpplint does in case it gets too long
|
||||||
if (line.length > 75)
|
if (line.length > 75)
|
||||||
line = line.slice(0, 75) + '...';
|
line = `${line.slice(0, 75)}...`;
|
||||||
|
|
||||||
// Store the line length so we know how much to erase the next time around
|
// Store the line length so we know how much to erase the next time around
|
||||||
lastLineLen = line.length;
|
lastLineLen = line.length;
|
||||||
@ -235,7 +235,7 @@ if (cluster.isMaster) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function padString(str, len, chr) {
|
function padString(str, len, chr) {
|
||||||
str = '' + str;
|
str = `${str}`;
|
||||||
if (str.length >= len)
|
if (str.length >= len)
|
||||||
return str;
|
return str;
|
||||||
return chr.repeat(len - str.length) + str;
|
return chr.repeat(len - str.length) + str;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user