mirror of
https://github.com/nodejs/node.git
synced 2026-11-27 17:52:27 -05:00
test: use eslint to fix var->const/let
Manually fix issues that eslint --fix couldn't do automatically. Backport-PR-URL: https://github.com/nodejs/node/pull/11775 PR-URL: https://github.com/nodejs/node/pull/10685 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Roman Reiss <me@silverwind.io>
This commit is contained in:
1 parent
de63698066
commit
db61c952de
806 files changed
+5031
-4995
No files matched your search
@@ -1,9 +1,9 @@
|
||||
'use strict';
|
||||
require('../common');
|
||||
var assert = require('assert');
|
||||
const assert = require('assert');
|
||||
|
||||
// test using assert
|
||||
var qs = require('querystring');
|
||||
const qs = require('querystring');
|
||||
|
||||
function createWithNoPrototype(properties) {
|
||||
const noProto = Object.create(null);
|
||||
@@ -15,7 +15,7 @@ function createWithNoPrototype(properties) {
|
||||
// folding block, commented to pass gjslint
|
||||
// {{{
|
||||
// [ wonkyQS, canonicalQS, obj ]
|
||||
var qsTestCases = [
|
||||
const qsTestCases = [
|
||||
['__proto__=1',
|
||||
'__proto__=1',
|
||||
createWithNoPrototype([{key: '__proto__', value: '1'}])],
|
||||
@@ -56,7 +56,7 @@ var qsTestCases = [
|
||||
];
|
||||
|
||||
// [ wonkyQS, canonicalQS, obj ]
|
||||
var qsColonTestCases = [
|
||||
const qsColonTestCases = [
|
||||
['foo:bar', 'foo:bar', {'foo': 'bar'}],
|
||||
['foo:bar;foo:quux', 'foo:bar;foo:quux', {'foo': ['bar', 'quux']}],
|
||||
['foo:1&bar:2;baz:quux',
|
||||
@@ -67,9 +67,9 @@ var qsColonTestCases = [
|
||||
];
|
||||
|
||||
// [wonkyObj, qs, canonicalObj]
|
||||
var extendedFunction = function() {};
|
||||
const extendedFunction = function() {};
|
||||
extendedFunction.prototype = {a: 'b'};
|
||||
var qsWeirdObjects = [
|
||||
const qsWeirdObjects = [
|
||||
[{regexp: /./g}, 'regexp=', {'regexp': ''}],
|
||||
[{regexp: new RegExp('.', 'g')}, 'regexp=', {'regexp': ''}],
|
||||
[{fn: function() {}}, 'fn=', {'fn': ''}],
|
||||
@@ -87,10 +87,10 @@ var qsWeirdObjects = [
|
||||
];
|
||||
// }}}
|
||||
|
||||
var vm = require('vm');
|
||||
var foreignObject = vm.runInNewContext('({"foo": ["bar", "baz"]})');
|
||||
const vm = require('vm');
|
||||
const foreignObject = vm.runInNewContext('({"foo": ["bar", "baz"]})');
|
||||
|
||||
var qsNoMungeTestCases = [
|
||||
const qsNoMungeTestCases = [
|
||||
['', {}],
|
||||
['foo=bar&foo=baz', {'foo': ['bar', 'baz']}],
|
||||
['foo=bar&foo=baz', foreignObject],
|
||||
@@ -259,7 +259,7 @@ assert.equal(
|
||||
function testUnlimitedKeys() {
|
||||
const query = {};
|
||||
|
||||
for (var i = 0; i < 2000; i++) query[i] = i;
|
||||
for (let i = 0; i < 2000; i++) query[i] = i;
|
||||
|
||||
const url = qs.stringify(query);
|
||||
|
||||
@@ -270,7 +270,7 @@ function testUnlimitedKeys() {
|
||||
testUnlimitedKeys();
|
||||
|
||||
|
||||
var b = qs.unescapeBuffer('%d3%f2Ug%1f6v%24%5e%98%cb' +
|
||||
const b = qs.unescapeBuffer('%d3%f2Ug%1f6v%24%5e%98%cb' +
|
||||
'%0d%ac%a2%2f%9d%eb%d8%a2%e6');
|
||||
// <Buffer d3 f2 55 67 1f 36 76 24 5e 98 cb 0d ac a2 2f 9d eb d8 a2 e6>
|
||||
assert.equal(0xd3, b[0]);
|
||||
@@ -320,7 +320,7 @@ check(qs.parse('a=a', null, null, { decodeURIComponent: errDecode }),
|
||||
function demoEncode(str) {
|
||||
return str[0];
|
||||
}
|
||||
var obj = { aa: 'aa', bb: 'bb', cc: 'cc' };
|
||||
const obj = { aa: 'aa', bb: 'bb', cc: 'cc' };
|
||||
assert.equal(
|
||||
qs.stringify(obj, null, null, { encodeURIComponent: demoEncode }),
|
||||
'a=a&b=b&c=c');
|
||||
@@ -332,7 +332,7 @@ qsUnescapeTestCases.forEach(function(testCase) {
|
||||
});
|
||||
|
||||
// test overriding .unescape
|
||||
var prevUnescape = qs.unescape;
|
||||
const prevUnescape = qs.unescape;
|
||||
qs.unescape = function(str) {
|
||||
return str.replace(/o/g, '_');
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user