Skip to content

Commit db61c95

Browse files
gibfahnMylesBorins
authored andcommitted
test: use eslint to fix var->const/let
Manually fix issues that eslint --fix couldn't do automatically. Backport-PR-URL: #11775 PR-URL: #10685 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Roman Reiss <me@silverwind.io>
1 parent de63698 commit db61c95

806 files changed

Lines changed: 5037 additions & 5001 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎test/addons/async-hello-world/test.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
'use strict';
22
constcommon=require('../../common');
3-
varassert=require('assert');
3+
constassert=require('assert');
44
constbinding=require(`./build/${common.buildType}/binding`);
55

66
binding(5,common.mustCall(function(err,val){

‎test/addons/buffer-free-callback/test.js‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ const common = require('../../common');
55
constbinding=require(`./build/${common.buildType}/binding`);
66

77
functioncheck(size,alignment,offset){
8-
varbuf=binding.alloc(size,alignment,offset);
9-
varslice=buf.slice(size>>>1);
8+
letbuf=binding.alloc(size,alignment,offset);
9+
letslice=buf.slice(size>>>1);
1010

1111
buf=null;
1212
binding.check(slice);
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
'use strict';
22
constcommon=require('../../common');
3-
varassert=require('assert');
3+
constassert=require('assert');
44
constbinding=require(`./build/${common.buildType}/binding`);
55
assert.strictEqual(binding(),'world');
66
console.log('binding.hello() =',binding());

‎test/addons/hello-world/test.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
'use strict';
22
constcommon=require('../../common');
3-
varassert=require('assert');
3+
constassert=require('assert');
44
constbinding=require(`./build/${common.buildType}/binding`);
55
assert.strictEqual(binding.hello(),'world');
66
console.log('binding.hello() =',binding.hello());

‎test/addons/load-long-path/test.js‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ common.refreshTmpDir();
1414
// make a path that is more than 260 chars long.
1515
// Any given folder cannot have a name longer than 260 characters,
1616
// so create 10 nested folders each with 30 character long names.
17-
varaddonDestinationDir=path.resolve(common.tmpDir);
17+
letaddonDestinationDir=path.resolve(common.tmpDir);
1818

19-
for(vari=0;i<10;i++){
19+
for(leti=0;i<10;i++){
2020
addonDestinationDir=path.join(addonDestinationDir,'x'.repeat(30));
2121
fs.mkdirSync(addonDestinationDir);
2222
}
@@ -28,10 +28,10 @@ const addonPath = path.join(__dirname,
2828
constaddonDestinationPath=path.join(addonDestinationDir,'binding.node');
2929

3030
// Copy binary to long path destination
31-
varcontents=fs.readFileSync(addonPath);
31+
constcontents=fs.readFileSync(addonPath);
3232
fs.writeFileSync(addonDestinationPath,contents);
3333

3434
// Attempt to load at long path destination
35-
varaddon=require(addonDestinationPath);
35+
constaddon=require(addonDestinationPath);
3636
assert.notEqual(addon,null);
3737
assert.strictEqual(addon.hello(),'world');

‎test/addons/make-callback-recurse/test.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ assert.throws(function() {
6565
results.push(2);
6666

6767
setImmediate(common.mustCall(function(){
68-
for(vari=0;i<results.length;i++){
68+
for(leti=0;i<results.length;i++){
6969
assert.strictEqual(results[i],i,
7070
`verifyExecutionOrder(${arg}) results: ${results}`);
7171
}

‎test/addons/repl-domain-abort/test.js‎

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,30 @@
11
'use strict';
2-
varcommon=require('../../common');
3-
varassert=require('assert');
4-
varrepl=require('repl');
5-
varstream=require('stream');
6-
varpath=require('path');
7-
varbuildType=process.config.target_defaults.default_configuration;
8-
varbuildPath=path.join(__dirname,'build',buildType,'binding');
2+
constcommon=require('../../common');
3+
constassert=require('assert');
4+
constrepl=require('repl');
5+
conststream=require('stream');
6+
constpath=require('path');
7+
constbuildType=process.config.target_defaults.default_configuration;
8+
letbuildPath=path.join(__dirname,'build',buildType,'binding');
99
// On Windows, escape backslashes in the path before passing it to REPL.
1010
if(common.isWindows)
1111
buildPath=buildPath.replace(/\\/g,'/');
12-
varcb_ran=false;
12+
letcb_ran=false;
1313

1414
process.on('exit',function(){
1515
assert(cb_ran);
1616
console.log('ok');
1717
});
1818

19-
varlines=[
19+
constlines=[
2020
// This line shouldn't cause an assertion error.
2121
'require(\''+buildPath+'\')'+
2222
// Log output to double check callback ran.
2323
'.method(function() { console.log(\'cb_ran\'); });',
2424
];
2525

26-
vardInput=newstream.Readable();
27-
vardOutput=newstream.Writable();
26+
constdInput=newstream.Readable();
27+
constdOutput=newstream.Writable();
2828

2929
dInput._read=function_read(size){
3030
while(lines.length>0&&this.push(lines.shift()));
@@ -38,7 +38,7 @@ dOutput._write = function _write(chunk, encoding, cb) {
3838
cb();
3939
};
4040

41-
varoptions={
41+
constoptions={
4242
input: dInput,
4343
output: dOutput,
4444
terminal: false,

‎test/addons/stringbytes-external-exceed-max/test-stringbytes-external-at-max.js‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,9 @@ if (!common.enoughTestMem) {
1414
return;
1515
}
1616

17+
letbuf;
1718
try{
18-
varbuf=Buffer.allocUnsafe(kStringMaxLength);
19+
buf=Buffer.allocUnsafe(kStringMaxLength);
1920
}catch(e){
2021
// If the exception is not due to memory confinement then rethrow it.
2122
if(e.message!=='Array buffer allocation failed')throw(e);

‎test/addons/stringbytes-external-exceed-max/test-stringbytes-external-exceed-max-by-1-ascii.js‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,9 @@ if (!common.enoughTestMem) {
1414
// v8::String::kMaxLength defined in v8.h
1515
constkStringMaxLength=process.binding('buffer').kStringMaxLength;
1616

17+
letbuf;
1718
try{
18-
varbuf=Buffer.allocUnsafe(kStringMaxLength+1);
19+
buf=Buffer.allocUnsafe(kStringMaxLength+1);
1920
}catch(e){
2021
// If the exception is not due to memory confinement then rethrow it.
2122
if(e.message!=='Array buffer allocation failed')throw(e);

‎test/addons/stringbytes-external-exceed-max/test-stringbytes-external-exceed-max-by-1-base64.js‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,9 @@ if (!common.enoughTestMem) {
1414
// v8::String::kMaxLength defined in v8.h
1515
constkStringMaxLength=process.binding('buffer').kStringMaxLength;
1616

17+
letbuf;
1718
try{
18-
varbuf=Buffer.allocUnsafe(kStringMaxLength+1);
19+
buf=Buffer.allocUnsafe(kStringMaxLength+1);
1920
}catch(e){
2021
// If the exception is not due to memory confinement then rethrow it.
2122
if(e.message!=='Array buffer allocation failed')throw(e);

0 commit comments

Comments
 (0)