Upgrade to Prettier 2

This commit is contained in:
Mohsen Azimi 2020-03-28 18:10:15 -04:00
parent e964f0810c
commit 7b07a8db66
70 changed files with 251 additions and 270 deletions

View File

@ -2,6 +2,8 @@ module.exports = {
printWidth: 80,
useTabs: true,
tabWidth: 2,
trailingComma: "none",
arrowParens: "avoid",
overrides: [
{
files: "*.json",

View File

@ -7,7 +7,7 @@ const outputPath = path.join(__dirname, "js");
const benchmarkOptions = {
defer: true,
onCycle: function() {
onCycle: function () {
process.stderr.write(".");
},
minSamples: 10

View File

@ -12,7 +12,7 @@ if (module.hot) {
var check = function check() {
module.hot
.check(true)
.then(function(updatedModules) {
.then(function (updatedModules) {
if (!updatedModules) {
log("warning", "[HMR] Cannot find update. Need to do a full reload!");
log(
@ -33,7 +33,7 @@ if (module.hot) {
log("info", "[HMR] App is up to date.");
}
})
.catch(function(err) {
.catch(function (err) {
var status = module.hot.status();
if (["abort", "fail"].indexOf(status) >= 0) {
log(
@ -48,7 +48,7 @@ if (module.hot) {
});
};
var hotEmitter = require("./emitter");
hotEmitter.on("webpackHotUpdate", function(currentHash) {
hotEmitter.on("webpackHotUpdate", function (currentHash) {
lastHash = currentHash;
if (!upToDate() && module.hot.status() === "idle") {
log("info", "[HMR] Checking for updates on the server...");

View File

@ -2,8 +2,8 @@
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
module.exports = function(updatedModules, renewedModules) {
var unacceptedModules = updatedModules.filter(function(moduleId) {
module.exports = function (updatedModules, renewedModules) {
var unacceptedModules = updatedModules.filter(function (moduleId) {
return renewedModules && renewedModules.indexOf(moduleId) < 0;
});
var log = require("./log");
@ -13,7 +13,7 @@ module.exports = function(updatedModules, renewedModules) {
"warning",
"[HMR] The following modules couldn't be hot updated: (They would need a full reload!)"
);
unacceptedModules.forEach(function(moduleId) {
unacceptedModules.forEach(function (moduleId) {
log("warning", "[HMR] - " + moduleId);
});
}
@ -22,7 +22,7 @@ module.exports = function(updatedModules, renewedModules) {
log("info", "[HMR] Nothing hot updated.");
} else {
log("info", "[HMR] Updated modules:");
renewedModules.forEach(function(moduleId) {
renewedModules.forEach(function (moduleId) {
if (typeof moduleId === "string" && moduleId.indexOf("!") !== -1) {
var parts = moduleId.split("!");
log.groupCollapsed("info", "[HMR] - " + parts.pop());
@ -32,7 +32,7 @@ module.exports = function(updatedModules, renewedModules) {
log("info", "[HMR] - " + moduleId);
}
});
var numberIds = renewedModules.every(function(moduleId) {
var numberIds = renewedModules.every(function (moduleId) {
return typeof moduleId === "number";
});
if (numberIds)

View File

@ -11,14 +11,14 @@ function shouldLog(level) {
}
function logGroup(logFn) {
return function(level, msg) {
return function (level, msg) {
if (shouldLog(level)) {
logFn(msg);
}
};
}
module.exports = function(level, msg) {
module.exports = function (level, msg) {
if (shouldLog(level)) {
if (level === "info") {
console.log(msg);
@ -42,11 +42,11 @@ module.exports.groupCollapsed = logGroup(groupCollapsed);
module.exports.groupEnd = logGroup(groupEnd);
module.exports.setLogLevel = function(level) {
module.exports.setLogLevel = function (level) {
logLevel = level;
};
module.exports.formatError = function(err) {
module.exports.formatError = function (err) {
var message = err.message;
var stack = err.stack;
if (!stack) {

View File

@ -12,7 +12,7 @@ if (module.hot) {
var check = function check() {
module.hot
.check()
.then(function(updatedModules) {
.then(function (updatedModules) {
if (!updatedModules) {
log("warning", "[HMR] Cannot find update. Need to do a full reload!");
log(
@ -27,21 +27,21 @@ if (module.hot) {
ignoreUnaccepted: true,
ignoreDeclined: true,
ignoreErrored: true,
onUnaccepted: function(data) {
onUnaccepted: function (data) {
log(
"warning",
"Ignored an update to unaccepted module " +
data.chain.join(" -> ")
);
},
onDeclined: function(data) {
onDeclined: function (data) {
log(
"warning",
"Ignored an update to declined module " +
data.chain.join(" -> ")
);
},
onErrored: function(data) {
onErrored: function (data) {
log("error", data.error);
log(
"warning",
@ -53,7 +53,7 @@ if (module.hot) {
);
}
})
.then(function(renewedModules) {
.then(function (renewedModules) {
if (!upToDate()) {
check();
}
@ -65,7 +65,7 @@ if (module.hot) {
}
});
})
.catch(function(err) {
.catch(function (err) {
var status = module.hot.status();
if (["abort", "fail"].indexOf(status) >= 0) {
log(
@ -79,7 +79,7 @@ if (module.hot) {
});
};
var hotEmitter = require("./emitter");
hotEmitter.on("webpackHotUpdate", function(currentHash) {
hotEmitter.on("webpackHotUpdate", function (currentHash) {
lastHash = currentHash;
if (!upToDate()) {
var status = module.hot.status();

View File

@ -11,7 +11,7 @@ if (module.hot) {
if (module.hot.status() === "idle") {
module.hot
.check(true)
.then(function(updatedModules) {
.then(function (updatedModules) {
if (!updatedModules) {
if (fromUpdate) log("info", "[HMR] Update applied.");
return;
@ -19,7 +19,7 @@ if (module.hot) {
require("./log-apply-result")(updatedModules, updatedModules);
checkForUpdate(true);
})
.catch(function(err) {
.catch(function (err) {
var status = module.hot.status();
if (["abort", "fail"].indexOf(status) >= 0) {
log("warning", "[HMR] Cannot apply update.");

View File

@ -8,7 +8,7 @@ if (module.hot) {
var checkForUpdate = function checkForUpdate(fromUpdate) {
module.hot
.check()
.then(function(updatedModules) {
.then(function (updatedModules) {
if (!updatedModules) {
if (fromUpdate) log("info", "[HMR] Update applied.");
else log("warning", "[HMR] Cannot find update.");
@ -18,7 +18,7 @@ if (module.hot) {
return module.hot
.apply({
ignoreUnaccepted: true,
onUnaccepted: function(data) {
onUnaccepted: function (data) {
log(
"warning",
"Ignored an update to unaccepted module " +
@ -26,14 +26,14 @@ if (module.hot) {
);
}
})
.then(function(renewedModules) {
.then(function (renewedModules) {
require("./log-apply-result")(updatedModules, renewedModules);
checkForUpdate(true);
return null;
});
})
.catch(function(err) {
.catch(function (err) {
var status = module.hot.status();
if (["abort", "fail"].indexOf(status) >= 0) {
log("warning", "[HMR] Cannot apply update.");
@ -45,7 +45,7 @@ if (module.hot) {
});
};
process.on(__resourceQuery.substr(1) || "SIGUSR2", function() {
process.on(__resourceQuery.substr(1) || "SIGUSR2", function () {
if (module.hot.status() !== "idle") {
log(
"warning",

View File

@ -126,7 +126,7 @@ Object.defineProperty(ChunkTemplate.prototype, "outputOptions", {
* @this {ChunkTemplate}
* @returns {TODO} output options
*/
function() {
function () {
return this._outputOptions;
},
"ChunkTemplate.outputOptions is deprecated (use Compilation.outputOptions instead)",

View File

@ -104,7 +104,7 @@ class ContextModule extends Module {
// Info from Factory
this.resolveDependencies = resolveDependencies;
/** @type {ContextModuleOptions} */
this.options = ({
this.options = {
resource: resource,
resourceQuery: resourceQuery,
mode: options.mode,
@ -116,7 +116,7 @@ class ContextModule extends Module {
chunkName: options.chunkName,
groupOptions: options.groupOptions,
namespaceObject: options.namespaceObject
});
};
if (options.resolveOptions !== undefined) {
this.resolveOptions = options.resolveOptions;
}

View File

@ -79,8 +79,7 @@ class EvalSourceMapDevToolPlugin {
} else if (m instanceof ConcatenatedModule) {
const concatModule = /** @type {ConcatenatedModule} */ (m);
if (concatModule.rootModule instanceof NormalModule) {
const module =
/** @type {NormalModule} */ (concatModule.rootModule);
const module = /** @type {NormalModule} */ (concatModule.rootModule);
if (!matchModule(module.resource)) {
return source;
}

View File

@ -298,7 +298,7 @@ Object.defineProperty(MainTemplate.prototype, "outputOptions", {
* @this {MainTemplate}
* @returns {TODO} output options
*/
function() {
function () {
return this._outputOptions;
},
"MainTemplate.outputOptions is deprecated (use Compilation.outputOptions instead)",

View File

@ -703,11 +703,7 @@ class Module extends DependenciesBlock {
const sources = this.codeGeneration(sourceContext).sources;
return sourceContext.type
? sources.get(sourceContext.type)
: sources.get(
this.getSourceTypes()
.values()
.next().value
);
: sources.get(this.getSourceTypes().values().next().value);
}
/**
@ -868,7 +864,7 @@ Object.defineProperty(Module.prototype, "errors", {
* @this {Module}
* @returns {WebpackError[]} array
*/
function() {
function () {
if (this._errors === undefined) {
this._errors = [];
}
@ -886,7 +882,7 @@ Object.defineProperty(Module.prototype, "warnings", {
* @this {Module}
* @returns {WebpackError[]} array
*/
function() {
function () {
if (this._warnings === undefined) {
this._warnings = [];
}

View File

@ -20,10 +20,7 @@ class ModuleDependencyError extends WebpackError {
super(err.message);
this.name = "ModuleDependencyError";
this.details = err.stack
.split("\n")
.slice(1)
.join("\n");
this.details = err.stack.split("\n").slice(1).join("\n");
this.module = module;
this.loc = loc;
this.error = err;

View File

@ -19,10 +19,7 @@ module.exports = class ModuleDependencyWarning extends WebpackError {
super(err.message);
this.name = "ModuleDependencyWarning";
this.details = err.stack
.split("\n")
.slice(1)
.join("\n");
this.details = err.stack.split("\n").slice(1).join("\n");
this.module = module;
this.loc = loc;
this.error = err;

View File

@ -88,10 +88,7 @@ ModuleFilenameHelpers.createFilename = (
shortIdentifier = module.readableIdentifier(requestShortener);
identifier = requestShortener.shorten(module.identifier());
moduleId = chunkGraph.getModuleId(module);
absoluteResourcePath = module
.identifier()
.split("!")
.pop();
absoluteResourcePath = module.identifier().split("!").pop();
hash = getHash(identifier);
}
const resource = shortIdentifier.split("!").pop();

View File

@ -140,7 +140,7 @@ Object.defineProperty(ModuleTemplate.prototype, "runtimeTemplate", {
* @this {ModuleTemplate}
* @returns {TODO} output options
*/
function() {
function () {
return this._runtimeTemplate;
},
"ModuleTemplate.runtimeTemplate is deprecated (use Compilation.runtimeTemplate instead)",

View File

@ -117,9 +117,7 @@ const getNormalizedWebpackOptions = config => {
entry: nestedConfig(config.entry, entry => {
if (typeof entry === "function") {
return () =>
Promise.resolve()
.then(entry)
.then(getNormalizedEntryStatic);
Promise.resolve().then(entry).then(getNormalizedEntryStatic);
}
return getNormalizedEntryStatic(entry);
}),

View File

@ -14,7 +14,7 @@ var $hmrDownloadManifest$ = undefined;
var $hmrDownloadUpdateHandlers$ = undefined;
var __webpack_require__ = undefined;
module.exports = function() {
module.exports = function () {
var currentHash = $getFullHash$();
var currentModuleData = {};
var installedModules = $moduleCache$;
@ -36,11 +36,11 @@ module.exports = function() {
$hmrModuleData$ = currentModuleData;
$getFullHash$ = function() {
$getFullHash$ = function () {
return currentHash;
};
$interceptModuleExecution$.push(function(options) {
$interceptModuleExecution$.push(function (options) {
var module = options.module;
var require = createRequire(options.require, options.id);
module.hot = createModuleHotObject(options.id, module);
@ -55,7 +55,7 @@ module.exports = function() {
function createRequire(require, moduleId) {
var me = installedModules[moduleId];
if (!me) return require;
var fn = function(request) {
var fn = function (request) {
if (me.hot.active) {
if (installedModules[request]) {
var parents = installedModules[request].parents;
@ -80,14 +80,14 @@ module.exports = function() {
}
return require(request);
};
var createPropertyDescriptor = function(name) {
var createPropertyDescriptor = function (name) {
return {
configurable: true,
enumerable: true,
get: function() {
get: function () {
return require[name];
},
set: function(value) {
set: function (value) {
require[name] = value;
}
};
@ -97,7 +97,7 @@ module.exports = function() {
Object.defineProperty(fn, name, createPropertyDescriptor(name));
}
}
fn.e = function(chunkId) {
fn.e = function (chunkId) {
return trackBlockingPromise(require.e(chunkId));
};
return fn;
@ -112,7 +112,7 @@ module.exports = function() {
_selfDeclined: false,
_disposeHandlers: [],
_main: currentChildModule !== moduleId,
_requireSelf: function() {
_requireSelf: function () {
currentParents = me.parents.slice();
currentChildModule = moduleId;
__webpack_require__(moduleId);
@ -120,28 +120,28 @@ module.exports = function() {
// Module API
active: true,
accept: function(dep, callback) {
accept: function (dep, callback) {
if (dep === undefined) hot._selfAccepted = true;
else if (typeof dep === "function") hot._selfAccepted = dep;
else if (typeof dep === "object" && dep !== null)
for (var i = 0; i < dep.length; i++)
hot._acceptedDependencies[dep[i]] = callback || function() {};
else hot._acceptedDependencies[dep] = callback || function() {};
hot._acceptedDependencies[dep[i]] = callback || function () {};
else hot._acceptedDependencies[dep] = callback || function () {};
},
decline: function(dep) {
decline: function (dep) {
if (dep === undefined) hot._selfDeclined = true;
else if (typeof dep === "object" && dep !== null)
for (var i = 0; i < dep.length; i++)
hot._declinedDependencies[dep[i]] = true;
else hot._declinedDependencies[dep] = true;
},
dispose: function(callback) {
dispose: function (callback) {
hot._disposeHandlers.push(callback);
},
addDisposeHandler: function(callback) {
addDisposeHandler: function (callback) {
hot._disposeHandlers.push(callback);
},
removeDisposeHandler: function(callback) {
removeDisposeHandler: function (callback) {
var idx = hot._disposeHandlers.indexOf(callback);
if (idx >= 0) hot._disposeHandlers.splice(idx, 1);
},
@ -149,14 +149,14 @@ module.exports = function() {
// Management API
check: hotCheck,
apply: hotApply,
status: function(l) {
status: function (l) {
if (!l) return currentStatus;
registeredStatusHandlers.push(l);
},
addStatusHandler: function(l) {
addStatusHandler: function (l) {
registeredStatusHandlers.push(l);
},
removeStatusHandler: function(l) {
removeStatusHandler: function (l) {
var idx = registeredStatusHandlers.indexOf(l);
if (idx >= 0) registeredStatusHandlers.splice(idx, 1);
},
@ -179,7 +179,7 @@ module.exports = function() {
case "ready":
setStatus("prepare");
blockingPromises.push(promise);
waitForBlockingPromises(function() {
waitForBlockingPromises(function () {
setStatus("ready");
});
return promise;
@ -195,7 +195,7 @@ module.exports = function() {
if (blockingPromises.length === 0) return fn();
var blocker = blockingPromises;
blockingPromises = [];
return Promise.all(blocker).then(function() {
return Promise.all(blocker).then(function () {
return waitForBlockingPromises(fn);
});
}
@ -205,7 +205,7 @@ module.exports = function() {
throw new Error("check() is only allowed in idle status");
}
setStatus("check");
return $hmrDownloadManifest$().then(function(update) {
return $hmrDownloadManifest$().then(function (update) {
if (!update) {
setStatus("idle");
return null;
@ -219,7 +219,7 @@ module.exports = function() {
currentUpdateApplyHandlers = [];
return Promise.all(
Object.keys($hmrDownloadUpdateHandlers$).reduce(function(
Object.keys($hmrDownloadUpdateHandlers$).reduce(function (
promises,
key
) {
@ -234,8 +234,8 @@ module.exports = function() {
return promises;
},
[])
).then(function() {
return waitForBlockingPromises(function() {
).then(function () {
return waitForBlockingPromises(function () {
if (applyOnUpdate) {
return internalApply(applyOnUpdate);
} else {
@ -250,7 +250,7 @@ module.exports = function() {
function hotApply(options) {
if (currentStatus !== "ready") {
return Promise.resolve().then(function() {
return Promise.resolve().then(function () {
throw new Error("apply() is only allowed in ready status");
});
}
@ -260,19 +260,19 @@ module.exports = function() {
function internalApply(options) {
options = options || {};
var results = currentUpdateApplyHandlers.map(function(handler) {
var results = currentUpdateApplyHandlers.map(function (handler) {
return handler(options);
});
var errors = results
.map(function(r) {
.map(function (r) {
return r.error;
})
.filter(Boolean);
if (errors.length > 0) {
setStatus("abort");
return Promise.resolve().then(function() {
return Promise.resolve().then(function () {
throw errors[0];
});
}
@ -280,7 +280,7 @@ module.exports = function() {
// Now in "dispose" phase
setStatus("dispose");
results.forEach(function(result) {
results.forEach(function (result) {
if (result.dispose) result.dispose();
});
@ -290,12 +290,12 @@ module.exports = function() {
currentHash = currentUpdateNewHash;
var error;
var reportError = function(err) {
var reportError = function (err) {
if (!error) error = err;
};
var outdatedModules = [];
results.forEach(function(result) {
results.forEach(function (result) {
if (result.apply) {
var modules = result.apply(reportError);
if (modules) {
@ -309,7 +309,7 @@ module.exports = function() {
// handle errors in accept handlers and self accepted module load
if (error) {
setStatus("fail");
return Promise.resolve().then(function() {
return Promise.resolve().then(function () {
throw error;
});
}

View File

@ -13,12 +13,12 @@ var $moduleFactories$ = undefined;
var $hmrModuleData$ = undefined;
var __webpack_require__ = undefined;
module.exports = function() {
module.exports = function () {
function getAffectedModuleEffects(updateModuleId) {
var outdatedModules = [updateModuleId];
var outdatedDependencies = {};
var queue = outdatedModules.map(function(id) {
var queue = outdatedModules.map(function (id) {
return {
chain: [id],
id: id
@ -211,7 +211,7 @@ module.exports = function() {
var moduleOutdatedDependencies;
return {
dispose: function() {
dispose: function () {
// $dispose$
var idx;
@ -271,7 +271,7 @@ module.exports = function() {
}
}
},
apply: function(reportError) {
apply: function (reportError) {
// insert new code
for (var updateModuleId in appliedUpdate) {
if (

View File

@ -152,8 +152,7 @@ class JavascriptGenerator extends Generator {
* @returns {void}
*/
sourceDependency(module, dependency, initFragments, source, generateContext) {
const constructor =
/** @type {new (...args: any[]) => Dependency} */ (dependency.constructor);
const constructor = /** @type {new (...args: any[]) => Dependency} */ (dependency.constructor);
const template = generateContext.dependencyTemplates.get(constructor);
if (!template) {
throw new Error(

View File

@ -907,9 +907,8 @@ class ConcatenatedModule extends Module {
})
.map(connection => ({
connection,
sourceOrder:
/** @type {HarmonyImportDependency} */ (connection.dependency)
.sourceOrder
sourceOrder: /** @type {HarmonyImportDependency} */ (connection.dependency)
.sourceOrder
}));
references.sort(
concatComparators(bySourceOrder, keepOriginalOrder(references))

View File

@ -234,8 +234,7 @@ class InnerGraphPlugin {
parser.hooks.expression
.for(topLevelSymbolTag)
.tap("InnerGraphPlugin", () => {
const topLevelSymbol =
/** @type {TopLevelSymbol} */ (parser.currentTagData);
const topLevelSymbol = /** @type {TopLevelSymbol} */ (parser.currentTagData);
const currentTopLevelSymbol = InnerGraph.getTopLevelSymbol(
parser.state
);

View File

@ -185,15 +185,16 @@ class ModuleConcatenationPlugin {
);
const importingModuleTypes = new Map(
Array.from(importingModules).map(
m => /** @type {[Module, Set<string>]} */ ([
m,
new Set(
nonHarmonyConnections
.filter(c => c.originModule === m)
.map(c => c.dependency.type)
.sort()
)
])
m =>
/** @type {[Module, Set<string>]} */ ([
m,
new Set(
nonHarmonyConnections
.filter(c => c.originModule === m)
.map(c => c.dependency.type)
.sort()
)
])
)
);
const names = Array.from(importingModules)

View File

@ -1213,8 +1213,9 @@ module.exports = class SplitChunksPlugin {
minSizeValue > maxSizeValue
) {
const keys = chunkConfig && chunkConfig.keys;
const warningKey = `${keys &&
keys.join()} ${minSizeValue} ${maxSizeValue}`;
const warningKey = `${
keys && keys.join()
} ${minSizeValue} ${maxSizeValue}`;
if (!incorrectMinMaxSizeSet.has(warningKey)) {
incorrectMinMaxSizeSet.add(warningKey);
compilation.warnings.push(

View File

@ -435,8 +435,9 @@ const SIMPLE_EXTRACTORS = {
}
let message = undefined;
if (entry.type === LogType.time) {
message = `${entry.args[0]}: ${entry.args[1] * 1000 +
entry.args[2] / 1000000}ms`;
message = `${entry.args[0]}: ${
entry.args[1] * 1000 + entry.args[2] / 1000000
}ms`;
} else if (entry.args && entry.args.length > 0) {
message = util.format(entry.args[0], ...entry.args.slice(1));
}
@ -500,22 +501,22 @@ const SIMPLE_EXTRACTORS = {
compilationAuxiliaryFileToChunks.get(asset.name) || [];
object.chunkNames = uniqueOrderedArray(
chunks,
c => ((c.name ? [c.name] : [])),
c => (c.name ? [c.name] : []),
compareIds
);
object.chunkIdHints = uniqueOrderedArray(
chunks,
c => (Array.from(c.idNameHints)),
c => Array.from(c.idNameHints),
compareIds
);
object.auxiliaryChunkNames = uniqueOrderedArray(
auxiliaryChunks,
c => ((c.name ? [c.name] : [])),
c => (c.name ? [c.name] : []),
compareIds
);
object.auxiliaryChunkIdHints = uniqueOrderedArray(
auxiliaryChunks,
c => (Array.from(c.idNameHints)),
c => Array.from(c.idNameHints),
compareIds
);
object.emitted = compilation.emittedAssets.has(asset.name);
@ -986,25 +987,25 @@ const FILTER = {
}
}
},
"compilation.modules": ({
"compilation.modules": {
excludeModules: EXCLUDE_MODULES_FILTER("module"),
"!orphanModules": (module, { compilation: { chunkGraph } }) => {
if (chunkGraph.getNumberOfModuleChunks(module) === 0) return false;
},
...BASE_MODULES_FILTER
}),
"module.modules": ({
},
"module.modules": {
excludeModules: EXCLUDE_MODULES_FILTER("nested"),
...BASE_MODULES_FILTER
}),
"chunk.modules": ({
},
"chunk.modules": {
excludeModules: EXCLUDE_MODULES_FILTER("chunk"),
...BASE_MODULES_FILTER
}),
"chunk.rootModules": ({
},
"chunk.rootModules": {
excludeModules: EXCLUDE_MODULES_FILTER("root-of-chunk"),
...BASE_MODULES_FILTER
})
}
};
/** @type {Record<string, (module: Module, context: UsualContext, options: UsualOptions, idx: number, i: number) => boolean | undefined>} */

View File

@ -152,12 +152,12 @@ const DEFAULTS = {
warnings: NORMAL_ON,
publicPath: OFF_FOR_TO_STRING,
logging: ({ all }, { forToString }) =>
(forToString && all !== false ? "info" : false),
forToString && all !== false ? "info" : false,
loggingDebug: () => [],
loggingTrace: OFF_FOR_TO_STRING,
excludeModules: () => [],
excludeAssets: () => [],
maxModules: (o, { forToString }) => ((forToString ? 15 : Infinity)),
maxModules: (o, { forToString }) => (forToString ? 15 : Infinity),
modulesSort: () => "depth",
chunkModulesSort: () => "name",
chunkRootModulesSort: () => "name",

View File

@ -43,11 +43,7 @@ const printSizes = (sizes, { formatSize }) => {
}
};
const mapLines = (str, fn) =>
str
.split("\n")
.map(fn)
.join("\n");
const mapLines = (str, fn) => str.split("\n").map(fn).join("\n");
/**
* @param {number} n a number
@ -84,10 +80,10 @@ const SIMPLE_PRINTERS = {
"compilation.entrypoints": (entrypoints, context, printer) =>
Array.isArray(entrypoints)
? undefined
: printer.print(context.type, Object.values(entrypoints), ({
: printer.print(context.type, Object.values(entrypoints), {
...context,
chunkGroupKind: "Entrypoint"
})),
}),
"compilation.namedChunkGroups": (namedChunkGroups, context, printer) => {
if (!Array.isArray(namedChunkGroups)) {
const {
@ -100,10 +96,10 @@ const SIMPLE_PRINTERS = {
!Object.prototype.hasOwnProperty.call(entrypoints, group.name)
);
}
return printer.print(context.type, chunkGroups, ({
return printer.print(context.type, chunkGroups, {
...context,
chunkGroupKind: "Chunk Group"
}));
});
}
},
"compilation.assetsByChunkName": () => "",
@ -152,7 +148,7 @@ const SIMPLE_PRINTERS = {
"asset.size": (
size,
{ asset: { isOverSizeLimit }, yellow, green, formatSize }
) => ((isOverSizeLimit ? yellow(formatSize(size)) : formatSize(size))),
) => (isOverSizeLimit ? yellow(formatSize(size)) : formatSize(size)),
"asset.emitted": (emitted, { green, formatFlag }) =>
emitted ? green(formatFlag("emitted")) : undefined,
"asset.comparedForEmit": (comparedForEmit, { yellow, formatFlag }) =>
@ -167,7 +163,7 @@ const SIMPLE_PRINTERS = {
"asset.info.hotModuleReplacement": (
hotModuleReplacement,
{ green, formatFlag }
) => ((hotModuleReplacement ? green(formatFlag("hmr")) : undefined)),
) => (hotModuleReplacement ? green(formatFlag("hmr")) : undefined),
assetChunk: (id, { formatChunkId }) => formatChunkId(id),
@ -350,8 +346,7 @@ const SIMPLE_PRINTERS = {
rendered ? green(formatFlag("rendered")) : undefined,
"chunk.recorded": (recorded, { formatFlag, green }) =>
recorded ? green(formatFlag("recorded")) : undefined,
"chunk.reason": (reason, { yellow }) =>
(reason ? yellow(reason) : undefined),
"chunk.reason": (reason, { yellow }) => (reason ? yellow(reason) : undefined),
"chunk.rootModules": (modules, context) => {
let maxModuleId = 0;
for (const module of modules) {
@ -462,7 +457,7 @@ const SIMPLE_PRINTERS = {
loggingGroup: loggingGroup =>
loggingGroup.entries.length === 0 ? "" : undefined,
"loggingGroup.debug": (flag, { red }) => ((flag ? red("DEBUG") : undefined)),
"loggingGroup.debug": (flag, { red }) => (flag ? red("DEBUG") : undefined),
"loggingGroup.name": (name, { bold }) => bold(`LOG from ${name}`),
"loggingGroup.separator!": () => "\n",
"loggingGroup.filteredEntries": filteredEntries =>
@ -830,7 +825,7 @@ const SIMPLE_ELEMENT_JOINERS = {
if (maxModuleId >= 10) prefix += " ";
}
return (
(prefix +
prefix +
joinExplicitNewLine(
items.filter(item => {
switch (item.element) {
@ -846,13 +841,13 @@ const SIMPLE_ELEMENT_JOINERS = {
return true;
}),
indenter
))
)
);
},
chunk: items => {
let hasEntry = false;
return (
("chunk " +
"chunk " +
joinExplicitNewLine(
items.filter(item => {
switch (item.element) {
@ -866,7 +861,7 @@ const SIMPLE_ELEMENT_JOINERS = {
return true;
}),
" "
))
)
);
},
"chunk.childrenByOrder[]": items => `(${joinOneLine(items)})`,
@ -886,8 +881,8 @@ const SIMPLE_ELEMENT_JOINERS = {
break;
case "resolvedModule":
return (
(moduleReason.module !== moduleReason.resolvedModule &&
item.content)
moduleReason.module !== moduleReason.resolvedModule &&
item.content
);
}
return true;

View File

@ -74,7 +74,7 @@ exports.arrayToSetDeprecation = (set, name) => {
* @this {Set}
* @returns {number} count
*/
set[method] = function() {
set[method] = function () {
d();
const array = Array.from(this);
return Array.prototype[method].apply(array, arguments);
@ -97,7 +97,7 @@ exports.arrayToSetDeprecation = (set, name) => {
* @this {Set}
* @returns {number} count
*/
set.push = function() {
set.push = function () {
dPush();
for (const item of Array.from(arguments)) {
this.add(item);
@ -117,7 +117,7 @@ exports.arrayToSetDeprecation = (set, name) => {
* @this {Set} a Set
* @returns {any} the value at this location
*/
const fn = function() {
const fn = function () {
dIndexer();
let i = 0;
for (const item of this) {

View File

@ -64,8 +64,7 @@ const validateSchema = (schema, options) => {
}
if (error.keyword === "additionalProperties") {
const params =
/** @type {import("ajv").AdditionalPropertiesParams} */ (error.params);
const params = /** @type {import("ajv").AdditionalPropertiesParams} */ (error.params);
if (
Object.prototype.hasOwnProperty.call(
DID_YOU_MEAN,

View File

@ -68,7 +68,7 @@
"mini-css-extract-plugin": "^0.8.0",
"mini-svg-data-uri": "^1.1.3",
"open-cli": "^5.0.0",
"prettier": "^1.14.3",
"prettier": "2",
"pretty-format": "^25.1.0",
"pug": "^2.0.4",
"pug-loader": "^2.4.0",

View File

@ -96,11 +96,7 @@ function execGetOutput(command, args, description) {
if (exitCode) {
reject(`${description} failed with exit code ${exitCode}`);
} else {
resolve(
Buffer.concat(buffers)
.toString("utf-8")
.trim()
);
resolve(Buffer.concat(buffers).toString("utf-8").trim());
}
});
const buffers = [];

View File

@ -6,9 +6,9 @@ const asyncLib = require("neo-async");
const Benchmark = require("benchmark");
const { remove } = require("./helpers/remove");
describe("BenchmarkTestCases", function() {
describe("BenchmarkTestCases", function () {
const casesPath = path.join(__dirname, "benchmarkCases");
const tests = fs.readdirSync(casesPath).filter(function(folder) {
const tests = fs.readdirSync(casesPath).filter(function (folder) {
return (
folder.indexOf("_") < 0 &&
fs.existsSync(path.resolve(casesPath, folder, "webpack.config.js"))
@ -25,7 +25,7 @@ describe("BenchmarkTestCases", function() {
fs.mkdirSync(baselinesPath);
} catch (e) {} // eslint-disable-line no-empty
beforeAll(function(done) {
beforeAll(function (done) {
const git = require("simple-git");
const rootPath = path.join(__dirname, "..");
getBaselineRevs(rootPath, (err, baselineRevisions) => {
@ -231,7 +231,7 @@ describe("BenchmarkTestCases", function() {
const warmupCompiler = webpack(config, (err, stats) => {
warmupCompiler.purgeInputFileSystem();
const bench = new Benchmark(
function(deferred) {
function (deferred) {
const compiler = webpack(config, (err, stats) => {
compiler.purgeInputFileSystem();
if (err) {
@ -249,7 +249,7 @@ describe("BenchmarkTestCases", function() {
maxTime: 30,
defer: true,
initCount: 1,
onComplete: function() {
onComplete: function () {
const stats = bench.stats;
const n = stats.sample.length;
const nSqrt = Math.sqrt(n);
@ -276,10 +276,10 @@ describe("BenchmarkTestCases", function() {
tests.forEach(testName => {
const testDirectory = path.join(casesPath, testName);
let headStats = null;
describe(`${testName} create benchmarks`, function() {
describe(`${testName} create benchmarks`, function () {
baselines.forEach(baseline => {
let baselineStats = null;
it(`should benchmark ${baseline.name} (${baseline.rev})`, function(done) {
it(`should benchmark ${baseline.name} (${baseline.rev})`, function (done) {
const outputDirectory = path.join(
__dirname,
"js",
@ -330,7 +330,7 @@ describe("BenchmarkTestCases", function() {
}, 180000);
if (baseline.name !== "HEAD") {
it(`HEAD should not be slower than ${baseline.name} (${baseline.rev})`, function() {
it(`HEAD should not be slower than ${baseline.name} (${baseline.rev})`, function () {
if (baselineStats.maxConfidence < headStats.minConfidence) {
throw new Error(
`HEAD (${headStats.text}) is slower than ${baseline.name} (${baselineStats.text}) (90% confidence)`

View File

@ -366,7 +366,7 @@ describe("Compiler", () => {
done();
});
});
it("should not be run twice at a time (run)", function(done) {
it("should not be run twice at a time (run)", function (done) {
const compiler = webpack({
context: __dirname,
mode: "production",
@ -384,7 +384,7 @@ describe("Compiler", () => {
if (err) return done();
});
});
it("should not be run twice at a time (watch)", function(done) {
it("should not be run twice at a time (watch)", function (done) {
const compiler = webpack({
context: __dirname,
mode: "production",
@ -402,7 +402,7 @@ describe("Compiler", () => {
if (err) return done();
});
});
it("should not be run twice at a time (run - watch)", function(done) {
it("should not be run twice at a time (run - watch)", function (done) {
const compiler = webpack({
context: __dirname,
mode: "production",
@ -420,7 +420,7 @@ describe("Compiler", () => {
if (err) return done();
});
});
it("should not be run twice at a time (watch - run)", function(done) {
it("should not be run twice at a time (watch - run)", function (done) {
const compiler = webpack({
context: __dirname,
mode: "production",
@ -438,7 +438,7 @@ describe("Compiler", () => {
if (err) return done();
});
});
it("should not be run twice at a time (instance cb)", function(done) {
it("should not be run twice at a time (instance cb)", function (done) {
const compiler = webpack(
{
context: __dirname,
@ -456,7 +456,7 @@ describe("Compiler", () => {
if (err) return done();
});
});
it("should run again correctly after first compilation", function(done) {
it("should run again correctly after first compilation", function (done) {
const compiler = webpack({
context: __dirname,
mode: "production",
@ -476,7 +476,7 @@ describe("Compiler", () => {
});
});
});
it("should watch again correctly after first compilation", function(done) {
it("should watch again correctly after first compilation", function (done) {
const compiler = webpack({
context: __dirname,
mode: "production",
@ -496,7 +496,7 @@ describe("Compiler", () => {
});
});
});
it("should run again correctly after first closed watch", function(done) {
it("should run again correctly after first closed watch", function (done) {
const compiler = webpack({
context: __dirname,
mode: "production",
@ -517,7 +517,7 @@ describe("Compiler", () => {
});
});
});
it("should watch again correctly after first closed watch", function(done) {
it("should watch again correctly after first closed watch", function (done) {
const compiler = webpack({
context: __dirname,
mode: "production",
@ -538,7 +538,7 @@ describe("Compiler", () => {
});
});
});
it("should run again correctly inside afterDone hook", function(done) {
it("should run again correctly inside afterDone hook", function (done) {
const compiler = webpack({
context: __dirname,
mode: "production",
@ -562,7 +562,7 @@ describe("Compiler", () => {
if (err) return done(err);
});
});
it("should call afterDone hook after other callbacks (run)", function(done) {
it("should call afterDone hook after other callbacks (run)", function (done) {
const compiler = webpack({
context: __dirname,
mode: "production",
@ -586,7 +586,7 @@ describe("Compiler", () => {
runCb();
});
});
it("should call afterDone hook after other callbacks (instance cb)", function(done) {
it("should call afterDone hook after other callbacks (instance cb)", function (done) {
const instanceCb = jest.fn();
const compiler = webpack(
{
@ -612,7 +612,7 @@ describe("Compiler", () => {
done();
});
});
it("should call afterDone hook after other callbacks (watch)", function(done) {
it("should call afterDone hook after other callbacks (watch)", function (done) {
const compiler = webpack({
context: __dirname,
mode: "production",
@ -639,7 +639,7 @@ describe("Compiler", () => {
});
watch.invalidate(invalidateCb);
});
it("should call afterDone hook after other callbacks (watch close)", function(done) {
it("should call afterDone hook after other callbacks (watch close)", function (done) {
const compiler = webpack({
context: __dirname,
mode: "production",
@ -666,7 +666,7 @@ describe("Compiler", () => {
});
watch.invalidate(invalidateCb);
});
it("should flag watchMode as true in watch", function(done) {
it("should flag watchMode as true in watch", function (done) {
const compiler = webpack({
context: __dirname,
mode: "production",
@ -688,7 +688,7 @@ describe("Compiler", () => {
});
});
});
it("should use cache on second run call", function(done) {
it("should use cache on second run call", function (done) {
const compiler = webpack({
context: __dirname,
mode: "development",

View File

@ -43,7 +43,7 @@ describe("ConfigTestCases", () => {
categories.forEach(category => {
describe(category.name, () => {
category.tests.forEach(testName => {
describe(testName, function() {
describe(testName, function () {
const testDirectory = path.join(casesPath, category.name, testName);
const outputDirectory = path.join(
__dirname,
@ -84,7 +84,7 @@ describe("ConfigTestCases", () => {
options.output.filename = "bundle" + idx + ".js";
});
let testConfig = {
findBundle: function(i, options) {
findBundle: function (i, options) {
const ext = path.extname(options.output.filename);
if (
fs.existsSync(

View File

@ -18,7 +18,7 @@ describe("Examples", () => {
}
it(
"should compile " + relativePath,
function(done) {
function (done) {
let options = {};
let webpackConfigPath = path.join(examplePath, "webpack.config.js");
webpackConfigPath =

View File

@ -9,7 +9,7 @@ describe("JavascriptParser", () => {
/* eslint-disable no-inner-declarations */
const testCases = {
"call ident": [
function() {
function () {
abc("test");
},
{
@ -17,7 +17,7 @@ describe("JavascriptParser", () => {
}
],
"call member": [
function() {
function () {
cde.abc("membertest");
},
{
@ -25,7 +25,7 @@ describe("JavascriptParser", () => {
}
],
"call member using bracket notation": [
function() {
function () {
cde["abc"]("membertest");
},
{
@ -33,7 +33,7 @@ describe("JavascriptParser", () => {
}
],
"call inner member": [
function() {
function () {
cde.ddd.abc("inner");
},
{
@ -41,7 +41,7 @@ describe("JavascriptParser", () => {
}
],
"call inner member using bracket notation": [
function() {
function () {
cde.ddd["abc"]("inner");
},
{
@ -49,7 +49,7 @@ describe("JavascriptParser", () => {
}
],
expression: [
function() {
function () {
fgh;
},
{
@ -57,7 +57,7 @@ describe("JavascriptParser", () => {
}
],
"expression sub": [
function() {
function () {
fgh.sub;
},
{
@ -65,7 +65,7 @@ describe("JavascriptParser", () => {
}
],
"member expression": [
function() {
function () {
test[memberExpr];
test[+memberExpr];
},
@ -74,8 +74,8 @@ describe("JavascriptParser", () => {
}
],
"in function definition": [
function() {
(function(abc, cde, fgh) {
function () {
(function (abc, cde, fgh) {
abc("test");
cde.abc("test");
cde.ddd.abc("test");
@ -86,7 +86,7 @@ describe("JavascriptParser", () => {
{}
],
"const definition": [
function() {
function () {
let abc, cde, fgh;
abc("test");
cde.abc("test");
@ -97,7 +97,7 @@ describe("JavascriptParser", () => {
{}
],
"var definition": [
function() {
function () {
var abc, cde, fgh;
abc("test");
cde.abc("test");
@ -108,7 +108,7 @@ describe("JavascriptParser", () => {
{}
],
"function definition": [
function() {
function () {
function abc() {}
function cde() {}
@ -123,7 +123,7 @@ describe("JavascriptParser", () => {
{}
],
"class definition": [
function() {
function () {
class memberExpr {
cde() {
abc("cde");
@ -140,7 +140,7 @@ describe("JavascriptParser", () => {
}
],
"in try": [
function() {
function () {
try {
fgh.sub;
fgh;
@ -160,7 +160,7 @@ describe("JavascriptParser", () => {
}
],
"renaming with const": [
function() {
function () {
const xyz = abc;
xyz("test");
},
@ -169,7 +169,7 @@ describe("JavascriptParser", () => {
}
],
"renaming with var": [
function() {
function () {
var xyz = abc;
xyz("test");
},
@ -178,7 +178,7 @@ describe("JavascriptParser", () => {
}
],
"renaming with assignment": [
function() {
function () {
const xyz = abc;
xyz("test");
},
@ -187,8 +187,8 @@ describe("JavascriptParser", () => {
}
],
"renaming with IIFE": [
function() {
!(function(xyz) {
function () {
!(function (xyz) {
xyz("test");
})(abc);
},
@ -197,8 +197,8 @@ describe("JavascriptParser", () => {
}
],
"renaming arguments with IIFE (called)": [
function() {
!function(xyz) {
function () {
!function (xyz) {
xyz("test");
}.call(fgh, abc);
},
@ -208,8 +208,8 @@ describe("JavascriptParser", () => {
}
],
"renaming this's properties with IIFE (called)": [
function() {
!function() {
function () {
!function () {
this.sub;
}.call(ijk);
},
@ -218,9 +218,9 @@ describe("JavascriptParser", () => {
}
],
"renaming this's properties with nested IIFE (called)": [
function() {
!function() {
!function() {
function () {
!function () {
!function () {
this.sub;
}.call(this);
}.call(ijk);
@ -230,7 +230,7 @@ describe("JavascriptParser", () => {
}
],
"new Foo(...)": [
function() {
function () {
new xyz("membertest");
},
{
@ -238,7 +238,7 @@ describe("JavascriptParser", () => {
}
],
"spread calls/literals": [
function() {
function () {
var xyz = [...abc("xyz"), cde];
Math.max(...fgh);
},

View File

@ -19,7 +19,7 @@ const createMultiCompiler = () => {
return compiler;
};
describe("MultiCompiler", function() {
describe("MultiCompiler", function () {
jest.setTimeout(20000);
it("should trigger 'run' for each child compiler", done => {
@ -53,7 +53,7 @@ describe("MultiCompiler", function() {
});
});
it("should not be run twice at a time (run)", function(done) {
it("should not be run twice at a time (run)", function (done) {
const compiler = createMultiCompiler();
compiler.run((err, stats) => {
if (err) return done(err);
@ -62,7 +62,7 @@ describe("MultiCompiler", function() {
if (err) return done();
});
});
it("should not be run twice at a time (watch)", function(done) {
it("should not be run twice at a time (watch)", function (done) {
const compiler = createMultiCompiler();
const watcher = compiler.watch({}, (err, stats) => {
if (err) return done(err);
@ -71,7 +71,7 @@ describe("MultiCompiler", function() {
if (err) return watcher.close(done);
});
});
it("should not be run twice at a time (run - watch)", function(done) {
it("should not be run twice at a time (run - watch)", function (done) {
const compiler = createMultiCompiler();
compiler.run((err, stats) => {
if (err) return done(err);
@ -80,7 +80,7 @@ describe("MultiCompiler", function() {
if (err) return done();
});
});
it("should not be run twice at a time (watch - run)", function(done) {
it("should not be run twice at a time (watch - run)", function (done) {
const compiler = createMultiCompiler();
let watcher;
watcher = compiler.watch({}, (err, stats) => {
@ -90,7 +90,7 @@ describe("MultiCompiler", function() {
if (err) return watcher.close(done);
});
});
it("should not be run twice at a time (instance cb)", function(done) {
it("should not be run twice at a time (instance cb)", function (done) {
const compiler = webpack(
{
context: __dirname,
@ -108,7 +108,7 @@ describe("MultiCompiler", function() {
if (err) return done();
});
});
it("should run again correctly after first compilation", function(done) {
it("should run again correctly after first compilation", function (done) {
const compiler = createMultiCompiler();
compiler.run((err, stats) => {
if (err) return done(err);
@ -119,7 +119,7 @@ describe("MultiCompiler", function() {
});
});
});
it("should watch again correctly after first compilation", function(done) {
it("should watch again correctly after first compilation", function (done) {
const compiler = createMultiCompiler();
compiler.run((err, stats) => {
if (err) return done(err);
@ -131,7 +131,7 @@ describe("MultiCompiler", function() {
});
});
});
it("should run again correctly after first closed watch", function(done) {
it("should run again correctly after first closed watch", function (done) {
const compiler = createMultiCompiler();
const watching = compiler.watch({}, (err, stats) => {
if (err) return done(err);
@ -143,7 +143,7 @@ describe("MultiCompiler", function() {
});
});
});
it("should watch again correctly after first closed watch", function(done) {
it("should watch again correctly after first closed watch", function (done) {
const compiler = createMultiCompiler();
const watching = compiler.watch({}, (err, stats) => {
if (err) return done(err);

View File

@ -5,7 +5,7 @@ const fs = require("graceful-fs");
const webpack = require("../");
const rimraf = require("rimraf");
describe("Profiling Plugin", function() {
describe("Profiling Plugin", function () {
jest.setTimeout(15000);
it("should handle output path with folder creation", done => {

View File

@ -7,7 +7,7 @@ const captureStdio = require("./helpers/captureStdio");
let webpack;
describe("ProgressPlugin", function() {
describe("ProgressPlugin", function () {
let stderr;
beforeEach(() => {

View File

@ -85,7 +85,7 @@ describe("StatsTestCases", () => {
compilers.forEach(c => {
const ifs = c.inputFileSystem;
c.inputFileSystem = Object.create(ifs);
c.inputFileSystem.readFile = function() {
c.inputFileSystem.readFile = function () {
const args = Array.prototype.slice.call(arguments);
const callback = args.pop();
ifs.readFile.apply(

View File

@ -51,7 +51,7 @@ categories = categories.map(cat => {
const describeCases = config => {
describe(config.name, () => {
categories.forEach(category => {
describe(category.name, function() {
describe(category.name, function () {
jest.setTimeout(20000);
category.tests
@ -160,7 +160,7 @@ const describeCases = config => {
}
]
},
plugins: (config.plugins || []).concat(function() {
plugins: (config.plugins || []).concat(function () {
this.hooks.compilation.tap("TestCasesTest", compilation => {
[
"optimize",

View File

@ -1,3 +1,3 @@
module.exports = {
entry: "./index"
entry: "./index",
};

View File

@ -1,8 +1,8 @@
var testPlugin = function() {
var testPlugin = function () {
var counter = 1;
this.hooks.compilation.tap("TestPlugin", compilation => {
var nr = counter++;
compilation.hooks.needAdditionalPass.tap("TestPlugin", function() {
compilation.hooks.needAdditionalPass.tap("TestPlugin", function () {
if (nr < 5) return true;
});
});

View File

@ -10,7 +10,7 @@ module.exports = {
filename: "[name].js"
},
plugins: [
function() {
function () {
/**
* @param {Compilation} compilation compilation
* @returns {void}

View File

@ -6,7 +6,7 @@ module.exports = {
concatenateModules: true
},
plugins: [
function() {
function () {
this.hooks.compilation.tap(
"Test",
/**

View File

@ -6,7 +6,7 @@ module.exports = {
concatenateModules: false
},
plugins: [
function() {
function () {
this.hooks.compilation.tap("Test", compilation => {
compilation.hooks.dependencyReferencedExports.tap(
"Test",

View File

@ -15,7 +15,7 @@ module.exports = {
filename: "[name].js"
},
plugins: [
function() {
function () {
/**
* @param {Compilation} compilation compilation
* @returns {void}

View File

@ -8,7 +8,7 @@ module.exports = {
filename: "[name].js"
},
plugins: [
function() {
function () {
/**
* @param {Compilation} compilation compilation
* @returns {void}

View File

@ -1,7 +1,7 @@
module.exports = {
mode: "development",
output: {
devtoolModuleFilenameTemplate: function(info) {
devtoolModuleFilenameTemplate: function (info) {
return "dummy:///" + info.resourcePath;
}
},

View File

@ -1,6 +1,6 @@
var testPlugin = function() {
var testPlugin = function () {
this.hooks.compilation.tap("TestPlugin", compilation => {
compilation.hooks.finishModules.tapAsync("TestPlugin", function(
compilation.hooks.finishModules.tapAsync("TestPlugin", function (
_modules,
callback
) {

View File

@ -222,7 +222,7 @@ module.exports = [
}
];
module.exports.forEach(function(options) {
module.exports.forEach(function (options) {
options.plugins = options.plugins || [];
options.plugins.push(
new webpack.DefinePlugin({

View File

@ -7,8 +7,8 @@ module.exports = {
filename: "[name].js"
},
plugins: [
function() {
this.hooks.emit.tap("TestPlugin", function(compilation) {
function () {
this.hooks.emit.tap("TestPlugin", function (compilation) {
delete compilation.assets["b.js"];
});
}

View File

@ -8,7 +8,7 @@ module.exports = {
{
loader: "./loader2",
options: {
f: function() {
f: function () {
return "ok";
}
}
@ -24,7 +24,7 @@ module.exports = {
use: {
loader: "./loader2",
options: {
f: function() {
f: function () {
return "maybe";
}
}
@ -35,7 +35,7 @@ module.exports = {
use: {
loader: "./loader2",
options: {
f: function() {
f: function () {
return "yes";
}
}
@ -50,7 +50,7 @@ module.exports = {
{
loader: "./loader2",
options: {
f: function() {
f: function () {
return "ok";
}
}

View File

@ -9,7 +9,7 @@ module.exports = {
loader: "./loader2",
ident: "loader2",
options: {
f: function() {
f: function () {
return "ok";
}
}
@ -23,7 +23,7 @@ module.exports = {
{
loader: "./loader2",
options: {
f: function() {
f: function () {
return "ok";
}
}
@ -38,7 +38,7 @@ module.exports = {
test: /c\.js$/,
loader: "./loader2",
options: {
f: function() {
f: function () {
return "ok";
}
}

View File

@ -1,6 +1,6 @@
module.exports = {
module: {
noParse: function(content) {
noParse: function (content) {
return /not-parsed/.test(content);
}
}

View File

@ -9,7 +9,7 @@ module.exports = {
expect(compiler).toBeInstanceOf(Compiler);
}
},
function(compiler) {
function (compiler) {
expect(compiler).toBe(this);
expect(compiler).toBeInstanceOf(Compiler);
}

View File

@ -18,7 +18,7 @@ module.exports = {
NEGATIVE_ZER0: -0,
NEGATIVE_NUMBER: -100.25,
POSITIVE_NUMBER: +100.25,
FUNCTION: /* istanbul ignore next */ function(a) {
FUNCTION: /* istanbul ignore next */ function (a) {
return a + 1;
},
CODE: "(1+2)",
@ -26,7 +26,7 @@ module.exports = {
OBJECT: {
SUB: {
UNDEFINED: undefined,
FUNCTION: /* istanbul ignore next */ function(a) {
FUNCTION: /* istanbul ignore next */ function (a) {
return a + 1;
},
CODE: "(1+2)",
@ -42,7 +42,7 @@ module.exports = {
wurst: "suppe",
suppe: "wurst",
RUNTIMEVALUE_CALLBACK_ARGUMENT_IS_A_MODULE: DefinePlugin.runtimeValue(
function({ module }) {
function ({ module }) {
return module instanceof Module;
}
),

View File

@ -3,7 +3,7 @@ module.exports = {
rules: [
{
test: /[ab]\.js$/,
use: function(data) {
use: function (data) {
return {
loader: "./loader",
options: {

View File

@ -22,7 +22,7 @@ module.exports = {
{
loader: "./loader",
options: {
get: function() {
get: function () {
return "second-3";
}
}

View File

@ -1,6 +1,6 @@
function createFunctionArrayFromUseArray(useArray) {
return useArray.map(function(useItem) {
return function(data) {
return useArray.map(function (useItem) {
return function (data) {
return useItem;
};
});
@ -15,7 +15,7 @@ var useArray = createFunctionArrayFromUseArray([
{
loader: "./loader",
options: {
get: function() {
get: function () {
return "second-3";
}
}

View File

@ -22,7 +22,7 @@ module.exports = {
{
loader: "./loader",
options: {
get: function() {
get: function () {
return "second-3";
}
}

View File

@ -1,5 +1,5 @@
exports.default = [
function() {
function () {
return {};
}
];

View File

@ -1,5 +1,5 @@
module.exports = [
function() {
function () {
return {};
}
];

View File

@ -18,7 +18,7 @@ module.exports = {
importAwait: true
},
plugins: [
function() {
function () {
this.hooks.compilation.tap(
"Test",
/**

View File

@ -14,7 +14,7 @@ module.exports = function PluginEnvironment() {
return hookName.replace(/[A-Z]/g, c => "-" + c.toLowerCase());
}
this.getEnvironmentStub = function() {
this.getEnvironmentStub = function () {
const hooks = new Map();
return {
plugin: addEvent,
@ -49,7 +49,7 @@ module.exports = function PluginEnvironment() {
};
};
this.getEventBindings = function() {
this.getEventBindings = function () {
return events;
};
};

View File

@ -6,7 +6,7 @@ module.exports = (stdio, tty) => {
const write = stdio.write;
const isTTY = stdio.isTTY;
stdio.write = function(str) {
stdio.write = function (str) {
logs.push(str);
};
if (tty !== undefined) stdio.isTTY = tty;

View File

@ -13,7 +13,7 @@ const originalDeprecate = util.deprecate;
util.deprecate = (fn, message, code) => {
const original = originalDeprecate(fn, message, code);
return function(...args) {
return function (...args) {
if (interception) {
interception.set(`${code}: ${message}`, { code, message });
return fn.apply(this, args);

View File

@ -47,7 +47,7 @@ expect.extend({
if (process.env.ALTERNATIVE_SORT) {
const oldSort = Array.prototype.sort;
Array.prototype.sort = function(cmp) {
Array.prototype.sort = function (cmp) {
oldSort.call(this, cmp);
if (cmp) {
for (let i = 1; i < this.length; i++) {

View File

@ -5313,7 +5313,12 @@ prettier-linter-helpers@^1.0.0:
dependencies:
fast-diff "^1.1.2"
prettier@^1.14.3, prettier@^1.19.1:
prettier@2:
version "2.0.2"
resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.0.2.tgz#1ba8f3eb92231e769b7fcd7cb73ae1b6b74ade08"
integrity sha512-5xJQIPT8BraI7ZnaDwSbu5zLrB6vvi8hVV58yHQ+QK64qrY40dULy0HSRlQ2/2IdzeBpjhDkqdcFBnFeDEMVdg==
prettier@^1.19.1:
version "1.19.1"
resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.19.1.tgz#f7d7f5ff8a9cd872a7be4ca142095956a60797cb"
integrity sha512-s7PoyDv/II1ObgQunCbB9PdLmUcBZcnWOcxDh7O0N/UwDEsHyqkW+Qh28jW+mVuCdx7gLB0BotYI1Y6uI9iyew==