arrow functions, remove or improve eslint-disable comments
This commit is contained in:
parent
408c4ca9ef
commit
ad8f496745
|
@ -159,8 +159,13 @@ if (installedClis.length === 0) {
|
|||
} else if (installedClis.length === 1) {
|
||||
const path = require("path");
|
||||
const pkgPath = require.resolve(`${installedClis[0].package}/package.json`);
|
||||
const pkg = require(pkgPath); // eslint-disable-line
|
||||
require(path.resolve(path.dirname(pkgPath), pkg.bin[installedClis[0].binName])); // eslint-disable-line
|
||||
// eslint-disable-next-line node/no-missing-require
|
||||
const pkg = require(pkgPath);
|
||||
// eslint-disable-next-line node/no-missing-require
|
||||
require(path.resolve(
|
||||
path.dirname(pkgPath),
|
||||
pkg.bin[installedClis[0].binName]
|
||||
));
|
||||
} else {
|
||||
console.warn(
|
||||
`You have installed ${installedClis
|
||||
|
|
|
@ -305,7 +305,7 @@ class Chunk {
|
|||
if (this._modules.size < otherChunk._modules.size) return 1;
|
||||
const a = this._modules[Symbol.iterator]();
|
||||
const b = otherChunk._modules[Symbol.iterator]();
|
||||
// eslint-disable-next-line
|
||||
// eslint-disable-next-line no-constant-condition
|
||||
while (true) {
|
||||
const aItem = a.next();
|
||||
const bItem = b.next();
|
||||
|
|
|
@ -401,7 +401,7 @@ class ChunkGroup {
|
|||
if (this.chunks.length < otherGroup.chunks.length) return 1;
|
||||
const a = this.chunks[Symbol.iterator]();
|
||||
const b = otherGroup.chunks[Symbol.iterator]();
|
||||
// eslint-disable-next-line
|
||||
// eslint-disable-next-line no-constant-condition
|
||||
while (true) {
|
||||
const aItem = a.next();
|
||||
const bItem = b.next();
|
||||
|
|
|
@ -89,11 +89,11 @@ const iterationOfArrayCallback = (arr, fn) => {
|
|||
}
|
||||
};
|
||||
|
||||
function addAllToSet(set, otherSet) {
|
||||
const addAllToSet = (set, otherSet) => {
|
||||
for (const item of otherSet) {
|
||||
set.add(item);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
class Compilation extends Tapable {
|
||||
constructor(compiler) {
|
||||
|
|
|
@ -10,12 +10,16 @@ const ParserHelpers = require("./ParserHelpers");
|
|||
const NullFactory = require("./NullFactory");
|
||||
|
||||
const REPLACEMENTS = {
|
||||
__webpack_hash__: "__webpack_require__.h", // eslint-disable-line camelcase
|
||||
__webpack_chunkname__: "__webpack_require__.cn" // eslint-disable-line camelcase
|
||||
// eslint-disable-next-line camelcase
|
||||
__webpack_hash__: "__webpack_require__.h",
|
||||
// eslint-disable-next-line camelcase
|
||||
__webpack_chunkname__: "__webpack_require__.cn"
|
||||
};
|
||||
const REPLACEMENT_TYPES = {
|
||||
__webpack_hash__: "string", // eslint-disable-line camelcase
|
||||
__webpack_chunkname__: "string" // eslint-disable-line camelcase
|
||||
// eslint-disable-next-line camelcase
|
||||
__webpack_hash__: "string",
|
||||
// eslint-disable-next-line camelcase
|
||||
__webpack_chunkname__: "string"
|
||||
};
|
||||
|
||||
class ExtendedAPIPlugin {
|
||||
|
|
|
@ -64,7 +64,7 @@ class ExternalModuleFactoryPlugin {
|
|||
asyncFlag = true;
|
||||
if (i >= externals.length) return callback();
|
||||
handleExternals(externals[i++], handleExternalsAndCallback);
|
||||
} while (!asyncFlag); // eslint-disable-line keyword-spacing
|
||||
} while (!asyncFlag);
|
||||
asyncFlag = false;
|
||||
};
|
||||
|
||||
|
|
|
@ -5,12 +5,15 @@
|
|||
/*global $hash$ $requestTimeout$ installedModules $require$ hotDownloadManifest hotDownloadUpdateChunk hotDisposeChunk modules */
|
||||
module.exports = function() {
|
||||
var hotApplyOnUpdate = true;
|
||||
var hotCurrentHash = $hash$; // eslint-disable-line no-unused-vars
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
var hotCurrentHash = $hash$;
|
||||
var hotRequestTimeout = $requestTimeout$;
|
||||
var hotCurrentModuleData = {};
|
||||
var hotCurrentChildModule; // eslint-disable-line no-unused-vars
|
||||
var hotCurrentParents = []; // eslint-disable-line no-unused-vars
|
||||
var hotCurrentParentsTemp = []; // eslint-disable-line no-unused-vars
|
||||
var hotCurrentChildModule;
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
var hotCurrentParents = [];
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
var hotCurrentParentsTemp = [];
|
||||
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
function hotCreateRequire(moduleId) {
|
||||
|
@ -199,8 +202,8 @@ module.exports = function() {
|
|||
});
|
||||
hotUpdate = {};
|
||||
/*foreachInstalledChunks*/
|
||||
// eslint-disable-next-line no-lone-blocks
|
||||
{
|
||||
// eslint-disable-line no-lone-blocks
|
||||
/*globals chunkId */
|
||||
hotEnsureUpdateChunk(chunkId);
|
||||
}
|
||||
|
|
|
@ -75,13 +75,13 @@ normalized:
|
|||
"use strict";
|
||||
|
||||
const notMatcher = matcher => {
|
||||
return function(str) {
|
||||
return str => {
|
||||
return !matcher(str);
|
||||
};
|
||||
};
|
||||
|
||||
const orMatcher = items => {
|
||||
return function(str) {
|
||||
return str => {
|
||||
for (let i = 0; i < items.length; i++) {
|
||||
if (items[i](str)) return true;
|
||||
}
|
||||
|
@ -90,7 +90,7 @@ const orMatcher = items => {
|
|||
};
|
||||
|
||||
const andMatcher = items => {
|
||||
return function(str) {
|
||||
return str => {
|
||||
for (let i = 0; i < items.length; i++) {
|
||||
if (!items[i](str)) return false;
|
||||
}
|
||||
|
|
|
@ -108,10 +108,11 @@ class Stats {
|
|||
if (typeof item === "string") {
|
||||
const regExp = new RegExp(
|
||||
`[\\\\/]${item.replace(
|
||||
// eslint-disable-next-line no-useless-escape
|
||||
/[-[\]{}()*+?.\\^$|]/g,
|
||||
"\\$&"
|
||||
)}([\\\\/]|$|!|\\?)`
|
||||
); // eslint-disable-line no-useless-escape
|
||||
);
|
||||
return ident => regExp.test(ident);
|
||||
}
|
||||
if (item && typeof item === "object" && typeof item.test === "function") {
|
||||
|
|
|
@ -107,14 +107,14 @@ class UmdMainTemplatePlugin {
|
|||
requiredExternals = externals;
|
||||
}
|
||||
|
||||
function replaceKeys(str) {
|
||||
const replaceKeys = str => {
|
||||
return mainTemplate.getAssetPath(str, {
|
||||
hash,
|
||||
chunk
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
function externalsDepsArray(modules) {
|
||||
const externalsDepsArray = modules => {
|
||||
return `[${replaceKeys(
|
||||
modules
|
||||
.map(m =>
|
||||
|
@ -124,9 +124,9 @@ class UmdMainTemplatePlugin {
|
|||
)
|
||||
.join(", ")
|
||||
)}]`;
|
||||
}
|
||||
};
|
||||
|
||||
function externalsRootArray(modules) {
|
||||
const externalsRootArray = modules => {
|
||||
return replaceKeys(
|
||||
modules
|
||||
.map(m => {
|
||||
|
@ -136,9 +136,9 @@ class UmdMainTemplatePlugin {
|
|||
})
|
||||
.join(", ")
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
function externalsRequireArray(type) {
|
||||
const externalsRequireArray = type => {
|
||||
return replaceKeys(
|
||||
externals
|
||||
.map(m => {
|
||||
|
@ -166,20 +166,20 @@ class UmdMainTemplatePlugin {
|
|||
})
|
||||
.join(", ")
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
function externalsArguments(modules) {
|
||||
const externalsArguments = modules => {
|
||||
return modules
|
||||
.map(
|
||||
m =>
|
||||
`__WEBPACK_EXTERNAL_MODULE_${Template.toIdentifier(`${m.id}`)}__`
|
||||
)
|
||||
.join(", ");
|
||||
}
|
||||
};
|
||||
|
||||
function libraryName(library) {
|
||||
const libraryName = library => {
|
||||
return JSON.stringify(replaceKeys([].concat(library).pop()));
|
||||
}
|
||||
};
|
||||
|
||||
let amdFactory;
|
||||
if (optionalExternals.length > 0) {
|
||||
|
|
|
@ -332,7 +332,6 @@ class WebpackOptionsValidationError extends WebpackError {
|
|||
}
|
||||
return baseMessage;
|
||||
} else {
|
||||
// eslint-disable-line no-fallthrough
|
||||
return `${dataPath} ${err.message} (${JSON.stringify(
|
||||
err,
|
||||
null,
|
||||
|
|
|
@ -5,7 +5,8 @@ const schema = require("../../schemas/plugins/debug/ProfilingPlugin.json");
|
|||
let inspector = undefined;
|
||||
|
||||
try {
|
||||
inspector = require("inspector"); // eslint-disable-line node/no-missing-require
|
||||
// eslint-disable-next-line node/no-missing-require
|
||||
inspector = require("inspector");
|
||||
} catch (e) {
|
||||
console.log("Unable to CPU profile in < node 8.0");
|
||||
}
|
||||
|
@ -84,7 +85,7 @@ class Profiler {
|
|||
* @param {string} outputPath The location where to write the log.
|
||||
* @returns {Trace} The trace object
|
||||
*/
|
||||
function createTrace(outputPath) {
|
||||
const createTrace = outputPath => {
|
||||
const trace = new Tracer({
|
||||
noStream: true
|
||||
});
|
||||
|
@ -139,7 +140,7 @@ function createTrace(outputPath) {
|
|||
trace.destroy();
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
const pluginName = "ProfilingPlugin";
|
||||
|
||||
|
@ -354,7 +355,6 @@ const makeNewProfiledTapFn = (hookName, tracer, { name, type, fn }) => {
|
|||
switch (type) {
|
||||
case "promise":
|
||||
return (...args) => {
|
||||
// eslint-disable-line
|
||||
const id = ++tracer.counter;
|
||||
tracer.trace.begin({
|
||||
name,
|
||||
|
@ -373,7 +373,6 @@ const makeNewProfiledTapFn = (hookName, tracer, { name, type, fn }) => {
|
|||
};
|
||||
case "async":
|
||||
return (...args) => {
|
||||
// eslint-disable-line
|
||||
const id = ++tracer.counter;
|
||||
tracer.trace.begin({
|
||||
name,
|
||||
|
@ -392,7 +391,6 @@ const makeNewProfiledTapFn = (hookName, tracer, { name, type, fn }) => {
|
|||
};
|
||||
case "sync":
|
||||
return (...args) => {
|
||||
// eslint-disable-line
|
||||
const id = ++tracer.counter;
|
||||
// Do not instrument ourself due to the CPU
|
||||
// profile needing to be the last event in the trace.
|
||||
|
|
|
@ -23,17 +23,17 @@ const isBoundFunctionExpression = expr => {
|
|||
return true;
|
||||
};
|
||||
|
||||
function isUnboundFunctionExpression(expr) {
|
||||
const isUnboundFunctionExpression = expr => {
|
||||
if (expr.type === "FunctionExpression") return true;
|
||||
if (expr.type === "ArrowFunctionExpression") return true;
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
function isCallable(expr) {
|
||||
const isCallable = expr => {
|
||||
if (isUnboundFunctionExpression(expr)) return true;
|
||||
if (isBoundFunctionExpression(expr)) return true;
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
class AMDDefineDependencyParserPlugin {
|
||||
constructor(options) {
|
||||
|
@ -80,7 +80,6 @@ class AMDDefineDependencyParserPlugin {
|
|||
request
|
||||
))
|
||||
) {
|
||||
// eslint-disable-line no-cond-assign
|
||||
dep = new LocalModuleDependency(localModule, undefined, false);
|
||||
dep.loc = expr.loc;
|
||||
parser.state.current.addDependency(dep);
|
||||
|
@ -121,7 +120,6 @@ class AMDDefineDependencyParserPlugin {
|
|||
namedModule
|
||||
))
|
||||
) {
|
||||
// eslint-disable-line no-cond-assign
|
||||
dep = new LocalModuleDependency(localModule, param.range, false);
|
||||
} else {
|
||||
dep = this.newRequireItemDependency(param.string, param.range);
|
||||
|
|
|
@ -79,7 +79,6 @@ class AMDRequireDependenciesBlockParserPlugin {
|
|||
request
|
||||
))
|
||||
) {
|
||||
// eslint-disable-line no-cond-assign
|
||||
dep = new LocalModuleDependency(localModule, undefined, false);
|
||||
dep.loc = expr.loc;
|
||||
parser.state.current.addDependency(dep);
|
||||
|
@ -127,7 +126,6 @@ class AMDRequireDependenciesBlockParserPlugin {
|
|||
param.string
|
||||
))
|
||||
) {
|
||||
// eslint-disable-line no-cond-assign
|
||||
dep = new LocalModuleDependency(localModule, param.range, false);
|
||||
} else {
|
||||
dep = this.newRequireItemDependency(param.string, param.range);
|
||||
|
|
|
@ -37,7 +37,7 @@ module.exports = function() {
|
|||
});
|
||||
}
|
||||
|
||||
//eslint-disable-next-line no-unused-vars
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
function hotDisposeChunk(chunkId) {
|
||||
delete installedChunks[chunkId];
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* @param {Set[]} sets an array of sets being checked for shared elements
|
||||
* @returns {Set<TODO>} returns a new Set containing the intersecting items
|
||||
*/
|
||||
function intersect(sets) {
|
||||
const intersect = sets => {
|
||||
if (sets.length === 0) return new Set();
|
||||
if (sets.length === 1) return new Set(sets[0]);
|
||||
let minSize = Infinity;
|
||||
|
@ -28,7 +28,7 @@ function intersect(sets) {
|
|||
}
|
||||
}
|
||||
return current;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Checks if a set is the subset of another set
|
||||
|
@ -36,13 +36,13 @@ function intersect(sets) {
|
|||
* @param {Set<TODO>} smallSet the set whos elements might be contained inside of bigSet
|
||||
* @returns {boolean} returns true if smallSet contains all elements inside of the bigSet
|
||||
*/
|
||||
function isSubset(bigSet, smallSet) {
|
||||
const isSubset = (bigSet, smallSet) => {
|
||||
if (bigSet.size < smallSet.size) return false;
|
||||
for (const item of smallSet) {
|
||||
if (!bigSet.has(item)) return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
exports.intersect = intersect;
|
||||
exports.isSubset = isSubset;
|
||||
|
|
|
@ -10,7 +10,7 @@ const WebAssemblyUtils = require("./WebAssemblyUtils");
|
|||
/** @typedef {import("../Module")} Module */
|
||||
|
||||
// Get all wasm modules
|
||||
function getAllWasmModules(chunk) {
|
||||
const getAllWasmModules = chunk => {
|
||||
const wasmModules = chunk.getAllAsyncChunks();
|
||||
const array = [];
|
||||
for (const chunk of wasmModules) {
|
||||
|
@ -22,7 +22,7 @@ function getAllWasmModules(chunk) {
|
|||
}
|
||||
|
||||
return array;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* generates the import object function for a module
|
||||
|
@ -30,7 +30,7 @@ function getAllWasmModules(chunk) {
|
|||
* @param {boolean} mangle mangle imports
|
||||
* @returns {string} source code
|
||||
*/
|
||||
function generateImportObject(module, mangle) {
|
||||
const generateImportObject = (module, mangle) => {
|
||||
const waitForInstances = new Map();
|
||||
const properties = [];
|
||||
const usedWasmDependencies = WebAssemblyUtils.getUsedDependencies(
|
||||
|
@ -151,7 +151,7 @@ function generateImportObject(module, mangle) {
|
|||
"},"
|
||||
]);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
class WasmMainTemplatePlugin {
|
||||
constructor({ generateLoadBinaryCode, supportsStreaming, mangleImports }) {
|
||||
|
|
|
@ -32,21 +32,21 @@ const WebAssemblyExportImportedDependency = require("../dependencies/WebAssembly
|
|||
* @param {ArrayBuffer} ab - original binary
|
||||
* @returns {ArrayBufferTransform} transform
|
||||
*/
|
||||
function preprocess(ab) {
|
||||
const preprocess = ab => {
|
||||
const optBin = shrinkPaddedLEB128(new Uint8Array(ab));
|
||||
return optBin.buffer;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @template T
|
||||
* @param {Function[]} fns transforms
|
||||
* @returns {Function} composed transform
|
||||
*/
|
||||
function compose(...fns) {
|
||||
const compose = (...fns) => {
|
||||
return fns.reduce((prevFn, nextFn) => {
|
||||
return value => nextFn(prevFn(value));
|
||||
}, value => value);
|
||||
}
|
||||
};
|
||||
|
||||
// TODO replace with @callback
|
||||
|
||||
|
@ -70,7 +70,7 @@ const removeStartFunc = state => bin => {
|
|||
* @param {Object} ast - Module's AST
|
||||
* @returns {Array<t.ModuleImport>} - nodes
|
||||
*/
|
||||
function getImportedGlobals(ast) {
|
||||
const getImportedGlobals = ast => {
|
||||
const importedGlobals = [];
|
||||
|
||||
t.traverse(ast, {
|
||||
|
@ -82,9 +82,9 @@ function getImportedGlobals(ast) {
|
|||
});
|
||||
|
||||
return importedGlobals;
|
||||
}
|
||||
};
|
||||
|
||||
function getCountImportedFunc(ast) {
|
||||
const getCountImportedFunc = ast => {
|
||||
let count = 0;
|
||||
|
||||
t.traverse(ast, {
|
||||
|
@ -96,7 +96,7 @@ function getCountImportedFunc(ast) {
|
|||
});
|
||||
|
||||
return count;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Get next type index
|
||||
|
@ -104,7 +104,7 @@ function getCountImportedFunc(ast) {
|
|||
* @param {Object} ast - Module's AST
|
||||
* @returns {t.Index} - index
|
||||
*/
|
||||
function getNextTypeIndex(ast) {
|
||||
const getNextTypeIndex = ast => {
|
||||
const typeSectionMetadata = t.getSectionMetadata(ast, "type");
|
||||
|
||||
if (typeof typeSectionMetadata === "undefined") {
|
||||
|
@ -112,7 +112,7 @@ function getNextTypeIndex(ast) {
|
|||
}
|
||||
|
||||
return t.indexLiteral(typeSectionMetadata.vectorOfSize.value);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Get next func index
|
||||
|
@ -125,7 +125,7 @@ function getNextTypeIndex(ast) {
|
|||
* @param {Number} countImportedFunc - number of imported funcs
|
||||
* @returns {t.Index} - index
|
||||
*/
|
||||
function getNextFuncIndex(ast, countImportedFunc) {
|
||||
const getNextFuncIndex = (ast, countImportedFunc) => {
|
||||
const funcSectionMetadata = t.getSectionMetadata(ast, "func");
|
||||
|
||||
if (typeof funcSectionMetadata === "undefined") {
|
||||
|
@ -135,7 +135,7 @@ function getNextFuncIndex(ast, countImportedFunc) {
|
|||
const vectorOfSize = funcSectionMetadata.vectorOfSize.value;
|
||||
|
||||
return t.indexLiteral(vectorOfSize + countImportedFunc);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Create a init instruction for a global
|
||||
|
|
|
@ -9,7 +9,7 @@ const WebEnvironmentPlugin = require("./web/WebEnvironmentPlugin");
|
|||
const WebpackOptionsApply = require("./WebpackOptionsApply");
|
||||
const WebpackOptionsDefaulter = require("./WebpackOptionsDefaulter");
|
||||
|
||||
function webpack(options, callback) {
|
||||
const webpack = (options, callback) => {
|
||||
new WebpackOptionsDefaulter().process(options);
|
||||
|
||||
const compiler = new Compiler();
|
||||
|
@ -22,7 +22,7 @@ function webpack(options, callback) {
|
|||
compiler.run(callback);
|
||||
}
|
||||
return compiler;
|
||||
}
|
||||
};
|
||||
module.exports = webpack;
|
||||
|
||||
webpack.WebpackOptionsDefaulter = WebpackOptionsDefaulter;
|
||||
|
|
Loading…
Reference in New Issue