Skip to content

Commit 0c06680

Browse files
refactor: update eslint configuration
1 parent 2eb0d6a commit 0c06680

File tree

76 files changed

+249
-292
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

76 files changed

+249
-292
lines changed

examples/build-common.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,8 @@ const doCompileAndReplace = (args, prefix, callback) => {
7171

7272
try {
7373
require.resolve("webpack-cli");
74-
} catch (_err) {
75-
throw new Error("Please install webpack-cli at root.");
74+
} catch (err) {
75+
throw new Error("Please install webpack-cli at root.", { cause: err });
7676
}
7777

7878
/**

jest.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"use strict";
22

3-
/** @type {import('jest').Config} */
3+
/** @type {import("jest").Config} */
44
const config = {
55
testTimeout: 30000,
66
prettierPath: require.resolve("prettier-2"),

lib/Chunk.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ class Chunk {
207207

208208
/**
209209
* @param {Chunk} otherChunk the chunk to compare with
210-
* @returns {-1|0|1} the comparison result
210+
* @returns {-1 | 0 | 1} the comparison result
211211
*/
212212
compareTo(otherChunk) {
213213
const chunkGraph = ChunkGraph.getChunkGraphForChunk(

lib/ChunkGraph.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -873,7 +873,7 @@ class ChunkGraph {
873873
/**
874874
* @param {Chunk} chunkA first chunk
875875
* @param {Chunk} chunkB second chunk
876-
* @returns {-1|0|1} this is a comparator function like sort and returns -1, 0, or 1 based on sort order
876+
* @returns {-1 | 0 | 1} this is a comparator function like sort and returns -1, 0, or 1 based on sort order
877877
*/
878878
compareChunks(chunkA, chunkB) {
879879
const cgcA = this._getChunkGraphChunk(chunkA);

lib/ChunkGroup.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ const getArray = (set) => [...set];
4545
* A convenience method used to sort chunks based on their id's
4646
* @param {ChunkGroup} a first sorting comparator
4747
* @param {ChunkGroup} b second sorting comparator
48-
* @returns {1|0|-1} a sorting index to determine order
48+
* @returns {1 | 0 | -1} a sorting index to determine order
4949
*/
5050
const sortById = (a, b) => {
5151
if (a.id < b.id) return -1;
@@ -56,7 +56,7 @@ const sortById = (a, b) => {
5656
/**
5757
* @param {OriginRecord} a the first comparator in sort
5858
* @param {OriginRecord} b the second comparator in sort
59-
* @returns {1|-1|0} returns sorting order as index
59+
* @returns {1 | -1| 0} returns sorting order as index
6060
*/
6161
const sortOrigin = (a, b) => {
6262
const aIdent = a.module ? a.module.identifier() : "";
@@ -488,7 +488,7 @@ class ChunkGroup {
488488
* Sorting values are based off of number of chunks in ChunkGroup.
489489
* @param {ChunkGraph} chunkGraph the chunk graph
490490
* @param {ChunkGroup} otherGroup the chunkGroup to compare this against
491-
* @returns {-1|0|1} sort position for comparison
491+
* @returns {-1 | 0 | 1} sort position for comparison
492492
*/
493493
compareTo(chunkGraph, otherGroup) {
494494
if (this.chunks.length > otherGroup.chunks.length) return -1;

lib/CleanPlugin.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,7 @@ class CleanPlugin {
391391
// We assume that no external modification happens while the compiler is active
392392
// So we can store the old assets and only diff to them to avoid fs access on
393393
// incremental builds
394-
/** @type {undefined|Assets} */
394+
/** @type {undefined | Assets} */
395395
let oldAssets;
396396

397397
compiler.hooks.emit.tapAsync(

lib/Compilation.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -710,8 +710,8 @@ class Compilation {
710710
) => `Can't automatically convert plugin using Compilation.hooks.${name} to Compilation.hooks.processAssets because ${reason}.
711711
BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a single Compilation.hooks.processAssets hook.`;
712712
/**
713-
* @param {string | (import("tapable").TapOptions & { name: string; } & ProcessAssetsAdditionalOptions)} options hook options
714-
* @returns {import("tapable").TapOptions & { name: string; } & ProcessAssetsAdditionalOptions} modified options
713+
* @param {string | (import("tapable").TapOptions & { name: string } & ProcessAssetsAdditionalOptions)} options hook options
714+
* @returns {import("tapable").TapOptions & { name: string } & ProcessAssetsAdditionalOptions} modified options
715715
*/
716716
const getOptions = (options) => {
717717
if (typeof options === "string") options = { name: options };

lib/DefinePlugin.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ const createHash = require("./util/createHash");
4444
* @property {string[]=} contextDependencies
4545
* @property {string[]=} missingDependencies
4646
* @property {string[]=} buildDependencies
47-
* @property {string| (() => string)=} version
47+
* @property {string | (() => string)=} version
4848
*/
4949

5050
/** @typedef {(value: { module: NormalModule, key: string, readonly version: ValueCacheVersion }) => CodeValuePrimitive} GeneratorFn */

lib/ExternalModule.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ const RUNTIME_REQUIREMENTS_FOR_SCRIPT = new Set([RuntimeGlobals.loadScript]);
8787
const RUNTIME_REQUIREMENTS_FOR_MODULE = new Set([
8888
RuntimeGlobals.definePropertyGetters
8989
]);
90-
const EMPTY_RUNTIME_REQUIREMENTS = new Set([]);
90+
const EMPTY_RUNTIME_REQUIREMENTS = new Set();
9191

9292
/**
9393
* @param {string | string[]} variableName the variable name or path

lib/ExternalModuleFactoryPlugin.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ const { cachedSetProperty, resolveByProperty } = require("./util/cleverMerge");
2626
/** @typedef {import("./ModuleFactory").ModuleFactoryCreateDataContextInfo} ModuleFactoryCreateDataContextInfo */
2727
/** @typedef {import("./NormalModuleFactory")} NormalModuleFactory */
2828

29-
/** @typedef {((context: string, request: string, callback: (err?: Error | null, result?: string | false, resolveRequest?: import('enhanced-resolve').ResolveRequest) => void) => void)} ExternalItemFunctionDataGetResolveCallbackResult */
29+
/** @typedef {((context: string, request: string, callback: (err?: Error | null, result?: string | false, resolveRequest?: import("enhanced-resolve").ResolveRequest) => void) => void)} ExternalItemFunctionDataGetResolveCallbackResult */
3030
/** @typedef {((context: string, request: string) => Promise<string>)} ExternalItemFunctionDataGetResolveResult */
3131
/** @typedef {(options?: ResolveOptions) => ExternalItemFunctionDataGetResolveCallbackResult | ExternalItemFunctionDataGetResolveResult} ExternalItemFunctionDataGetResolve */
3232

0 commit comments

Comments
 (0)