Skip to content

Commit

Permalink
style: fix
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-akait committed Jun 11, 2024
1 parent fcdfc26 commit ab3e93b
Show file tree
Hide file tree
Showing 125 changed files with 479 additions and 496 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ jobs:
yarn --frozen-lockfile --ignore-engines
if: matrix.node-version == '10.x' || matrix.node-version == '12.x' || matrix.node-version == '14.x'
- run: |
yarn upgrade eslint-plugin-jest@~28.4.0 eslint-plugin-jsdoc@^47.0.0 husky@^8.0.3 lint-staged@^13.2.1 cspell@^6.31.1 open-cli@^7.2.0 nyc@^15.1.0
yarn upgrade eslint-plugin-jest@~28.4.0 eslint-plugin-jsdoc@^47.0.0 husky@^8.0.3 lint-staged@^13.2.1 cspell@^6.31.1 open-cli@^7.2.0 nyc@^15.1.0 @eslint/js@^8
yarn --frozen-lockfile
if: matrix.node-version == '16.x'
# Install main version of our deps
Expand Down
2 changes: 1 addition & 1 deletion bin/webpack.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ const runCli = cli => {
};

/**
* @typedef {Object} CliOption
* @typedef {object} CliOption
* @property {string} name display name
* @property {string} package npm package name
* @property {string} binName name of the executable file
Expand Down
19 changes: 0 additions & 19 deletions eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,29 +80,13 @@ module.exports = [
"jsdoc/check-alignment": "off",
"jsdoc/tag-lines": "off",
// TODO enable me
"jsdoc/check-types": "off",
// TODO enable me
"jsdoc/valid-types": "off",
// TODO remove me after switch to typescript strict mode
"jsdoc/require-jsdoc": "off",
"jsdoc/require-returns-check": "off",
// TODO remove duplication from recommended
"jsdoc/check-indentation": "error",
"jsdoc/check-param-names": "error",
"jsdoc/check-property-names": "error",
"jsdoc/check-tag-names": "error",
"jsdoc/require-hyphen-before-param-description": ["error", "never"],
"jsdoc/require-param-description": "error",
"jsdoc/require-param-name": "error",
"jsdoc/require-param-type": "error",
"jsdoc/require-param": "error",
"jsdoc/require-property": "error",
"jsdoc/require-property-name": "error",
"jsdoc/require-property-type": "error",
"jsdoc/require-property-description": "off",
"jsdoc/require-returns-description": "error",
"jsdoc/require-returns-type": "error",
"jsdoc/require-returns": "error",
// Disallow @ts-ignore directive. Use @ts-expect-error instead
"no-warning-comments": [
"error",
Expand Down Expand Up @@ -134,9 +118,6 @@ module.exports = [
inheritdoc: false,
class: "constructor"
},
preferredTypes: {
object: "Object"
},
overrideReplacesDocs: false
}
}
Expand Down
2 changes: 1 addition & 1 deletion lib/APIPlugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ function getReplacements(module, importMetaName) {
const PLUGIN_NAME = "APIPlugin";

/**
* @typedef {Object} APIPluginOptions
* @typedef {object} APIPluginOptions
* @property {boolean} [module] the output filename
*/

