Skip to content

Commit 5cd6e7d

Browse files
committed
fixed a few linting issues
1 parent eba4727 commit 5cd6e7d

9 files changed

+21
-17
lines changed

lib/Chunk.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ Chunk.prototype.integrate = function(other, reason) {
169169
};
170170

171171
Chunk.prototype.isEmpty = function() {
172-
return(this.modules.length === 0);
172+
return this.modules.length === 0;
173173
};
174174

175175
Chunk.prototype.updateHash = function(hash) {

lib/ChunkTemplate.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ ChunkTemplate.prototype.render = function(chunk, moduleTemplate, dependencyTempl
1717
var core = this.applyPluginsWaterfall("modules", modules, chunk, moduleTemplate, dependencyTemplates);
1818
var source = this.applyPluginsWaterfall("render", core, chunk, moduleTemplate, dependencyTemplates);
1919
if(chunk.modules.some(function(module) {
20-
return(module.id === 0);
20+
return module.id === 0;
2121
})) {
2222
source = this.applyPluginsWaterfall("render-with-entry", source, chunk);
2323
}

lib/HotModuleReplacement.runtime.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,8 @@ module.exports = function() {
143143
var hotUpdate, hotUpdateNewHash;
144144

145145
function toModuleId(id) {
146-
return(+id) + "" === id ? +id : id;
146+
var isNumber = (+id) + "" === id;
147+
return isNumber ? +id : id;
147148
}
148149

149150
function hotCheck(apply, callback) {

lib/MainTemplate.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ MainTemplate.prototype.render = function(hash, chunk, moduleTemplate, dependency
112112
buf.push(this.asString(this.applyPluginsWaterfall("startup", "", chunk, hash)));
113113
var source = this.applyPluginsWaterfall("render", new OriginalSource(this.prefix(buf, " \t") + "\n", "webpack/bootstrap " + hash), chunk, hash, moduleTemplate, dependencyTemplates);
114114
if(chunk.modules.some(function(module) {
115-
return(module.id === 0);
115+
return module.id === 0;
116116
})) {
117117
source = this.applyPluginsWaterfall("render-with-entry", source, chunk, hash);
118118
}
@@ -135,15 +135,16 @@ MainTemplate.prototype.renderCurrentHashCode = function(hash, length) {
135135
};
136136

137137
MainTemplate.prototype.entryPointInChildren = function(chunk) {
138-
return(function checkChildren(chunk, alreadyCheckedChunks) {
138+
function checkChildren(chunk, alreadyCheckedChunks) {
139139
return chunk.chunks.some(function(child) {
140140
if(alreadyCheckedChunks.indexOf(child) >= 0) return;
141141
alreadyCheckedChunks.push(child);
142142
return child.modules.some(function(module) {
143-
return(module.id === 0);
143+
return module.id === 0;
144144
}) || checkChildren(child, alreadyCheckedChunks);
145145
});
146-
}(chunk, []));
146+
}
147+
return checkChildren(chunk, []);
147148
};
148149

149150
MainTemplate.prototype.getPublicPath = function(options) {

lib/ModuleFilenameHelpers.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ ModuleFilenameHelpers.createFilename = function createFilename(module, moduleFil
7979
hash: hash
8080
});
8181
}
82-
return(moduleFilenameTemplate
82+
return moduleFilenameTemplate
8383
.replace(ModuleFilenameHelpers.REGEXP_ALL_LOADERS_RESOURCE, identifier)
8484
.replace(ModuleFilenameHelpers.REGEXP_LOADERS_RESOURCE, shortIdentifier)
8585
.replace(ModuleFilenameHelpers.REGEXP_RESOURCE, resource)
@@ -89,8 +89,7 @@ ModuleFilenameHelpers.createFilename = function createFilename(module, moduleFil
8989
.replace(ModuleFilenameHelpers.REGEXP_LOADERS, loaders)
9090
.replace(ModuleFilenameHelpers.REGEXP_QUERY, query)
9191
.replace(ModuleFilenameHelpers.REGEXP_ID, moduleId)
92-
.replace(ModuleFilenameHelpers.REGEXP_HASH, hash)
93-
);
92+
.replace(ModuleFilenameHelpers.REGEXP_HASH, hash);
9493
};
9594

9695
ModuleFilenameHelpers.createFooter = function createFooter(module, requestShortener) {

lib/Stats.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,12 +69,12 @@ Stats.prototype.toJson = function toJson(options, forToString) {
6969
field = field.substr(1);
7070
return function(a, b) {
7171
if(a[field] === b[field]) return 0;
72-
return(a[field] < b[field]) ? 1 : -1;
72+
return a[field] < b[field] ? 1 : -1;
7373
};
7474
}
7575
return function(a, b) {
7676
if(a[field] === b[field]) return 0;
77-
return(a[field] < b[field]) ? -1 : 1;
77+
return a[field] < b[field] ? -1 : 1;
7878
};
7979
}
8080

lib/Template.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ Template.prototype.indent = function indent(str) {
2828
} else {
2929
str = str.trimRight();
3030
if(!str) return "";
31-
return(str[0] === "\n" ? "" : "\t") + str.replace(/\n([^\n])/g, "\n\t$1");
31+
var ind = (str[0] === "\n" ? "" : "\t");
32+
return ind + str.replace(/\n([^\n])/g, "\n\t$1");
3233
}
3334
};
3435

@@ -38,7 +39,8 @@ Template.prototype.prefix = function(str, prefix) {
3839
}
3940
str = str.trim();
4041
if(!str) return "";
41-
return(str[0] === "\n" ? "" : prefix) + str.replace(/\n([^\n])/g, "\n" + prefix + "$1");
42+
var ind = (str[0] === "\n" ? "" : prefix);
43+
return ind + str.replace(/\n([^\n])/g, "\n" + prefix + "$1");
4244
};
4345

4446
Template.prototype.asString = function(str) {
@@ -64,7 +66,8 @@ Template.prototype.getModulesArrayBounds = function(modules) {
6466
minId = 0;
6567
}
6668
var objectOverhead = modules.map(function(module) {
67-
return(module.id + "").length + 2;
69+
var idLength = (module.id + "").length;
70+
return idLength + 2;
6871
}).reduce(function(a, b) {
6972
return a + b;
7073
}, -1);

lib/WatchIgnorePlugin.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ function IgnoringWatchFileSystem(wfs, paths) {
1818
IgnoringWatchFileSystem.prototype.watch = function(files, dirs, missing, startTime, delay, callback, callbackUndelayed) {
1919
var ignored = function(path) {
2020
return this.paths.some(function(p) {
21-
return((p instanceof RegExp) ? p.test(path) : path.indexOf(p) === 0);
21+
return p instanceof RegExp ? p.test(path) : path.indexOf(p) === 0;
2222
});
2323
}.bind(this);
2424

lib/dependencies/RequireContextPlugin.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ RequireContextPlugin.prototype.apply = function(compiler) {
3232
callback(null, items.map(function(obj) {
3333
return extensions.filter(function(ext) {
3434
var l = obj.request.length;
35-
return(l > ext.length && obj.request.substr(l - ext.length, l) === ext);
35+
return l > ext.length && obj.request.substr(l - ext.length, l) === ext;
3636
}).map(function(ext) {
3737
var l = obj.request.length;
3838
return {

0 commit comments

Comments
 (0)