Skip to content

Commit ee84d78

Browse files
committed
vars to lets and const
1 parent 9ee5532 commit ee84d78

8 files changed

Lines changed: 17 additions & 14 deletions

lib/Compilation.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1425,7 +1425,7 @@ class Compilation extends Tapable {
14251425
}
14261426

14271427
createChildCompiler(name, outputOptions, plugins) {
1428-
var idx = (this.childrenCounters[name] || 0);
1428+
const idx = (this.childrenCounters[name] || 0);
14291429
this.childrenCounters[name] = idx + 1;
14301430
return this.compiler.createChildCompiler(this, name, idx, outputOptions, plugins);
14311431
}

lib/DllModuleFactory.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
*/
55
"use strict";
66

7-
var Tapable = require("tapable");
8-
var DllModule = require("./DllModule");
7+
const Tapable = require("tapable");
8+
const DllModule = require("./DllModule");
99

1010
class DllModuleFactory extends Tapable {
1111
constructor() {

lib/ExternalsPlugin.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*/
55
"use strict";
66

7-
var ExternalModuleFactoryPlugin = require("./ExternalModuleFactoryPlugin");
7+
const ExternalModuleFactoryPlugin = require("./ExternalModuleFactoryPlugin");
88

99
class ExternalsPlugin {
1010
constructor(type, externals) {

lib/FlagDependencyUsagePlugin.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class FlagDependencyUsagePlugin {
3030
else if(usedExports === true)
3131
module.usedExports = true;
3232
else if(Array.isArray(usedExports)) {
33-
var old = module.usedExports ? module.usedExports.length : -1;
33+
const old = module.usedExports ? module.usedExports.length : -1;
3434
module.usedExports = addToSet(module.usedExports || [], usedExports);
3535
if(module.usedExports.length === old)
3636
return;

lib/OptionsDefaulter.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
function getProperty(obj, name) {
88
name = name.split(".");
9-
for(var i = 0; i < name.length - 1; i++) {
9+
for(let i = 0; i < name.length - 1; i++) {
1010
obj = obj[name[i]];
1111
if(typeof obj !== "object" || !obj) return;
1212
}
@@ -15,7 +15,7 @@ function getProperty(obj, name) {
1515

1616
function setProperty(obj, name, value) {
1717
name = name.split(".");
18-
for(var i = 0; i < name.length - 1; i++) {
18+
for(let i = 0; i < name.length - 1; i++) {
1919
if(typeof obj[name[i]] !== "object" && typeof obj[name[i]] !== "undefined") return;
2020
if(!obj[name[i]]) obj[name[i]] = {};
2121
obj = obj[name[i]];

lib/dependencies/HarmonyDetectionParserPlugin.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const HarmonyCompatibilityDependency = require("./HarmonyCompatibilityDependency
99
module.exports = class HarmonyDetectionParserPlugin {
1010
apply(parser) {
1111
parser.plugin("program", (ast) => {
12-
var isHarmony = ast.body.some(statement => {
12+
const isHarmony = ast.body.some(statement => {
1313
return /^(Import|Export).*Declaration$/.test(statement.type);
1414
});
1515
if(isHarmony) {
@@ -32,7 +32,7 @@ module.exports = class HarmonyDetectionParserPlugin {
3232
module.exportsArgument = "__webpack_exports__";
3333
}
3434
});
35-
var nonHarmonyIdentifiers = ["define", "exports"];
35+
const nonHarmonyIdentifiers = ["define", "exports"];
3636
nonHarmonyIdentifiers.forEach(identifer => {
3737
parser.plugin(`evaluate typeof ${identifer}`, nullInHarmony);
3838
parser.plugin(`typeof ${identifer}`, skipInHarmony);
@@ -53,4 +53,7 @@ module.exports = class HarmonyDetectionParserPlugin {
5353
return null;
5454
}
5555
}
56+
57+
58+
5659
};

lib/dependencies/HarmonyImportDependency.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
Author Tobias Koppers @sokra
44
*/
55
"use strict";
6-
var ModuleDependency = require("./ModuleDependency");
6+
const ModuleDependency = require("./ModuleDependency");
77

88
class HarmonyImportDependency extends ModuleDependency {
99
constructor(request, importedVar, range) {

lib/dependencies/LocalModulesHelpers.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ const lookup = (parent, mod) => {
1414
segs = mod.split("/");
1515
path.pop();
1616

17-
for(var i = 0; i < segs.length; i++) {
18-
var seg = segs[i];
17+
for(let i = 0; i < segs.length; i++) {
18+
const seg = segs[i];
1919
if(seg === "..") path.pop();
2020
else if(seg !== ".") path.push(seg);
2121
}
@@ -25,7 +25,7 @@ const lookup = (parent, mod) => {
2525

2626
LocalModulesHelpers.addLocalModule = (state, name) => {
2727
if(!state.localModules) state.localModules = [];
28-
var m = new LocalModule(state.module, name, state.localModules.length);
28+
const m = new LocalModule(state.module, name, state.localModules.length);
2929
state.localModules.push(m);
3030
return m;
3131
};
@@ -36,7 +36,7 @@ LocalModulesHelpers.getLocalModule = (state, name, namedModule) => {
3636
// resolve dependency name relative to the defining named module
3737
name = lookup(namedModule, name);
3838
}
39-
for(var i = 0; i < state.localModules.length; i++) {
39+
for(let i = 0; i < state.localModules.length; i++) {
4040
if(state.localModules[i].name === name)
4141
return state.localModules[i];
4242
}

0 commit comments

Comments
 (0)