Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit a6bd287

Browse filesBrowse files
gibfahnItalo A. Casas
authored andcommitted
test: use eslint to fix var->const/let
Manually fix issues that eslint --fix couldn't do automatically. 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 e6b6ce4 commit a6bd287
Copy full SHA for a6bd287

File tree

Expand file treeCollapse file tree

732 files changed

+3393
-3374
lines changed
Open diff view settings
Filter options

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Dismiss banner
Expand file treeCollapse file tree

732 files changed

+3393
-3374
lines changed
Open diff view settings
Collapse file

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

Copy file name to clipboardExpand all lines: test/addons/buffer-free-callback/test.js
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ const common = require('../../common');
55
const binding = require(`./build/${common.buildType}/binding`);
66

77
function check(size, alignment, offset) {
8-
var buf = binding.alloc(size, alignment, offset);
9-
var slice = buf.slice(size >>> 1);
8+
let buf = binding.alloc(size, alignment, offset);
9+
let slice = buf.slice(size >>> 1);
1010

1111
buf = null;
1212
binding.check(slice);
Collapse file

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

Copy file name to clipboardExpand all lines: test/addons/load-long-path/test.js
+3-3Lines changed: 3 additions & 3 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-
var addonDestinationDir = path.resolve(common.tmpDir);
17+
let addonDestinationDir = path.resolve(common.tmpDir);
1818

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

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

3434
// Attempt to load at long path destination
Collapse file

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

Copy file name to clipboardExpand all lines: test/addons/make-callback-recurse/test.js
+1-1Lines 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 (var i = 0; i < results.length; i++) {
68+
for (let i = 0; i < results.length; i++) {
6969
assert.strictEqual(results[i], i,
7070
`verifyExecutionOrder(${arg}) results: ${results}`);
7171
}
Collapse file

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

Copy file name to clipboardExpand all lines: test/addons/repl-domain-abort/test.js
+7-7Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,27 +4,27 @@ const assert = require('assert');
44
const repl = require('repl');
55
const stream = require('stream');
66
const path = require('path');
7-
var buildType = process.config.target_defaults.default_configuration;
8-
var buildPath = path.join(__dirname, 'build', buildType, 'binding');
7+
const buildType = process.config.target_defaults.default_configuration;
8+
let buildPath = 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-
var cb_ran = false;
12+
let cb_ran = false;
1313

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

19-
var lines = [
19+
const lines = [
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-
var dInput = new stream.Readable();
27-
var dOutput = new stream.Writable();
26+
const dInput = new stream.Readable();
27+
const dOutput = new stream.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-
var options = {
41+
const options = {
4242
input: dInput,
4343
output: dOutput,
4444
terminal: false,
Collapse file

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

Copy file name to clipboardExpand all lines: test/addons/stringbytes-external-exceed-max/test-stringbytes-external-at-max.js
+2-1Lines 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+
let buf;
1718
try {
18-
var buf = 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);
Collapse file

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

Copy file name to clipboardExpand all lines: test/addons/stringbytes-external-exceed-max/test-stringbytes-external-exceed-max-by-1-ascii.js
+2-1Lines 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
const kStringMaxLength = process.binding('buffer').kStringMaxLength;
1616

17+
let buf;
1718
try {
18-
var buf = 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);
Collapse file

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

Copy file name to clipboardExpand all lines: test/addons/stringbytes-external-exceed-max/test-stringbytes-external-exceed-max-by-1-base64.js
+2-1Lines 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
const kStringMaxLength = process.binding('buffer').kStringMaxLength;
1616

17+
let buf;
1718
try {
18-
var buf = 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);
Collapse file

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

Copy file name to clipboardExpand all lines: test/addons/stringbytes-external-exceed-max/test-stringbytes-external-exceed-max-by-1-binary.js
+3-2Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,9 @@ if (!common.enoughTestMem) {
1414
// v8::String::kMaxLength defined in v8.h
1515
const kStringMaxLength = process.binding('buffer').kStringMaxLength;
1616

17+
let buf;
1718
try {
18-
var buf = 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);
@@ -33,7 +34,7 @@ assert.throws(function() {
3334
buf.toString('latin1');
3435
}, /"toString\(\)" failed/);
3536

36-
var maxString = buf.toString('latin1', 1);
37+
let maxString = buf.toString('latin1', 1);
3738
assert.strictEqual(maxString.length, kStringMaxLength);
3839
// Free the memory early instead of at the end of the next assignment
3940
maxString = undefined;
Collapse file

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

Copy file name to clipboardExpand all lines: test/addons/stringbytes-external-exceed-max/test-stringbytes-external-exceed-max-by-1-hex.js
+2-1Lines 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
const kStringMaxLength = process.binding('buffer').kStringMaxLength;
1616

17+
let buf;
1718
try {
18-
var buf = 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);
Collapse file

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

Copy file name to clipboardExpand all lines: test/addons/stringbytes-external-exceed-max/test-stringbytes-external-exceed-max-by-1-utf8.js
+2-1Lines 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
const kStringMaxLength = process.binding('buffer').kStringMaxLength;
1616

17+
let buf;
1718
try {
18-
var buf = 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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.