Skip to content

Commit 324d9fc

Browse files
anonrigaduh95
authored andcommitted
meta: enable jsdoc/check-tag-names rule
PR-URL: #58521 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: LiviaMedeiros <livia@cirno.name> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
1 parent 7f654ce commit 324d9fc

Some content is hidden

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

86 files changed

+495
-247
lines changed

benchmark/common.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,7 @@ function getUrlData(withBase) {
386386
* @param {number} e The repetition of the data, as exponent of 2
387387
* @param {boolean} withBase Whether to include a base URL
388388
* @param {boolean} asUrl Whether to return the results as URL objects
389-
* @return {string[] | string[][] | URL[]}
389+
* @returns {string[] | string[][] | URL[]}
390390
*/
391391
function bakeUrlData(type, e = 0, withBase = false, asUrl = false) {
392392
let result = [];

eslint.config.mjs

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -262,17 +262,21 @@ export default [
262262
// ESLint recommended rules that we disable.
263263
'no-inner-declarations': 'off',
264264

265-
// JSDoc recommended rules that we disable.
265+
// JSDoc rules.
266266
'jsdoc/require-jsdoc': 'off',
267267
'jsdoc/require-param-description': 'off',
268-
'jsdoc/newline-after-description': 'off',
269268
'jsdoc/require-returns-description': 'off',
270-
'jsdoc/valid-types': 'off',
271-
'jsdoc/no-defaults': 'off',
269+
'jsdoc/valid-types': 'error',
270+
'jsdoc/no-defaults': 'error',
272271
'jsdoc/no-undefined-types': 'off',
273272
'jsdoc/require-param': 'off',
274-
'jsdoc/check-tag-names': 'off',
275-
'jsdoc/require-returns': 'off',
273+
'jsdoc/check-tag-names': 'error',
274+
'jsdoc/require-returns': 'error',
275+
'jsdoc/check-line-alignment': ['error', 'any', {
276+
tags: ['param', 'property', 'returns', 'file'],
277+
wrapIndent: ' ',
278+
}],
279+
'jsdoc/check-alignment': 'error',
276280

277281
// Stylistic rules.
278282
'@stylistic/js/arrow-parens': 'error',

lib/_http_common.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,8 @@ const tokenRegExp = /^[\^_`a-zA-Z\-0-9!#$%&'*+.|~]+$/;
206206
* Verifies that the given val is a valid HTTP token
207207
* per the rules defined in RFC 7230
208208
* See https://tools.ietf.org/html/rfc7230#section-3.2.6
209+
* @param {string} val
210+
* @returns {boolean}
209211
*/
210212
function checkIsHttpToken(val) {
211213
return tokenRegExp.test(val);
@@ -217,6 +219,8 @@ const headerCharRegex = /[^\t\x20-\x7e\x80-\xff]/;
217219
* field-value = *( field-content / obs-fold )
218220
* field-content = field-vchar [ 1*( SP / HTAB ) field-vchar ]
219221
* field-vchar = VCHAR / obs-text
222+
* @param {string} val
223+
* @returns {boolean}
220224
*/
221225
function checkInvalidHeaderChar(val) {
222226
return headerCharRegex.test(val);

lib/buffer.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,7 @@ function _copyActual(source, target, targetStart, sourceStart, sourceEnd) {
268268
* runtime deprecation would introduce too much breakage at this time. It's not
269269
* likely that the Buffer constructors would ever actually be removed.
270270
* Deprecation Code: DEP0005
271+
* @returns {Buffer}
271272
*/
272273
function Buffer(arg, encodingOrOffset, length) {
273274
showFlaggedDeprecation();
@@ -295,6 +296,10 @@ ObjectDefineProperty(Buffer, SymbolSpecies, {
295296
* Buffer.from(array)
296297
* Buffer.from(buffer)
297298
* Buffer.from(arrayBuffer[, byteOffset[, length]])
299+
* @param {any} value
300+
* @param {BufferEncoding|number} encodingOrOffset
301+
* @param {number} [length]
302+
* @returns {Buffer}
298303
*/
299304
Buffer.from = function from(value, encodingOrOffset, length) {
300305
if (typeof value === 'string')
@@ -391,6 +396,7 @@ ObjectSetPrototypeOf(Buffer, Uint8Array);
391396
/**
392397
* Creates a new filled Buffer instance.
393398
* alloc(size[, fill[, encoding]])
399+
* @returns {FastBuffer}
394400
*/
395401
Buffer.alloc = function alloc(size, fill, encoding) {
396402
validateNumber(size, 'size', 0, kMaxLength);
@@ -404,6 +410,7 @@ Buffer.alloc = function alloc(size, fill, encoding) {
404410
/**
405411
* Equivalent to Buffer(num), by default creates a non-zero-filled Buffer
406412
* instance. If `--zero-fill-buffers` is set, will zero-fill the buffer.
413+
* @returns {FastBuffer}
407414
*/
408415
Buffer.allocUnsafe = function allocUnsafe(size) {
409416
validateNumber(size, 'size', 0, kMaxLength);
@@ -414,6 +421,8 @@ Buffer.allocUnsafe = function allocUnsafe(size) {
414421
* Equivalent to SlowBuffer(num), by default creates a non-zero-filled
415422
* Buffer instance that is not allocated off the pre-initialized pool.
416423
* If `--zero-fill-buffers` is set, will zero-fill the buffer.
424+
* @param {number} size
425+
* @returns {FastBuffer|undefined}
417426
*/
418427
Buffer.allocUnsafeSlow = function allocUnsafeSlow(size) {
419428
validateNumber(size, 'size', 0, kMaxLength);

lib/events.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -157,8 +157,8 @@ function lazyEventEmitterAsyncResource() {
157157
}
158158

159159
/**
160-
* @param {symbol,string} event
161-
* @param {...any} args
160+
* @param {symbol|string} event
161+
* @param {any[]} args
162162
* @returns {boolean}
163163
*/
164164
emit(event, ...args) {
@@ -203,7 +203,7 @@ function lazyEventEmitterAsyncResource() {
203203
/**
204204
* Creates a new `EventEmitter` instance.
205205
* @param {{ captureRejections?: boolean; }} [opts]
206-
* @constructs {EventEmitter}
206+
* @constructs EventEmitter
207207
*/
208208
function EventEmitter(opts) {
209209
EventEmitter.init.call(this, opts);
@@ -1115,24 +1115,28 @@ function on(emitter, event, options = kEmptyObject) {
11151115
[kWatermarkData]: {
11161116
/**
11171117
* The current queue size
1118+
* @returns {number}
11181119
*/
11191120
get size() {
11201121
return size;
11211122
},
11221123
/**
11231124
* The low watermark. The emitter is resumed every time size is lower than it
1125+
* @returns {number}
11241126
*/
11251127
get low() {
11261128
return lowWatermark;
11271129
},
11281130
/**
11291131
* The high watermark. The emitter is paused every time size is higher than it
1132+
* @returns {number}
11301133
*/
11311134
get high() {
11321135
return highWatermark;
11331136
},
11341137
/**
11351138
* It checks whether the emitter is paused by the watermark controller or not
1139+
* @returns {boolean}
11361140
*/
11371141
get isPaused() {
11381142
return paused;

lib/https.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -442,7 +442,7 @@ function createConnection(...args) {
442442
* protocol?: string;
443443
* proxyEnv?: object;
444444
* }} [options]
445-
* @constructor
445+
* @class
446446
*/
447447
function Agent(options) {
448448
if (!(this instanceof Agent))

lib/internal/abort_controller.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -534,6 +534,7 @@ function transferableAbortSignal(signal) {
534534

535535
/**
536536
* Creates an AbortController with a transferable AbortSignal
537+
* @returns {AbortController}
537538
*/
538539
function transferableAbortController() {
539540
return AbortController[kMakeTransferable]();

lib/internal/async_hooks.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -449,7 +449,7 @@ function clearDefaultTriggerAsyncId() {
449449
* @template {unknown} R
450450
* @param {number} triggerAsyncId
451451
* @param { (...T: args) => R } block
452-
* @param {T} args
452+
* @param {T} args
453453
* @returns {R}
454454
*/
455455
function defaultTriggerAsyncIdScope(triggerAsyncId, block, ...args) {

lib/internal/blob.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ class Blob {
137137
* endings? : string,
138138
* type? : string,
139139
* }} [options]
140-
* @constructs {Blob}
140+
* @constructs Blob
141141
*/
142142
constructor(sources = [], options) {
143143
markTransferMode(this, true, false);

lib/internal/crypto/hash.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ const kFinalized = Symbol('kFinalized');
6969

7070
/**
7171
* @param {string} name
72+
* @returns {string}
7273
*/
7374
function normalizeAlgorithm(name) {
7475
return StringPrototypeReplace(StringPrototypeToLowerCase(name), '-', '');

0 commit comments

Comments
 (0)