refactor(eslint): Added no-unsed-vars, env specific .eslintrc's for buildin & hot (#3636)
* refactor(eslint): Added no-unsed-vars, env specific .eslintrc's for buildin & hot * This change allows for buildin to now be part of the lint test by addition of an extra .eslintrc file which extends existing but sets es6 to false * Turned on no-unused-vars for eslint, and then removed all warnings from turning that feature on * Was getting notified of errors in "quote" property in eslintrc, so changed to correct value from error to 2. * beautify * swap invalid eslint config val
This commit is contained in:
parent
644afe6319
commit
aa8d01bf8d
|
@ -21,7 +21,7 @@
|
|||
"space-in-parens": "error",
|
||||
"no-trailing-spaces": "error",
|
||||
"no-use-before-define": "off",
|
||||
"no-unused-vars": "off",
|
||||
"no-unused-vars": ["error", {"args": "none"}],
|
||||
"key-spacing": "error",
|
||||
"space-infix-ops": "error",
|
||||
"no-unsafe-negation": "error",
|
||||
|
|
|
@ -2,7 +2,6 @@ var path = require("path");
|
|||
var fs = require("fs");
|
||||
fs.existsSync = fs.existsSync || path.existsSync;
|
||||
var interpret = require("interpret");
|
||||
var WebpackOptionsDefaulter = require("../lib/WebpackOptionsDefaulter");
|
||||
|
||||
module.exports = function(yargs, argv, convertOptions) {
|
||||
|
||||
|
@ -226,12 +225,6 @@ module.exports = function(yargs, argv, convertOptions) {
|
|||
});
|
||||
}
|
||||
|
||||
function mapArgToPath(name, optionName) {
|
||||
ifArg(name, function(str) {
|
||||
options[optionName || name] = path.resolve(str);
|
||||
});
|
||||
}
|
||||
|
||||
function loadPlugin(name) {
|
||||
var loadUtils = require("loader-utils");
|
||||
var args = null;
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"env": {
|
||||
"node": true,
|
||||
"es6": false,
|
||||
"browser": true
|
||||
}
|
||||
}
|
|
@ -1 +1,3 @@
|
|||
module.exports = function() { throw new Error("define cannot be used indirect"); };
|
||||
module.exports = function() {
|
||||
throw new Error("define cannot be used indirect");
|
||||
};
|
||||
|
|
|
@ -1 +1,2 @@
|
|||
/* globals __webpack_amd_options__ */
|
||||
module.exports = __webpack_amd_options__;
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
var g;
|
||||
|
||||
// This works in non-strict mode
|
||||
g = (function() { return this; })();
|
||||
g = (function() {
|
||||
return this;
|
||||
})();
|
||||
|
||||
try {
|
||||
// This works if eval is allowed (see CSP)
|
||||
|
|
|
@ -7,12 +7,16 @@ module.exports = function(module) {
|
|||
Object.defineProperty(module, "loaded", {
|
||||
enumerable: true,
|
||||
configurable: false,
|
||||
get: function() { return module.l; }
|
||||
get: function() {
|
||||
return module.l;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(module, "id", {
|
||||
enumerable: true,
|
||||
configurable: false,
|
||||
get: function() { return module.i; }
|
||||
get: function() {
|
||||
return module.i;
|
||||
}
|
||||
});
|
||||
module.webpackPolyfill = 1;
|
||||
}
|
||||
|
|
|
@ -1 +1,4 @@
|
|||
module.exports = function() { return __webpack_require__; };
|
||||
/* globals __webpack_require__ */
|
||||
module.exports = function() {
|
||||
return __webpack_require__;
|
||||
};
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"env": {
|
||||
"node": true,
|
||||
"es6": false,
|
||||
"browser": true
|
||||
}
|
||||
}
|
|
@ -2,7 +2,7 @@
|
|||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
/*globals window __webpack_hash__ */
|
||||
/*globals __webpack_hash__ */
|
||||
if(module.hot) {
|
||||
var lastHash;
|
||||
var upToDate = function upToDate() {
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
var path = require("path");
|
||||
var ConstDependency = require("./dependencies/ConstDependency");
|
||||
|
||||
var NullFactory = require("./NullFactory");
|
||||
|
|
|
@ -740,8 +740,6 @@ Compilation.prototype.assignIndex = function assignIndex(module) {
|
|||
};
|
||||
|
||||
Compilation.prototype.assignDepth = function assignDepth(module) {
|
||||
var _this = this;
|
||||
|
||||
function assignDepthToModule(module, depth) {
|
||||
// enter module
|
||||
if(typeof module.depth === "number" && module.depth <= depth) return;
|
||||
|
@ -760,8 +758,6 @@ Compilation.prototype.assignDepth = function assignDepth(module) {
|
|||
}
|
||||
|
||||
function assignDepthToDependencyBlock(block, depth) {
|
||||
var allDependencies = [];
|
||||
|
||||
function iteratorDependency(d) {
|
||||
assignDepthToDependency(d, depth);
|
||||
}
|
||||
|
|
|
@ -6,7 +6,6 @@ var path = require("path");
|
|||
var Tapable = require("tapable");
|
||||
|
||||
var Compilation = require("./Compilation");
|
||||
var Resolver = require("enhanced-resolve/lib/Resolver");
|
||||
|
||||
var NormalModuleFactory = require("./NormalModuleFactory");
|
||||
var ContextModuleFactory = require("./ContextModuleFactory");
|
||||
|
|
|
@ -2,9 +2,6 @@
|
|||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
var path = require("path");
|
||||
var async = require("async");
|
||||
|
||||
function FlagInitialModulesAsUsedPlugin() {}
|
||||
module.exports = FlagInitialModulesAsUsedPlugin;
|
||||
FlagInitialModulesAsUsedPlugin.prototype.apply = function(compiler) {
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
var ConcatSource = require("webpack-sources").ConcatSource;
|
||||
var PrefixSource = require("webpack-sources").PrefixSource;
|
||||
|
||||
function FunctionModuleTemplatePlugin() {}
|
||||
module.exports = FunctionModuleTemplatePlugin;
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
var ConcatSource = require("webpack-sources").ConcatSource;
|
||||
var Template = require("./Template");
|
||||
|
||||
function JsonpChunkTemplatePlugin() {}
|
||||
module.exports = JsonpChunkTemplatePlugin;
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
var ConcatSource = require("webpack-sources").ConcatSource;
|
||||
var Template = require("./Template");
|
||||
|
||||
function JsonpHotUpdateChunkTemplatePlugin() {}
|
||||
module.exports = JsonpHotUpdateChunkTemplatePlugin;
|
||||
|
|
|
@ -27,7 +27,6 @@ JsonpMainTemplatePlugin.prototype.apply = function(mainTemplate) {
|
|||
return source;
|
||||
});
|
||||
mainTemplate.plugin("jsonp-script", function(_, chunk, hash) {
|
||||
var filename = this.outputOptions.filename;
|
||||
var chunkFilename = this.outputOptions.chunkFilename;
|
||||
var chunkMaps = chunk.getChunkMaps();
|
||||
var crossOriginLoading = this.outputOptions.crossOriginLoading;
|
||||
|
@ -81,7 +80,6 @@ JsonpMainTemplatePlugin.prototype.apply = function(mainTemplate) {
|
|||
]);
|
||||
});
|
||||
mainTemplate.plugin("require-ensure", function(_, chunk, hash) {
|
||||
var chunkFilename = this.outputOptions.chunkFilename;
|
||||
return this.asString([
|
||||
"if(installedChunks[chunkId] === 0)",
|
||||
this.indent([
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
*/
|
||||
var path = require("path");
|
||||
var async = require("async");
|
||||
var HarmonyModulesHelpers = require("./dependencies/HarmonyModulesHelpers");
|
||||
|
||||
function LibManifestPlugin(options) {
|
||||
this.options = options;
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
var DependenciesBlock = require("./DependenciesBlock");
|
||||
var ModuleReason = require("./ModuleReason");
|
||||
var Template = require("./Template");
|
||||
var HarmonyModulesHelpers = require("./dependencies/HarmonyModulesHelpers");
|
||||
|
||||
var debugId = 1000;
|
||||
|
||||
|
|
|
@ -27,15 +27,6 @@ function setProperty(obj, name, value) {
|
|||
obj[name.pop()] = value;
|
||||
}
|
||||
|
||||
function hasProperty(obj, name, value) {
|
||||
name = name.split(".");
|
||||
for(var i = 0; i < name.length - 1; i++) {
|
||||
obj = obj[name[i]];
|
||||
if(typeof obj != "object" || !obj) return false;
|
||||
}
|
||||
return Object.prototype.hasOwnProperty.call(obj, name.pop());
|
||||
}
|
||||
|
||||
OptionsDefaulter.prototype.process = function(options) {
|
||||
var addItemTo = function addItemTo(list) {
|
||||
return function(item) {
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
"use strict"
|
||||
|
||||
const ConstDependency = require("./dependencies/ConstDependency");
|
||||
const NullFactory = require("./NullFactory");
|
||||
|
||||
class UseStrictPlugin {
|
||||
apply(compiler) {
|
||||
|
|
|
@ -123,15 +123,6 @@ function getSchemaPart(path, parents, additionalPath) {
|
|||
return schemaPart;
|
||||
}
|
||||
|
||||
function getSchemaPartText2(path, parents, additionalPath) {
|
||||
var schemaPart = getSchemaPart(path, parents, additionalPath);
|
||||
while(schemaPart.$ref) schemaPart = getSchemaPart(schemaPart.$ref);
|
||||
var schemaText = WebpackOptionsValidationError.formatSchema(schemaPart);
|
||||
if(schemaPart.description)
|
||||
schemaText += "\n" + schemaPart.description;
|
||||
return schemaText;
|
||||
}
|
||||
|
||||
function getSchemaPartText(schemaPart, additionalPath) {
|
||||
if(additionalPath) {
|
||||
for(var i = 0; i < additionalPath.length; i++) {
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
var NullDependency = require("./NullDependency");
|
||||
var HarmonyModulesHelpers = require("./HarmonyModulesHelpers");
|
||||
|
||||
function HarmonyImportSpecifierDependency(importDependency, importedVar, id, name, range) {
|
||||
NullDependency.call(this);
|
||||
|
|
|
@ -4,11 +4,6 @@
|
|||
*/
|
||||
var ImportDependency = require("./ImportDependency");
|
||||
var ImportContextDependency = require("./ImportContextDependency");
|
||||
|
||||
var UnsupportedFeatureWarning = require("../UnsupportedFeatureWarning");
|
||||
var ConstDependency = require("./ConstDependency");
|
||||
var BasicEvaluatedExpression = require("../BasicEvaluatedExpression");
|
||||
|
||||
var ImportParserPlugin = require("./ImportParserPlugin");
|
||||
|
||||
function ImportPlugin(options) {
|
||||
|
|
|
@ -12,11 +12,7 @@ function SystemPlugin(options) {
|
|||
module.exports = SystemPlugin;
|
||||
|
||||
SystemPlugin.prototype.apply = function(compiler) {
|
||||
var options = this.options;
|
||||
compiler.plugin("compilation", function(compilation, params) {
|
||||
var normalModuleFactory = params.normalModuleFactory;
|
||||
var contextModuleFactory = params.contextModuleFactory;
|
||||
|
||||
params.normalModuleFactory.plugin("parser", function(parser, parserOptions) {
|
||||
|
||||
if(typeof parserOptions.system !== "undefined" && !parserOptions.system)
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
var NullDependency = require("./NullDependency");
|
||||
var DepBlockHelpers = require("./DepBlockHelpers");
|
||||
|
||||
function UnsupportedDependency(request, range) {
|
||||
NullDependency.call(this);
|
||||
|
|
|
@ -18,7 +18,7 @@ module.exports = function() {
|
|||
return Promise.resolve(update);
|
||||
}
|
||||
|
||||
function hotDisposeChunk(chunkId) {
|
||||
function hotDisposeChunk(chunkId) { //eslint-disable-line no-unused-vars
|
||||
delete installedChunks[chunkId];
|
||||
}
|
||||
};
|
||||
|
|
|
@ -34,7 +34,7 @@ module.exports = function() {
|
|||
});
|
||||
}
|
||||
|
||||
function hotDisposeChunk(chunkId) {
|
||||
function hotDisposeChunk(chunkId) { //eslint-disable-line no-unused-vars
|
||||
delete installedChunks[chunkId];
|
||||
}
|
||||
};
|
||||
|
|
|
@ -46,7 +46,6 @@ NodeMainTemplatePlugin.prototype.apply = function(mainTemplate) {
|
|||
return source;
|
||||
});
|
||||
mainTemplate.plugin("require-ensure", function(_, chunk, hash) {
|
||||
var filename = this.outputOptions.filename;
|
||||
var chunkFilename = this.outputOptions.chunkFilename;
|
||||
var chunkMaps = chunk.getChunkMaps();
|
||||
var insertMoreModules = [
|
||||
|
|
|
@ -76,7 +76,6 @@ NodeSourcePlugin.prototype.apply = function(compiler) {
|
|||
});
|
||||
});
|
||||
compiler.plugin("after-resolvers", function(compiler) {
|
||||
var alias = {};
|
||||
Object.keys(nodeLibsBrowser).forEach(function(lib) {
|
||||
if(options[lib] !== false) {
|
||||
compiler.resolvers.normal.apply(
|
||||
|
|
|
@ -157,7 +157,6 @@ AggressiveSplittingPlugin.prototype.apply = function(compiler) {
|
|||
compilation.plugin("record-hash", function(records) {
|
||||
// 3. save to made splittings to records
|
||||
var minSize = _this.options.minSize;
|
||||
var maxSize = _this.options.maxSize;
|
||||
if(!records.aggressiveSplits) records.aggressiveSplits = [];
|
||||
compilation.chunks.forEach(function(chunk) {
|
||||
if(chunk.hasEntryModule()) return;
|
||||
|
|
|
@ -2,8 +2,6 @@
|
|||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Sean Larkin @thelarkinn
|
||||
*/
|
||||
var path = require("path");
|
||||
|
||||
var EntrypointsOverSizeLimitWarning = require("./EntrypointsOverSizeLimitWarning");
|
||||
var AssetsOverSizeLimitWarning = require("./AssetsOverSizeLimitWarning");
|
||||
var NoAsyncChunksWarning = require("./NoAsyncChunksWarning");
|
||||
|
|
|
@ -8,6 +8,5 @@ function WebEnvironmentPlugin(inputFileSystem, outputFileSystem) {
|
|||
}
|
||||
module.exports = WebEnvironmentPlugin;
|
||||
WebEnvironmentPlugin.prototype.apply = function(compiler) {
|
||||
var inputFileSystem = compiler.inputFileSystem = this.inputFileSystem;
|
||||
compiler.outputFileSystem = this.outputFileSystem;
|
||||
};
|
||||
|
|
|
@ -51,7 +51,7 @@ module.exports = function() {
|
|||
});
|
||||
}
|
||||
|
||||
function hotDisposeChunk(chunkId) {
|
||||
function hotDisposeChunk(chunkId) { //eslint-disable-line no-unused-vars
|
||||
delete installedChunks[chunkId];
|
||||
}
|
||||
};
|
||||
|
|
|
@ -28,7 +28,6 @@ WebWorkerMainTemplatePlugin.prototype.apply = function(mainTemplate) {
|
|||
return source;
|
||||
});
|
||||
mainTemplate.plugin("require-ensure", function(_, chunk, hash) {
|
||||
var filename = this.outputOptions.filename;
|
||||
var chunkFilename = this.outputOptions.chunkFilename;
|
||||
return this.asString([
|
||||
"// \"1\" is the signal for \"already loaded\"",
|
||||
|
|
|
@ -89,7 +89,7 @@
|
|||
"build:examples": "cd examples && node buildAll.js",
|
||||
"pretest": "npm run lint-files",
|
||||
"lint-files": "npm run lint && npm run beautify-lint",
|
||||
"lint": "eslint lib bin hot",
|
||||
"lint": "eslint lib bin hot buildin",
|
||||
"beautify-lint": "beautify-lint 'lib/**/*.js' 'hot/**/*.js' 'bin/**/*.js' 'benchmark/*.js' 'test/*.js'",
|
||||
"nsp": "nsp check --output summary",
|
||||
"cover": "node --harmony ./node_modules/.bin/istanbul cover -x '**/*.runtime.js' node_modules/mocha/bin/_mocha",
|
||||
|
|
Loading…
Reference in New Issue