Expand Down
2 changes: 1 addition & 1 deletion lib/Cache.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const {
/** @typedef {import("./WebpackError")} WebpackError */

/**
* @typedef {Object} Etag
* @typedef {object} Etag
* @property {function(): string} toString
*/

Expand Down
6 changes: 3 additions & 3 deletions lib/Chunk.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,21 +38,21 @@ const { mergeRuntime } = require("./util/runtime");
const ChunkFilesSet = createArrayToSetDeprecationSet("chunk.files");

/**
* @typedef {Object} WithId an object who has an id property *
* @typedef {object} WithId an object who has an id property *
* @property {string | number} id the id of the object
*/

/**
* @deprecated
* @typedef {Object} ChunkMaps
* @typedef {object} ChunkMaps
* @property {Record<string|number, string>} hash
* @property {Record<string|number, Record<string, string>>} contentHash
* @property {Record<string|number, string>} name
*/

/**
* @deprecated
* @typedef {Object} ChunkModuleMaps
* @typedef {object} ChunkModuleMaps
* @property {Record<string|number, (string|number)[]>} id
* @property {Record<string|number, string>} hash
*/
Expand Down
2 changes: 1 addition & 1 deletion lib/ChunkGraph.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ const compareModuleIterables = compareIterables(compareModulesByIdentifier);
/** @typedef {[Module, Entrypoint | undefined]} EntryModuleWithChunkGroup */

/**
* @typedef {Object} ChunkSizeOptions
* @typedef {object} ChunkSizeOptions
* @property {number=} chunkOverhead constant overhead for a chunk
* @property {number=} entryChunkMultiplicator multiplicator for initial chunks
*/
Expand Down
2 changes: 1 addition & 1 deletion lib/ChunkGroup.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const {
/** @typedef {{module: Module, loc: DependencyLocation, request: string}} OriginRecord */

/**
* @typedef {Object} RawChunkGroupOptions
* @typedef {object} RawChunkGroupOptions
* @property {number=} preloadOrder
* @property {number=} prefetchOrder
* @property {("low" | "high" | "auto")=} fetchPriority
Expand Down
2 changes: 1 addition & 1 deletion lib/CleanPlugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const processAsyncTree = require("./util/processAsyncTree");
/** @typedef {function(IgnoreItem): void} AddToIgnoreCallback */

/**
* @typedef {Object} CleanPluginCompilationHooks
* @typedef {object} CleanPluginCompilationHooks
* @property {SyncBailHook<[string], boolean>} keep when returning true the file/directory will be kept during cleaning, returning false will clean it and ignore the following plugins and config
*/

Expand Down
44 changes: 22 additions & 22 deletions lib/Compilation.js
Original file line number Diff line number Diff line change
Expand Up @@ -168,20 +168,20 @@ const { isSourceEqual } = require("./util/source");
/** @typedef {Record<string, Source>} CompilationAssets */

/**
* @typedef {Object} AvailableModulesChunkGroupMapping
* @typedef {object} AvailableModulesChunkGroupMapping
* @property {ChunkGroup} chunkGroup
* @property {Set<Module>} availableModules
* @property {boolean} needCopy
*/

/**
* @typedef {Object} DependenciesBlockLike
* @typedef {object} DependenciesBlockLike
* @property {Dependency[]} dependencies
* @property {AsyncDependenciesBlock[]} blocks
*/

/**
* @typedef {Object} ChunkPathData
* @typedef {object} ChunkPathData
* @property {string|number} id
* @property {string=} name
* @property {string} hash
Expand All @@ -191,26 +191,26 @@ const { isSourceEqual } = require("./util/source");
*/

/**
* @typedef {Object} ChunkHashContext
* @typedef {object} ChunkHashContext
* @property {CodeGenerationResults} codeGenerationResults results of code generation
* @property {RuntimeTemplate} runtimeTemplate the runtime template
* @property {ModuleGraph} moduleGraph the module graph
* @property {ChunkGraph} chunkGraph the chunk graph
*/

/**
* @typedef {Object} RuntimeRequirementsContext
* @typedef {object} RuntimeRequirementsContext
* @property {ChunkGraph} chunkGraph the chunk graph
* @property {CodeGenerationResults} codeGenerationResults the code generation results
*/

/**
* @typedef {Object} ExecuteModuleOptions
* @typedef {object} ExecuteModuleOptions
* @property {EntryOptions=} entryOptions
*/

/**
* @typedef {Object} ExecuteModuleResult
* @typedef {object} ExecuteModuleResult
* @property {any} exports
* @property {boolean} cacheable
* @property {Map<string, { source: Source, info: AssetInfo }>} assets
Expand All @@ -221,38 +221,38 @@ const { isSourceEqual } = require("./util/source");
*/

/**
* @typedef {Object} ExecuteModuleArgument
* @typedef {object} ExecuteModuleArgument
* @property {Module} module
* @property {{ id: string, exports: any, loaded: boolean }=} moduleObject
* @property {any} preparedInfo
* @property {CodeGenerationResult} codeGenerationResult
*/

/**
* @typedef {Object} ExecuteModuleContext
* @typedef {object} ExecuteModuleContext
* @property {Map<string, { source: Source, info: AssetInfo }>} assets
* @property {Chunk} chunk
* @property {ChunkGraph} chunkGraph
* @property {function(string): any=} __webpack_require__
*/

/**
* @typedef {Object} EntryData
* @typedef {object} EntryData
* @property {Dependency[]} dependencies dependencies of the entrypoint that should be evaluated at startup
* @property {Dependency[]} includeDependencies dependencies of the entrypoint that should be included but not evaluated
* @property {EntryOptions} options options of the entrypoint
*/

/**
* @typedef {Object} LogEntry
* @typedef {object} LogEntry
* @property {string} type
* @property {any[]} args
* @property {number} time
* @property {string[]=} trace
*/

/**
* @typedef {Object} KnownAssetInfo
* @typedef {object} KnownAssetInfo
* @property {boolean=} immutable true, if the asset can be long term cached forever (contains a hash)
* @property {boolean=} minimized whether the asset is minimized
* @property {string | string[]=} fullhash the value(s) of the full hash used for this asset
Expand All @@ -270,21 +270,21 @@ const { isSourceEqual } = require("./util/source");
/** @typedef {KnownAssetInfo & Record<string, any>} AssetInfo */

/**
* @typedef {Object} Asset
* @typedef {object} Asset
* @property {string} name the filename of the asset
* @property {Source} source source of the asset
* @property {AssetInfo} info info about the asset
*/

/**
* @typedef {Object} ModulePathData
* @typedef {object} ModulePathData
* @property {string|number} id
* @property {string} hash
* @property {function(number): string=} hashWithLength
*/

/**
* @typedef {Object} PathData
* @typedef {object} PathData
* @property {ChunkGraph=} chunkGraph
* @property {string=} hash
* @property {function(number): string=} hashWithLength
Expand All @@ -302,7 +302,7 @@ const { isSourceEqual } = require("./util/source");
*/

/**
* @typedef {Object} KnownNormalizedStatsOptions
* @typedef {object} KnownNormalizedStatsOptions
* @property {string} context
* @property {RequestShortener} requestShortener
* @property {string} chunksSort
Expand Down Expand Up @@ -346,7 +346,7 @@ const { isSourceEqual } = require("./util/source");
/** @typedef {KnownNormalizedStatsOptions & Omit<StatsOptions, keyof KnownNormalizedStatsOptions> & Record<string, any>} NormalizedStatsOptions */

/**
* @typedef {Object} KnownCreateStatsOptionsContext
* @typedef {object} KnownCreateStatsOptionsContext
* @property {boolean=} forToString
*/

Expand Down Expand Up @@ -1793,7 +1793,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
}

/**
* @typedef {Object} HandleModuleCreationOptions
* @typedef {object} HandleModuleCreationOptions
* @property {ModuleFactory} factory
* @property {Dependency[]} dependencies
* @property {Module | null} originModule
Expand Down Expand Up @@ -2128,7 +2128,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
}

/**
* @param {Object} options options
* @param {object} options options
* @param {string} options.context context string path
* @param {Dependency} options.dependency dependency used to create Module chain
* @param {Partial<ModuleFactoryCreateDataContextInfo>=} options.contextInfo additional context info for the root module
Expand Down Expand Up @@ -2567,7 +2567,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
};
/**
* @param {Module} module module
* @param {Object} references references
* @param {object} references references
* @param {string | number} references.id id
* @param {Map<Module, string | number | undefined>=} references.modules modules
* @param {(string | number | null)[]=} references.blocks blocks
Expand Down Expand Up @@ -3515,7 +3515,7 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o
}

/**
* @param {Object} options options
* @param {object} options options
* @param {ChunkGraph=} options.chunkGraph the chunk graph
* @param {Iterable<Module>=} options.modules modules
* @param {Iterable<Chunk>=} options.chunks chunks
Expand Down Expand Up @@ -5343,7 +5343,7 @@ This prevents using hashes of each other and should be avoided.`);
}

/**
* @typedef {Object} FactorizeModuleOptions
* @typedef {object} FactorizeModuleOptions
* @property {ModuleProfile} currentProfile
* @property {ModuleFactory} factory
* @property {Dependency[]} dependencies
Expand Down
10 changes: 5 additions & 5 deletions lib/Compiler.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ const { isSourceEqual } = require("./util/source");
/** @typedef {import("./util/fs").WatchFileSystem} WatchFileSystem */

/**
* @typedef {Object} CompilationParams
* @typedef {object} CompilationParams
* @property {NormalModuleFactory} normalModuleFactory
* @property {ContextModuleFactory} contextModuleFactory
*/
Expand All @@ -82,7 +82,7 @@ const { isSourceEqual } = require("./util/source");
*/

/**
* @typedef {Object} AssetEmittedInfo
* @typedef {object} AssetEmittedInfo
* @property {Buffer} content
* @property {Source} source
* @property {Compilation} compilation
Expand All @@ -105,12 +105,12 @@ const isSorted = array => {
};

/**
* @param {Object<string, any>} obj an object
* @param {{[key: string]: any}} obj an object
* @param {string[]} keys the keys of the object
* @returns {Object<string, any>} the object with properties sorted by property name
* @returns {{[key: string]: any}} the object with properties sorted by property name
*/
const sortObject = (obj, keys) => {
/** @type {Object<string, any>} */
/** @type {{[key: string]: any}} */
const o = {};
for (const k of keys.sort()) {
o[k] = obj[k];
Expand Down
10 changes: 5 additions & 5 deletions lib/ConcatenationScope.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ const DEFAULT_EXPORT = "__WEBPACK_DEFAULT_EXPORT__";
const NAMESPACE_OBJECT_EXPORT = "__WEBPACK_NAMESPACE_OBJECT__";

/**
* @typedef {Object} ExternalModuleInfo
* @typedef {object} ExternalModuleInfo
* @property {number} index
* @property {Module} module
*/

/**
* @typedef {Object} ConcatenatedModuleInfo
* @typedef {object} ConcatenatedModuleInfo
* @property {number} index
* @property {Module} module
* @property {Map<string, string>} exportMap mapping from export name to symbol
Expand All @@ -31,7 +31,7 @@ const NAMESPACE_OBJECT_EXPORT = "__WEBPACK_NAMESPACE_OBJECT__";
/** @typedef {ConcatenatedModuleInfo | ExternalModuleInfo} ModuleInfo */

/**
* @typedef {Object} ModuleReferenceOptions
* @typedef {object} ModuleReferenceOptions
* @property {string[]} ids the properties/exports of the module
* @property {boolean} call true, when this referenced export is called
* @property {boolean} directImport true, when this referenced export is directly imported (not via property access)
Expand Down Expand Up @@ -114,8 +114,8 @@ class ConcatenationScope {
const asiSafeFlag = asiSafe
? "_asiSafe1"
: asiSafe === false
? "_asiSafe0"
: "";
? "_asiSafe0"

Check failure on line 117 in lib/ConcatenationScope.js

View workflow job for this annotation

GitHub Actions / lint

Insert `↹`
: "";

Check failure on line 118 in lib/ConcatenationScope.js

View workflow job for this annotation

GitHub Actions / lint

Insert `↹`
const exportData = ids
? Buffer.from(JSON.stringify(ids), "utf-8").toString("hex")
: "ns";
Expand Down

0 comments on commit ab3e93b

Please sign in to comment.