Skip to content

Commit

Permalink
lib,test,tools: use consistent JSDoc types
Browse files Browse the repository at this point in the history
This could be in preparation of implementing the jsdoc/check-types
ESLint rule.

PR-URL: #40989
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
  • Loading branch information
Trott authored and danielleadams committed Dec 13, 2021
1 parent e924dc7 commit f0d8743
Show file tree
Hide file tree
Showing 10 changed files with 26 additions and 26 deletions.
12 changes: 6 additions & 6 deletions lib/fs.js
Original file line number Diff line number Diff line change
Expand Up @@ -784,7 +784,7 @@ function readvSync(fd, buffers, position) {
/**
* Writes `buffer` to the specified `fd` (file descriptor).
* @param {number} fd
* @param {Buffer | TypedArray | DataView | string | Object} buffer
* @param {Buffer | TypedArray | DataView | string | object} buffer
* @param {number} [offset]
* @param {number} [length]
* @param {number} [position]
Expand Down Expand Up @@ -849,7 +849,7 @@ ObjectDefineProperty(write, internalUtil.customPromisifyArgs,
* Synchronously writes `buffer` to the
* specified `fd` (file descriptor).
* @param {number} fd
* @param {Buffer | TypedArray | DataView | string | Object} buffer
* @param {Buffer | TypedArray | DataView | string | object} buffer
* @param {number} [offset]
* @param {number} [length]
* @param {number} [position]
Expand Down Expand Up @@ -2087,7 +2087,7 @@ function writeAll(fd, isUserFd, buffer, offset, length, signal, callback) {
/**
* Asynchronously writes data to the file.
* @param {string | Buffer | URL | number} path
* @param {string | Buffer | TypedArray | DataView | Object} data
* @param {string | Buffer | TypedArray | DataView | object} data
* @param {{
* encoding?: string | null;
* mode?: number;
Expand Down Expand Up @@ -2131,7 +2131,7 @@ function writeFile(path, data, options, callback) {
/**
* Synchronously writes data to the file.
* @param {string | Buffer | URL | number} path
* @param {string | Buffer | TypedArray | DataView | Object} data
* @param {string | Buffer | TypedArray | DataView | object} data
* @param {{
* encoding?: string | null;
* mode?: number;
Expand Down Expand Up @@ -2805,7 +2805,7 @@ function copyFileSync(src, dest, mode) {
* symlink. The contents of directories will be copied recursively.
* @param {string | URL} src
* @param {string | URL} dest
* @param {Object} [options]
* @param {object} [options]
* @param {() => any} callback
* @returns {void}
*/
Expand All @@ -2827,7 +2827,7 @@ function cp(src, dest, options, callback) {
* symlink. The contents of directories will be copied recursively.
* @param {string | URL} src
* @param {string | URL} dest
* @param {Object} [options]
* @param {object} [options]
* @returns {void}
*/
function cpSync(src, dest, options) {
Expand Down
4 changes: 2 additions & 2 deletions lib/http.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,13 @@ function createServer(opts, requestListener) {
}

/**
* @typedef {Object} HTTPRequestOptions
* @typedef {object} HTTPRequestOptions
* @property {httpAgent.Agent | boolean} [agent]
* @property {string} [auth]
* @property {Function} [createConnection]
* @property {number} [defaultPort]
* @property {number} [family]
* @property {Object} [headers]
* @property {object} [headers]
* @property {number} [hints]
* @property {string} [host]
* @property {string} [hostname]
Expand Down
2 changes: 1 addition & 1 deletion lib/internal/errors.js
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,7 @@ const captureLargerStackTrace = hideStackFrames(
* The goal is to migrate them to ERR_* errors later when compatibility is
* not a concern.
*
* @param {Object} ctx
* @param {object} ctx
* @returns {Error}
*/
const uvException = hideStackFrames(function uvException(ctx) {
Expand Down
10 changes: 5 additions & 5 deletions lib/internal/modules/esm/loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,15 @@ class ESMLoader {
/**
* Prior to ESM loading. These are called once before any modules are started.
* @private
* @property {function[]} globalPreloaders First-in-first-out list of
* @property {Function[]} globalPreloaders First-in-first-out list of
* preload hooks.
*/
#globalPreloaders = [];

/**
* Phase 2 of 2 in ESM loading.
* @private
* @property {function[]} loaders First-in-first-out list of loader hooks.
* @property {Function[]} loaders First-in-first-out list of loader hooks.
*/
#loaders = [
defaultLoad,
Expand All @@ -71,7 +71,7 @@ class ESMLoader {
/**
* Phase 1 of 2 in ESM loading.
* @private
* @property {function[]} resolvers First-in-first-out list of resolver hooks
* @property {Function[]} resolvers First-in-first-out list of resolver hooks
*/
#resolvers = [
defaultResolve,
Expand Down Expand Up @@ -341,8 +341,8 @@ class ESMLoader {
* The internals of this WILL change when chaining is implemented,
* depending on the resolution/consensus from #36954
* @param {string} url The URL/path of the module to be loaded
* @param {Object} context Metadata about the module
* @returns {Object}
* @param {object} context Metadata about the module
* @returns {object}
*/
async load(url, context = {}) {
const defaultLoader = this.#loaders[0];
Expand Down
2 changes: 1 addition & 1 deletion lib/internal/source_map/source_map.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ class SourceMap {
}

/**
* @return {Object} raw source map v3 payload.
* @return {object} raw source map v3 payload.
*/
get payload() {
return cloneSourceMapV3(this.#payload);
Expand Down
2 changes: 1 addition & 1 deletion lib/internal/util/inspect.js
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ function getUserOptions(ctx, isCrossContext) {
* in the best way possible given the different types.
*
* @param {any} value The value to print out.
* @param {Object} opts Optional options object that alters the output.
* @param {object} opts Optional options object that alters the output.
*/
/* Legacy: value, showHidden, depth, colors */
function inspect(value, opts) {
Expand Down
2 changes: 1 addition & 1 deletion lib/v8.js
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ class DefaultSerializer extends Serializer {
/**
* Used to write some kind of host object, i.e. an
* object that is created by native C++ bindings.
* @param {Object} abView
* @param {object} abView
* @returns {void}
*/
_writeHostObject(abView) {
Expand Down
6 changes: 3 additions & 3 deletions test/async-hooks/hook-checks.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ const assert = require('assert');
*
* @name checkInvocations
* @function
* @param {Object} activity including timestamps for each life time event,
* @param {object} activity including timestamps for each life time event,
* i.e. init, before ...
* @param {Object} hooks the expected life time event invocations with a count
* @param {object} hooks the expected life time event invocations with a count
* indicating how often they should have been invoked,
* i.e. `{ init: 1, before: 2, after: 2 }`
* @param {String} stage the name of the stage in the test at which we are
* @param {string} stage the name of the stage in the test at which we are
* checking the invocations
*/
exports.checkInvocations = function checkInvocations(activity, hooks, stage) {
Expand Down
6 changes: 3 additions & 3 deletions tools/eslint-rules/require-common-first.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ module.exports = function(context) {

/**
* Function to check if the path is a module and return its name.
* @param {String} str The path to check
* @returns {String} module name
* @param {string} str The path to check
* @returns {string} module name
*/
function getModuleName(str) {
if (str === '../common/index.mjs') {
Expand All @@ -32,7 +32,7 @@ module.exports = function(context) {
* Function to check if a node has an argument that is a module and
* return its name.
* @param {ASTNode} node The node to check
* @returns {undefined|String} module name or undefined
* @returns {undefined | string} module name or undefined
*/
function getModuleNameFromCall(node) {
// Node has arguments and first argument is string
Expand Down
6 changes: 3 additions & 3 deletions tools/eslint-rules/required-modules.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ module.exports = function(context) {

/**
* Function to check if the path is a required module and return its name.
* @param {String} str The path to check
* @returns {undefined|String} required module name or undefined
* @param {string} str The path to check
* @returns {undefined | string} required module name or undefined
*/
function getRequiredModuleName(str) {
const match = requiredModules.find(([, test]) => {
Expand All @@ -41,7 +41,7 @@ module.exports = function(context) {
* Function to check if a node has an argument that is a required module and
* return its name.
* @param {ASTNode} node The node to check
* @returns {undefined|String} required module name or undefined
* @returns {undefined | string} required module name or undefined
*/
function getRequiredModuleNameFromCall(node) {
// Node has arguments and first argument is string
Expand Down

0 comments on commit f0d8743

Please sign in to comment.