meta: enable jsdoc/check-tag-names rule

PR-URL: https://github.com/nodejs/node/pull/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>
This commit is contained in:
Yagiz Nizipli 2025-07-18 05:28:21 -04:00 committed by GitHub
parent 036b1fd66d
commit 0fd1ecded6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
86 changed files with 495 additions and 247 deletions

View file

@ -22,6 +22,7 @@ const {
/**
* Return the named property, but only if it is an own property.
* @returns {any|undefined}
*/
function objectGetOwn(obj, prop) {
if (ObjectHasOwn(obj, prop))
@ -30,6 +31,7 @@ function objectGetOwn(obj, prop) {
/**
* Return the named options property, but only if it is an own property.
* @returns {any|undefined}
*/
function optionsGetOwn(options, longOption, prop) {
if (ObjectHasOwn(options, longOption))
@ -39,10 +41,13 @@ function optionsGetOwn(options, longOption, prop) {
/**
* Determines if the argument may be used as an option value.
* @example
* ```
* isOptionValue('V') // returns true
* isOptionValue('-v') // returns true (greedy)
* isOptionValue('--foo') // returns true (greedy)
* isOptionValue(undefined) // returns false
* ```
* @returns {boolean}
*/
function isOptionValue(value) {
if (value == null) return false;
@ -56,6 +61,7 @@ function isOptionValue(value) {
* Detect whether there is possible confusion and user may have omitted
* the option argument, like `--port --verbose` when `port` of type:string.
* In strict mode we throw errors if value is option-like.
* @returns {boolean}
*/
function isOptionLikeValue(value) {
if (value == null) return false;
@ -66,6 +72,7 @@ function isOptionLikeValue(value) {
/**
* Determines if `arg` is just a short option.
* @example '-f'
* @returns {boolean}
*/
function isLoneShortOption(arg) {
return arg.length === 2 &&
@ -76,10 +83,13 @@ function isLoneShortOption(arg) {
/**
* Determines if `arg` is a lone long option.
* @example
* ```
* isLoneLongOption('a') // returns false
* isLoneLongOption('-a') // returns false
* isLoneLongOption('--foo') // returns true
* isLoneLongOption('--foo=bar') // returns false
* ```
* @returns {boolean}
*/
function isLoneLongOption(arg) {
return arg.length > 2 &&
@ -90,8 +100,11 @@ function isLoneLongOption(arg) {
/**
* Determines if `arg` is a long option and value in the same argument.
* @example
* ```
* isLongOptionAndValue('--foo') // returns false
* isLongOptionAndValue('--foo=bar') // returns true
* ```
* @returns {boolean}
*/
function isLongOptionAndValue(arg) {
return arg.length > 2 &&
@ -107,6 +120,7 @@ function isLongOptionAndValue(arg) {
* option that takes an option-argument, should be accepted when grouped
* behind one '-' delimiter.
* @example
* ```
* isShortOptionGroup('-a', {}) // returns false
* isShortOptionGroup('-ab', {}) // returns true
* // -fb is an option and a value, not a short option group
@ -120,6 +134,8 @@ function isLongOptionAndValue(arg) {
* isShortOptionGroup('-bfb', {
* options: { f: { type: 'string' } }
* }) // returns true
* ```
* @returns {boolean}
*/
function isShortOptionGroup(arg, options) {
if (arg.length <= 2) return false;
@ -134,11 +150,14 @@ function isShortOptionGroup(arg, options) {
/**
* Determine if arg is a short string option followed by its value.
* @example
* ```
* isShortOptionAndValue('-a', {}); // returns false
* isShortOptionAndValue('-ab', {}); // returns false
* isShortOptionAndValue('-fFILE', {
* options: { foo: { short: 'f', type: 'string' }}
* }) // returns true
* ```
* @returns {boolean}
*/
function isShortOptionAndValue(arg, options) {
validateObject(options, 'options');
@ -156,10 +175,13 @@ function isShortOptionAndValue(arg, options) {
* Find the long option associated with a short option. Looks for a configured
* `short` and returns the short option itself if a long option is not found.
* @example
* ```
* findLongOptionForShort('a', {}) // returns 'a'
* findLongOptionForShort('b', {
* options: { bar: { short: 'b' } }
* }) // returns 'bar'
* ```
* @returns {boolean}
*/
function findLongOptionForShort(shortOption, options) {
validateObject(options, 'options');
@ -176,6 +198,7 @@ function findLongOptionForShort(shortOption, options) {
* @param {string} longOption - long option name e.g. 'foo'
* @param {object} optionConfig - the option configuration properties
* @param {object} values - option values returned in `values` by parseArgs
* @returns {boolean}
*/
function useDefaultValueOption(longOption, optionConfig, values) {
return objectGetOwn(optionConfig, 'default') !== undefined &&