Skip to content

Commit cebd3b9

Browse files
committed
added linting
1 parent e4453c7 commit cebd3b9

95 files changed

Lines changed: 452 additions & 432 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.

‎.eslintrc‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"env": {
3+
"node": true
4+
},
5+
"rules": {
6+
"strict": 0,
7+
"curly": 0,
8+
"eol-last": 0,
9+
"no-shadow": 0,
10+
"no-redeclare": 1,
11+
"no-extra-bind": 1,
12+
"no-underscore-dangle": 0,
13+
"no-use-before-define": 0,
14+
"consistent-return": 0,
15+
"no-inner-declarations": 1,
16+
"no-loop-func": 1
17+
}
18+
}

‎lib/APIPlugin.js‎

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,38 +12,38 @@ function APIPlugin() {
1212
module.exports = APIPlugin;
1313

1414
var REPLACEMENTS = {
15-
__webpack_public_path__: "__webpack_require__.p",
16-
__webpack_modules__: "__webpack_require__.m",
17-
__webpack_chunk_load__: "__webpack_require__.e",
18-
__non_webpack_require__: "require",
19-
"require.onError": "__webpack_require__.onError",
15+
__webpack_public_path__: "__webpack_require__.p", // eslint-disable-line camelcase
16+
__webpack_modules__: "__webpack_require__.m", // eslint-disable-line camelcase
17+
__webpack_chunk_load__: "__webpack_require__.e", // eslint-disable-line camelcase
18+
__non_webpack_require__: "require", // eslint-disable-line camelcase
19+
"require.onError": "__webpack_require__.onError" // eslint-disable-line camelcase
2020
};
2121
var REPLACEMENT_TYPES = {
22-
__webpack_public_path__: "string",
23-
__webpack_require__: "function",
24-
__webpack_modules__: "object",
25-
__webpack_chunk_load__: "function",
22+
__webpack_public_path__: "string", // eslint-disable-line camelcase
23+
__webpack_require__: "function", // eslint-disable-line camelcase
24+
__webpack_modules__: "object", // eslint-disable-line camelcase
25+
__webpack_chunk_load__: "function" // eslint-disable-line camelcase
2626
};
2727
var IGNORES = [
2828
];
2929
APIPlugin.prototype.apply = function(compiler) {
30-
compiler.plugin("compilation", function(compilation, params) {
30+
compiler.plugin("compilation", function(compilation) {
3131
compilation.dependencyFactories.set(ConstDependency, new NullFactory());
3232
compilation.dependencyTemplates.set(ConstDependency, new ConstDependency.Template());
3333
});
3434
Object.keys(REPLACEMENTS).forEach(function(key) {
35-
compiler.parser.plugin("expression "+key, function(expr) {
35+
compiler.parser.plugin("expression " + key, function(expr) {
3636
var dep = new ConstDependency(REPLACEMENTS[key], expr.range);
3737
dep.loc = expr.loc;
3838
this.state.current.addDependency(dep);
3939
return true;
4040
});
41-
compiler.parser.plugin("evaluate typeof "+key, function(expr) {
41+
compiler.parser.plugin("evaluate typeof " + key, function(expr) {
4242
return new BasicEvaluatedExpression().setString(REPLACEMENT_TYPES[key]).setRange(expr.range);
4343
});
4444
});
4545
IGNORES.forEach(function(key) {
46-
compiler.parser.plugin(key, function(expr) {
46+
compiler.parser.plugin(key, function() {
4747
return true;
4848
});
4949
});

‎lib/AbstractPlugin.js‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@
44
*/
55
function AbstractPlugin(plugins) {
66
this._plugins = plugins || {};
7-
};
7+
}
88
module.exports = AbstractPlugin;
99

1010
AbstractPlugin.create = function(plugins) {
1111
function Plugin() {
12-
AbstractPlugin.call(this, plugins)
12+
AbstractPlugin.call(this, plugins);
1313
}
1414
Plugin.prototype = Object.create(AbstractPlugin.prototype);
1515
return Plugin;

‎lib/ArrayMap.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ ArrayMap.prototype.set = function(key, value) {
2929
return this;
3030
};
3131

32-
ArrayMap.prototype.remove = function(key, value) {
32+
ArrayMap.prototype.remove = function(key) {
3333
for(var i = 0; i < this.keys.length; i++) {
3434
if(this.keys[i] === key) {
3535
this.keys.splice(i, 1);

‎lib/AutomaticPrefetchPlugin.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,5 @@ AutomaticPrefetchPlugin.prototype.apply = function(compiler) {
3232
async.forEach(lastModules, function(m, callback) {
3333
compilation.prefetch(m.context || compiler.context, new PrefetchDependency(m.request), callback);
3434
}, callback);
35-
}.bind(this));
35+
});
3636
};

‎lib/BasicEvaluatedExpression.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ BasicEvaluatedExpression.prototype.setString = function(str) {
6464
this.string = str;
6565
return this;
6666
};
67-
BasicEvaluatedExpression.prototype.setNull = function(str) {
67+
BasicEvaluatedExpression.prototype.setNull = function() {
6868
this.null = true;
6969
return this;
7070
};

‎lib/CachePlugin.js‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,23 +21,23 @@ CachePlugin.prototype.apply = function(compiler) {
2121
compiler.plugin("run", function(compiler, callback) {
2222
if(!compiler._lastCompilationFileDependencies) return callback();
2323
var fs = compiler.inputFileSystem;
24-
fileTs = compiler.fileTimestamps = {};
24+
var fileTs = compiler.fileTimestamps = {};
2525
async.forEach(compiler._lastCompilationFileDependencies, function(file, callback) {
2626
fs.stat(file, function(err, stat) {
2727
if(err) {
28-
if(err.code === 'ENOENT') return callback();
28+
if(err.code === "ENOENT") return callback();
2929
return callback(err);
3030
}
31-
31+
3232
fileTs[file] = stat.mtime || Infinity;
3333
callback();
3434
});
3535
}, callback);
36-
}.bind(this));
36+
});
3737
compiler.plugin("after-compile", function(compilation, callback) {
3838
compilation.compiler._lastCompilationFileDependencies = compilation.fileDependencies;
3939
compilation.compiler._lastCompilationContextDependencies = compilation.contextDependencies;
4040
callback();
41-
}.bind(this));
41+
});
4242
}
4343
};

‎lib/Chunk.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ Chunk.prototype.getChunkMaps = function(includeEntries) {
241241
return {
242242
hash: chunkHashMap,
243243
name: chunkNameMap
244-
}
244+
};
245245
};
246246

247247
Chunk.prototype.toString = function() {

‎lib/CompatibilityPlugin.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ function CompatibilityPlugin() {
1414
module.exports = CompatibilityPlugin;
1515

1616
CompatibilityPlugin.prototype.apply = function(compiler) {
17-
compiler.plugin("compilation", function(compilation, params) {
17+
compiler.plugin("compilation", function(compilation) {
1818
compilation.dependencyFactories.set(ConstDependency, new NullFactory());
1919
compilation.dependencyTemplates.set(ConstDependency, new ConstDependency.Template());
2020
});

‎lib/Compilation.js‎

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
var async = require("async");
66

77
var Tapable = require("tapable");
8-
var Parser = require("./Parser");
9-
var Dependency = require("./Dependency");
108
var EntryModuleNotFoundError = require("./EntryModuleNotFoundError");
119
var ModuleNotFoundError = require("./ModuleNotFoundError");
1210
var CriticalDependenciesWarning = require("./CriticalDependenciesWarning");
@@ -404,7 +402,7 @@ Compilation.prototype._addModuleChain = function process(context, dependency, on
404402
}
405403

406404
return callback(null, module);
407-
}.bind(this));
405+
});
408406
}
409407
}.bind(this));
410408
};
@@ -666,7 +664,7 @@ Compilation.prototype.sortItems = function sortItems() {
666664
this.modules.forEach(function(module) {
667665
module.chunks.sort(byId);
668666
module.reasons.sort(function(a, b) {
669-
return byId(a.module, b.module)
667+
return byId(a.module, b.module);
670668
});
671669
});
672670
this.chunks.forEach(function(chunk) {
@@ -678,7 +676,7 @@ Compilation.prototype.summarizeDependencies = function summarizeDependencies() {
678676
function filterDups(array) {
679677
var newArray = [];
680678
for(var i = 0; i < array.length; i++) {
681-
if(i === 0 || array[i-1] !== array[i])
679+
if(i === 0 || array[i - 1] !== array[i])
682680
newArray.push(array[i]);
683681
}
684682
return newArray;
@@ -707,7 +705,7 @@ Compilation.prototype.summarizeDependencies = function summarizeDependencies() {
707705
if(Array.isArray(error.missing)) {
708706
error.missing.forEach(function(item) {
709707
this.missingDependencies.push(item);
710-
}, this)
708+
}, this);
711709
}
712710
}, this);
713711
this.fileDependencies.sort();
@@ -729,7 +727,7 @@ Compilation.prototype.createHash = function createHash() {
729727
this.moduleTemplate.updateHash(hash);
730728
var i, chunk;
731729
for(i = 0; i < this.chunks.length; i++) {
732-
var chunk = this.chunks[i];
730+
chunk = this.chunks[i];
733731
var chunkHash = require("crypto").createHash(hashFunction);
734732
chunk.updateHash(chunkHash);
735733
this.chunkTemplate.updateHash(chunkHash);
@@ -769,7 +767,7 @@ Compilation.prototype.createChunkAssets = function createChunkAssets() {
769767
}, this);
770768
}
771769
}
772-
for(var i = 0; i < this.chunks.length; i++) {
770+
for(i = 0; i < this.chunks.length; i++) {
773771
var chunk = this.chunks[i];
774772
chunk.files = [];
775773
var chunkHash = chunk.hash;
@@ -791,7 +789,7 @@ Compilation.prototype.createChunkAssets = function createChunkAssets() {
791789
this.cache["c" + chunk.id] = {
792790
hash: usedHash,
793791
source: source = (source instanceof CachedSource ? source : new CachedSource(source))
794-
}
792+
};
795793
}
796794
}
797795
this.assets[

0 commit comments

Comments
 (0)