eslint-plugin-jsdoc 51.4.1 → 52.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (99) hide show
  1. package/dist/alignTransform.cjs +1 -1
  2. package/dist/alignTransform.cjs.map +1 -1
  3. package/dist/generateRule.cjs +5 -5
  4. package/dist/generateRule.cjs.map +1 -1
  5. package/dist/getJsdocProcessorPlugin.cjs +8 -8
  6. package/dist/getJsdocProcessorPlugin.cjs.map +1 -1
  7. package/dist/getJsdocProcessorPlugin.d.ts +92 -0
  8. package/dist/getJsdocProcessorPlugin.d.ts.map +1 -0
  9. package/dist/iterateJsdoc.cjs +3 -3
  10. package/dist/iterateJsdoc.cjs.map +1 -1
  11. package/dist/iterateJsdoc.d.ts +462 -0
  12. package/dist/iterateJsdoc.d.ts.map +1 -0
  13. package/dist/jsdocUtils.cjs +9 -9
  14. package/dist/jsdocUtils.cjs.map +1 -1
  15. package/dist/rules/checkAlignment.cjs +1 -1
  16. package/dist/rules/checkAlignment.cjs.map +1 -1
  17. package/dist/rules/checkExamples.cjs +5 -5
  18. package/dist/rules/checkExamples.cjs.map +1 -1
  19. package/dist/rules/checkIndentation.cjs +6 -6
  20. package/dist/rules/checkIndentation.cjs.map +1 -1
  21. package/dist/rules/checkLineAlignment.cjs +3 -3
  22. package/dist/rules/checkLineAlignment.cjs.map +1 -1
  23. package/dist/rules/checkTagNames.cjs +1 -1
  24. package/dist/rules/checkTagNames.cjs.map +1 -1
  25. package/dist/rules/checkTemplateNames.cjs +1 -1
  26. package/dist/rules/checkTemplateNames.cjs.map +1 -1
  27. package/dist/rules/checkTypes.cjs +2 -2
  28. package/dist/rules/checkTypes.cjs.map +1 -1
  29. package/dist/rules/checkValues.cjs +1 -1
  30. package/dist/rules/checkValues.cjs.map +1 -1
  31. package/dist/rules/emptyTags.cjs +1 -1
  32. package/dist/rules/emptyTags.cjs.map +1 -1
  33. package/dist/rules/importsAsDependencies.cjs +2 -2
  34. package/dist/rules/importsAsDependencies.cjs.map +1 -1
  35. package/dist/rules/linesBeforeBlock.cjs +1 -1
  36. package/dist/rules/linesBeforeBlock.cjs.map +1 -1
  37. package/dist/rules/matchDescription.cjs +4 -4
  38. package/dist/rules/matchDescription.cjs.map +1 -1
  39. package/dist/rules/matchName.cjs +1 -1
  40. package/dist/rules/matchName.cjs.map +1 -1
  41. package/dist/rules/noBadBlocks.cjs +2 -2
  42. package/dist/rules/noBadBlocks.cjs.map +1 -1
  43. package/dist/rules/noBlankBlockDescriptions.cjs +2 -2
  44. package/dist/rules/noBlankBlockDescriptions.cjs.map +1 -1
  45. package/dist/rules/noDefaults.cjs +2 -2
  46. package/dist/rules/noDefaults.cjs.map +1 -1
  47. package/dist/rules/noMultiAsterisks.cjs +6 -6
  48. package/dist/rules/noMultiAsterisks.cjs.map +1 -1
  49. package/dist/rules/noUndefinedTypes.cjs +4 -4
  50. package/dist/rules/noUndefinedTypes.cjs.map +1 -1
  51. package/dist/rules/requireDescriptionCompleteSentence.cjs +21 -21
  52. package/dist/rules/requireDescriptionCompleteSentence.cjs.map +1 -1
  53. package/dist/rules/requireHyphenBeforeParamDescription.cjs +3 -3
  54. package/dist/rules/requireHyphenBeforeParamDescription.cjs.map +1 -1
  55. package/dist/rules/requireJsdoc.cjs +1 -1
  56. package/dist/rules/requireJsdoc.cjs.map +1 -1
  57. package/dist/rules/requireReturnsCheck.cjs +1 -1
  58. package/dist/rules/requireReturnsCheck.cjs.map +1 -1
  59. package/dist/rules/requireTemplate.cjs +2 -2
  60. package/dist/rules/requireTemplate.cjs.map +1 -1
  61. package/dist/rules/tagLines.cjs +2 -2
  62. package/dist/rules/tagLines.cjs.map +1 -1
  63. package/dist/rules/textEscaping.cjs +4 -4
  64. package/dist/rules/textEscaping.cjs.map +1 -1
  65. package/dist/rules/validTypes.cjs +1 -1
  66. package/dist/rules/validTypes.cjs.map +1 -1
  67. package/package.json +1 -1
  68. package/src/alignTransform.js +1 -1
  69. package/src/getJsdocProcessorPlugin.js +8 -8
  70. package/src/iterateJsdoc.js +3 -3
  71. package/src/jsdocUtils.js +9 -9
  72. package/src/rules/checkAlignment.js +1 -1
  73. package/src/rules/checkExamples.js +5 -5
  74. package/src/rules/checkIndentation.js +6 -6
  75. package/src/rules/checkLineAlignment.js +3 -3
  76. package/src/rules/checkTagNames.js +1 -1
  77. package/src/rules/checkTemplateNames.js +1 -1
  78. package/src/rules/checkTypes.js +2 -2
  79. package/src/rules/checkValues.js +1 -1
  80. package/src/rules/emptyTags.js +1 -1
  81. package/src/rules/importsAsDependencies.js +2 -2
  82. package/src/rules/linesBeforeBlock.js +1 -1
  83. package/src/rules/matchDescription.js +4 -4
  84. package/src/rules/matchName.js +1 -1
  85. package/src/rules/noBadBlocks.js +2 -2
  86. package/src/rules/noBlankBlockDescriptions.js +2 -2
  87. package/src/rules/noDefaults.js +2 -2
  88. package/src/rules/noMultiAsterisks.js +6 -6
  89. package/src/rules/noUndefinedTypes.js +4 -4
  90. package/src/rules/requireDescriptionCompleteSentence.js +21 -21
  91. package/src/rules/requireHyphenBeforeParamDescription.js +3 -3
  92. package/src/rules/requireJsdoc.js +1 -1
  93. package/src/rules/requireReturnsCheck.js +1 -1
  94. package/src/rules/requireTemplate.js +2 -2
  95. package/src/rules/tagLines.js +2 -2
  96. package/src/rules/textEscaping.js +4 -4
  97. package/src/rules/validTypes.js +1 -1
  98. package/eslint.config.js +0 -86
  99. package/pnpm-workspace.yaml +0 -3
@@ -1 +1 @@
1
- {"version":3,"file":"validTypes.cjs","names":["_iterateJsdoc","_interopRequireDefault","require","_jsdoccomment","e","__esModule","default","inlineTags","Set","jsdocTypePrattKeywords","asExpression","suppressTypes","tryParsePathIgnoreError","path","tryParse","_default","exports","iterateJsdoc","context","jsdoc","report","settings","utils","allowEmptyNamepaths","options","mode","tag","tags","validNamepathParsing","namepath","tagName","has","handled","endChar","slice","includes","startsWith","startChar","charAt","validTypeParsing","type","parsedTypes","parse","traverse","node","typ","right","meta","position","problems","length","msg","reduce","str","message","thisNamepath","getTagDescription","replace","trim","test","thatNamepath","name","value","undefined","otherModeMaps","filter","mde","map","getTagStructureForMode","tagMightHaveNamePosition","modeInfo","description","mightHaveTypePosition","tagMightHaveTypePosition","tagMustHaveNamePosition","mustHaveTypePosition","tagMustHaveTypePosition","tagMissingRequiredTypeOrNamepath","hasTypePosition","Boolean","hasNameOrNamepathPosition","tagMightHaveNamepath","parseClosureTemplateTag","inlineTag","text","namepathOrURL","iterateAllJsdocs","docs","url","schema","additionalProperties","properties","module"],"sources":["../../src/rules/validTypes.js"],"sourcesContent":["import iterateJsdoc from '../iterateJsdoc.js';\nimport {\n parse,\n traverse,\n tryParse,\n} from '@es-joy/jsdoccomment';\n\nconst inlineTags = new Set([\n 'link', 'linkcode', 'linkplain',\n 'tutorial',\n]);\n\nconst jsdocTypePrattKeywords = new Set([\n 'import',\n 'is',\n 'readonly',\n 'typeof',\n]);\n\nconst asExpression = /as\\s+/u;\n\nconst suppressTypes = new Set([\n // https://github.com/google/closure-compiler/wiki/@suppress-annotations\n // https://github.com/google/closure-compiler/blob/master/src/com/google/javascript/jscomp/parsing/ParserConfig.properties#L154\n 'accessControls',\n 'checkDebuggerStatement',\n 'checkEs5InheritanceCorrectnessConditions',\n 'checkPrototypalTypes',\n 'checkRegExp',\n 'checkTypes',\n 'checkVars',\n 'closureClassChecks',\n 'closureDepMethodUsageChecks',\n 'const',\n 'constantProperty',\n 'dangerousUnrecognizedTypeError',\n 'deprecated',\n 'duplicate',\n 'es5Strict',\n 'externsValidation',\n 'extraProvide',\n 'extraRequire',\n 'globalThis',\n 'invalidCasts',\n 'lateProvide',\n 'legacyGoogScopeRequire',\n 'lintChecks',\n 'lintVarDeclarations',\n 'messageConventions',\n 'misplacedTypeAnnotation',\n 'missingOverride',\n 'missingPolyfill',\n 'missingProperties',\n 'missingProvide',\n 'missingRequire',\n 'missingReturn',\n 'missingSourcesWarnings',\n 'moduleLoad',\n 'msgDescriptions',\n 'nonStandardJsDocs',\n 'partialAlias',\n 'polymer',\n 'reportUnknownTypes',\n 'strictCheckTypes',\n 'strictMissingProperties',\n 'strictModuleDepCheck',\n 'strictPrimitiveOperators',\n 'suspiciousCode',\n\n // Not documented in enum\n 'switch',\n 'transitionalSuspiciousCodeWarnings',\n 'undefinedNames',\n 'undefinedVars',\n 'underscore',\n 'unknownDefines',\n 'untranspilableFeatures',\n 'unusedLocalVariables',\n\n // Not documented?\n 'unusedPrivateMembers',\n 'uselessCode',\n 'useOfGoogProvide',\n 'visibility',\n 'with',\n]);\n\n/**\n * @param {string} path\n * @returns {boolean}\n */\nconst tryParsePathIgnoreError = (path) => {\n try {\n tryParse(path);\n\n return true;\n } catch {\n // Keep the original error for including the whole type\n }\n\n return false;\n};\n\n// eslint-disable-next-line complexity\nexport default iterateJsdoc(({\n context,\n jsdoc,\n report,\n settings,\n utils,\n}) => {\n const {\n allowEmptyNamepaths = false,\n } = context.options[0] || {};\n const {\n mode,\n } = settings;\n\n for (const tag of jsdoc.tags) {\n /**\n * @param {string} namepath\n * @param {string} [tagName]\n * @returns {boolean}\n */\n const validNamepathParsing = function (namepath, tagName) {\n if (\n tryParsePathIgnoreError(namepath) ||\n jsdocTypePrattKeywords.has(namepath)\n ) {\n return true;\n }\n\n let handled = false;\n\n if (tagName) {\n switch (tagName) {\n case 'memberof':\n case 'memberof!': {\n const endChar = namepath.slice(-1);\n if ([\n '#', '.', '~',\n ].includes(endChar)) {\n handled = tryParsePathIgnoreError(namepath.slice(0, -1));\n }\n\n break;\n }\n\n case 'module': case 'requires': {\n if (!namepath.startsWith('module:')) {\n handled = tryParsePathIgnoreError(`module:${namepath}`);\n }\n\n break;\n }\n\n case 'borrows': {\n const startChar = namepath.charAt(0);\n if ([\n '#', '.', '~',\n ].includes(startChar)) {\n handled = tryParsePathIgnoreError(namepath.slice(1));\n }\n }\n }\n }\n\n if (!handled) {\n report(`Syntax error in namepath: ${namepath}`, null, tag);\n\n return false;\n }\n\n return true;\n };\n\n /**\n * @param {string} type\n * @returns {boolean}\n */\n const validTypeParsing = function (type) {\n let parsedTypes;\n try {\n if (mode === 'permissive') {\n parsedTypes = tryParse(type);\n } else {\n parsedTypes = parse(type, mode);\n }\n } catch {\n report(`Syntax error in type: ${type}`, null, tag);\n\n return false;\n }\n\n if (mode === 'closure' || mode === 'typescript') {\n traverse(parsedTypes, (node) => {\n const {\n type: typ,\n } = node;\n\n if (\n (typ === 'JsdocTypeObjectField' || typ === 'JsdocTypeKeyValue') &&\n node.right?.type === 'JsdocTypeNullable' &&\n node.right?.meta?.position === 'suffix'\n ) {\n report(`Syntax error in type: ${node.right.type}`, null, tag);\n }\n });\n }\n\n return true;\n };\n\n if (tag.problems.length) {\n const msg = tag.problems.reduce((str, {\n message,\n }) => {\n return str + '; ' + message;\n }, '').slice(2);\n report(`Invalid name: ${msg}`, null, tag);\n continue;\n }\n\n if (tag.tag === 'import') {\n // A named import will look like a type, but not be valid; we also don't\n // need to check the name/namepath\n continue;\n }\n\n if (tag.tag === 'borrows') {\n const thisNamepath = /** @type {string} */ (\n utils.getTagDescription(tag)\n ).replace(asExpression, '')\n .trim();\n\n if (!asExpression.test(/** @type {string} */ (\n utils.getTagDescription(tag)\n )) || !thisNamepath) {\n report(`@borrows must have an \"as\" expression. Found \"${utils.getTagDescription(tag)}\"`, null, tag);\n\n continue;\n }\n\n if (validNamepathParsing(thisNamepath, 'borrows')) {\n const thatNamepath = tag.name;\n\n validNamepathParsing(thatNamepath);\n }\n\n continue;\n }\n\n if (tag.tag === 'suppress' && mode === 'closure') {\n let parsedTypes;\n\n try {\n parsedTypes = tryParse(tag.type);\n } catch {\n // Ignore\n }\n\n if (parsedTypes) {\n traverse(parsedTypes, (node) => {\n let type;\n if ('value' in node && typeof node.value === 'string') {\n type = node.value;\n }\n\n if (type !== undefined && !suppressTypes.has(type)) {\n report(`Syntax error in suppress type: ${type}`, null, tag);\n }\n });\n }\n }\n\n const otherModeMaps = /** @type {import('../jsdocUtils.js').ParserMode[]} */ ([\n 'jsdoc', 'typescript', 'closure', 'permissive',\n ]).filter(\n (mde) => {\n return mde !== mode;\n },\n ).map((mde) => {\n return utils.getTagStructureForMode(mde);\n });\n\n const tagMightHaveNamePosition = utils.tagMightHaveNamePosition(tag.tag, otherModeMaps);\n if (tagMightHaveNamePosition !== true && tag.name) {\n const modeInfo = tagMightHaveNamePosition === false ? '' : ` in \"${mode}\" mode`;\n report(`@${tag.tag} should not have a name${modeInfo}.`, null, tag);\n\n continue;\n }\n\n // Documentation like `@returns {@link SomeType}` is technically ambiguous. Specifically it\n // could either be intepreted as a type `\"@link SomeType\"` or a description `\"{@link SomeType}\"`.\n // However this is a good heuristic.\n if (tag.type.trim().startsWith('@')) {\n tag.description = `{${tag.type}} ${tag.description}`;\n tag.type = '';\n }\n\n const mightHaveTypePosition = utils.tagMightHaveTypePosition(tag.tag, otherModeMaps);\n if (mightHaveTypePosition !== true && tag.type) {\n const modeInfo = mightHaveTypePosition === false ? '' : ` in \"${mode}\" mode`;\n report(`@${tag.tag} should not have a bracketed type${modeInfo}.`, null, tag);\n\n continue;\n }\n\n // REQUIRED NAME\n const tagMustHaveNamePosition = utils.tagMustHaveNamePosition(tag.tag, otherModeMaps);\n\n // Don't handle `@param` here though it does require name as handled by\n // `require-param-name` (`@property` would similarly seem to require one,\n // but is handled by `require-property-name`)\n if (tagMustHaveNamePosition !== false && !tag.name && !allowEmptyNamepaths && ![\n 'arg', 'argument', 'param',\n 'prop', 'property',\n ].includes(tag.tag) &&\n (tag.tag !== 'see' || !utils.getTagDescription(tag).includes('{@link'))\n ) {\n const modeInfo = tagMustHaveNamePosition === true ? '' : ` in \"${mode}\" mode`;\n report(`Tag @${tag.tag} must have a name/namepath${modeInfo}.`, null, tag);\n\n continue;\n }\n\n // REQUIRED TYPE\n const mustHaveTypePosition = utils.tagMustHaveTypePosition(tag.tag, otherModeMaps);\n if (mustHaveTypePosition !== false && !tag.type) {\n const modeInfo = mustHaveTypePosition === true ? '' : ` in \"${mode}\" mode`;\n report(`Tag @${tag.tag} must have a type${modeInfo}.`, null, tag);\n\n continue;\n }\n\n // REQUIRED TYPE OR NAME/NAMEPATH\n const tagMissingRequiredTypeOrNamepath = utils.tagMissingRequiredTypeOrNamepath(tag, otherModeMaps);\n if (tagMissingRequiredTypeOrNamepath !== false && !allowEmptyNamepaths) {\n const modeInfo = tagMissingRequiredTypeOrNamepath === true ? '' : ` in \"${mode}\" mode`;\n report(`Tag @${tag.tag} must have either a type or namepath${modeInfo}.`, null, tag);\n\n continue;\n }\n\n // VALID TYPE\n const hasTypePosition = mightHaveTypePosition === true && Boolean(tag.type);\n if (hasTypePosition) {\n validTypeParsing(tag.type);\n }\n\n // VALID NAME/NAMEPATH\n const hasNameOrNamepathPosition = (\n tagMustHaveNamePosition !== false ||\n utils.tagMightHaveNamepath(tag.tag)\n ) && Boolean(tag.name);\n\n if (hasNameOrNamepathPosition) {\n if (mode !== 'jsdoc' && tag.tag === 'template') {\n for (const namepath of utils.parseClosureTemplateTag(tag)) {\n validNamepathParsing(namepath);\n }\n } else {\n validNamepathParsing(tag.name, tag.tag);\n }\n }\n\n for (const inlineTag of tag.inlineTags) {\n if (inlineTags.has(inlineTag.tag) && !inlineTag.text && !inlineTag.namepathOrURL) {\n report(`Inline tag \"${inlineTag.tag}\" missing content`, null, tag);\n }\n }\n }\n\n for (const inlineTag of jsdoc.inlineTags) {\n if (inlineTags.has(inlineTag.tag) && !inlineTag.text && !inlineTag.namepathOrURL) {\n report(`Inline tag \"${inlineTag.tag}\" missing content`);\n }\n }\n}, {\n iterateAllJsdocs: true,\n meta: {\n docs: {\n description: 'Requires all types to be valid JSDoc or Closure compiler types without syntax errors.',\n url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/valid-types.md#repos-sticky-header',\n },\n schema: [\n {\n additionalProperties: false,\n properties: {\n allowEmptyNamepaths: {\n default: false,\n type: 'boolean',\n },\n },\n type: 'object',\n },\n ],\n type: 'suggestion',\n },\n});\n"],"mappings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QACR;MACF,CAAC;MACDA,IAAI,EAAE;IACR,CAAC,CACF;IACDA,IAAI,EAAE;EACR;AACF,CAAC,CAAC;AAAAoD,MAAA,CAAA5E,OAAA,GAAAA,OAAA,CAAAV,OAAA","ignoreList":[]}
1
+ {"version":3,"file":"validTypes.cjs","names":["_iterateJsdoc","_interopRequireDefault","require","_jsdoccomment","e","__esModule","default","inlineTags","Set","jsdocTypePrattKeywords","asExpression","suppressTypes","tryParsePathIgnoreError","path","tryParse","_default","exports","iterateJsdoc","context","jsdoc","report","settings","utils","allowEmptyNamepaths","options","mode","tag","tags","validNamepathParsing","namepath","tagName","has","handled","endChar","slice","includes","startsWith","startChar","charAt","validTypeParsing","type","parsedTypes","parse","traverse","node","typ","right","meta","position","problems","length","msg","reduce","str","message","thisNamepath","getTagDescription","replace","trim","test","thatNamepath","name","value","undefined","otherModeMaps","filter","mde","map","getTagStructureForMode","tagMightHaveNamePosition","modeInfo","description","mightHaveTypePosition","tagMightHaveTypePosition","tagMustHaveNamePosition","mustHaveTypePosition","tagMustHaveTypePosition","tagMissingRequiredTypeOrNamepath","hasTypePosition","Boolean","hasNameOrNamepathPosition","tagMightHaveNamepath","parseClosureTemplateTag","inlineTag","text","namepathOrURL","iterateAllJsdocs","docs","url","schema","additionalProperties","properties","module"],"sources":["../../src/rules/validTypes.js"],"sourcesContent":["import iterateJsdoc from '../iterateJsdoc.js';\nimport {\n parse,\n traverse,\n tryParse,\n} from '@es-joy/jsdoccomment';\n\nconst inlineTags = new Set([\n 'link', 'linkcode', 'linkplain',\n 'tutorial',\n]);\n\nconst jsdocTypePrattKeywords = new Set([\n 'import',\n 'is',\n 'readonly',\n 'typeof',\n]);\n\nconst asExpression = /as\\s+/v;\n\nconst suppressTypes = new Set([\n // https://github.com/google/closure-compiler/wiki/@suppress-annotations\n // https://github.com/google/closure-compiler/blob/master/src/com/google/javascript/jscomp/parsing/ParserConfig.properties#L154\n 'accessControls',\n 'checkDebuggerStatement',\n 'checkEs5InheritanceCorrectnessConditions',\n 'checkPrototypalTypes',\n 'checkRegExp',\n 'checkTypes',\n 'checkVars',\n 'closureClassChecks',\n 'closureDepMethodUsageChecks',\n 'const',\n 'constantProperty',\n 'dangerousUnrecognizedTypeError',\n 'deprecated',\n 'duplicate',\n 'es5Strict',\n 'externsValidation',\n 'extraProvide',\n 'extraRequire',\n 'globalThis',\n 'invalidCasts',\n 'lateProvide',\n 'legacyGoogScopeRequire',\n 'lintChecks',\n 'lintVarDeclarations',\n 'messageConventions',\n 'misplacedTypeAnnotation',\n 'missingOverride',\n 'missingPolyfill',\n 'missingProperties',\n 'missingProvide',\n 'missingRequire',\n 'missingReturn',\n 'missingSourcesWarnings',\n 'moduleLoad',\n 'msgDescriptions',\n 'nonStandardJsDocs',\n 'partialAlias',\n 'polymer',\n 'reportUnknownTypes',\n 'strictCheckTypes',\n 'strictMissingProperties',\n 'strictModuleDepCheck',\n 'strictPrimitiveOperators',\n 'suspiciousCode',\n\n // Not documented in enum\n 'switch',\n 'transitionalSuspiciousCodeWarnings',\n 'undefinedNames',\n 'undefinedVars',\n 'underscore',\n 'unknownDefines',\n 'untranspilableFeatures',\n 'unusedLocalVariables',\n\n // Not documented?\n 'unusedPrivateMembers',\n 'uselessCode',\n 'useOfGoogProvide',\n 'visibility',\n 'with',\n]);\n\n/**\n * @param {string} path\n * @returns {boolean}\n */\nconst tryParsePathIgnoreError = (path) => {\n try {\n tryParse(path);\n\n return true;\n } catch {\n // Keep the original error for including the whole type\n }\n\n return false;\n};\n\n// eslint-disable-next-line complexity\nexport default iterateJsdoc(({\n context,\n jsdoc,\n report,\n settings,\n utils,\n}) => {\n const {\n allowEmptyNamepaths = false,\n } = context.options[0] || {};\n const {\n mode,\n } = settings;\n\n for (const tag of jsdoc.tags) {\n /**\n * @param {string} namepath\n * @param {string} [tagName]\n * @returns {boolean}\n */\n const validNamepathParsing = function (namepath, tagName) {\n if (\n tryParsePathIgnoreError(namepath) ||\n jsdocTypePrattKeywords.has(namepath)\n ) {\n return true;\n }\n\n let handled = false;\n\n if (tagName) {\n switch (tagName) {\n case 'memberof':\n case 'memberof!': {\n const endChar = namepath.slice(-1);\n if ([\n '#', '.', '~',\n ].includes(endChar)) {\n handled = tryParsePathIgnoreError(namepath.slice(0, -1));\n }\n\n break;\n }\n\n case 'module': case 'requires': {\n if (!namepath.startsWith('module:')) {\n handled = tryParsePathIgnoreError(`module:${namepath}`);\n }\n\n break;\n }\n\n case 'borrows': {\n const startChar = namepath.charAt(0);\n if ([\n '#', '.', '~',\n ].includes(startChar)) {\n handled = tryParsePathIgnoreError(namepath.slice(1));\n }\n }\n }\n }\n\n if (!handled) {\n report(`Syntax error in namepath: ${namepath}`, null, tag);\n\n return false;\n }\n\n return true;\n };\n\n /**\n * @param {string} type\n * @returns {boolean}\n */\n const validTypeParsing = function (type) {\n let parsedTypes;\n try {\n if (mode === 'permissive') {\n parsedTypes = tryParse(type);\n } else {\n parsedTypes = parse(type, mode);\n }\n } catch {\n report(`Syntax error in type: ${type}`, null, tag);\n\n return false;\n }\n\n if (mode === 'closure' || mode === 'typescript') {\n traverse(parsedTypes, (node) => {\n const {\n type: typ,\n } = node;\n\n if (\n (typ === 'JsdocTypeObjectField' || typ === 'JsdocTypeKeyValue') &&\n node.right?.type === 'JsdocTypeNullable' &&\n node.right?.meta?.position === 'suffix'\n ) {\n report(`Syntax error in type: ${node.right.type}`, null, tag);\n }\n });\n }\n\n return true;\n };\n\n if (tag.problems.length) {\n const msg = tag.problems.reduce((str, {\n message,\n }) => {\n return str + '; ' + message;\n }, '').slice(2);\n report(`Invalid name: ${msg}`, null, tag);\n continue;\n }\n\n if (tag.tag === 'import') {\n // A named import will look like a type, but not be valid; we also don't\n // need to check the name/namepath\n continue;\n }\n\n if (tag.tag === 'borrows') {\n const thisNamepath = /** @type {string} */ (\n utils.getTagDescription(tag)\n ).replace(asExpression, '')\n .trim();\n\n if (!asExpression.test(/** @type {string} */ (\n utils.getTagDescription(tag)\n )) || !thisNamepath) {\n report(`@borrows must have an \"as\" expression. Found \"${utils.getTagDescription(tag)}\"`, null, tag);\n\n continue;\n }\n\n if (validNamepathParsing(thisNamepath, 'borrows')) {\n const thatNamepath = tag.name;\n\n validNamepathParsing(thatNamepath);\n }\n\n continue;\n }\n\n if (tag.tag === 'suppress' && mode === 'closure') {\n let parsedTypes;\n\n try {\n parsedTypes = tryParse(tag.type);\n } catch {\n // Ignore\n }\n\n if (parsedTypes) {\n traverse(parsedTypes, (node) => {\n let type;\n if ('value' in node && typeof node.value === 'string') {\n type = node.value;\n }\n\n if (type !== undefined && !suppressTypes.has(type)) {\n report(`Syntax error in suppress type: ${type}`, null, tag);\n }\n });\n }\n }\n\n const otherModeMaps = /** @type {import('../jsdocUtils.js').ParserMode[]} */ ([\n 'jsdoc', 'typescript', 'closure', 'permissive',\n ]).filter(\n (mde) => {\n return mde !== mode;\n },\n ).map((mde) => {\n return utils.getTagStructureForMode(mde);\n });\n\n const tagMightHaveNamePosition = utils.tagMightHaveNamePosition(tag.tag, otherModeMaps);\n if (tagMightHaveNamePosition !== true && tag.name) {\n const modeInfo = tagMightHaveNamePosition === false ? '' : ` in \"${mode}\" mode`;\n report(`@${tag.tag} should not have a name${modeInfo}.`, null, tag);\n\n continue;\n }\n\n // Documentation like `@returns {@link SomeType}` is technically ambiguous. Specifically it\n // could either be intepreted as a type `\"@link SomeType\"` or a description `\"{@link SomeType}\"`.\n // However this is a good heuristic.\n if (tag.type.trim().startsWith('@')) {\n tag.description = `{${tag.type}} ${tag.description}`;\n tag.type = '';\n }\n\n const mightHaveTypePosition = utils.tagMightHaveTypePosition(tag.tag, otherModeMaps);\n if (mightHaveTypePosition !== true && tag.type) {\n const modeInfo = mightHaveTypePosition === false ? '' : ` in \"${mode}\" mode`;\n report(`@${tag.tag} should not have a bracketed type${modeInfo}.`, null, tag);\n\n continue;\n }\n\n // REQUIRED NAME\n const tagMustHaveNamePosition = utils.tagMustHaveNamePosition(tag.tag, otherModeMaps);\n\n // Don't handle `@param` here though it does require name as handled by\n // `require-param-name` (`@property` would similarly seem to require one,\n // but is handled by `require-property-name`)\n if (tagMustHaveNamePosition !== false && !tag.name && !allowEmptyNamepaths && ![\n 'arg', 'argument', 'param',\n 'prop', 'property',\n ].includes(tag.tag) &&\n (tag.tag !== 'see' || !utils.getTagDescription(tag).includes('{@link'))\n ) {\n const modeInfo = tagMustHaveNamePosition === true ? '' : ` in \"${mode}\" mode`;\n report(`Tag @${tag.tag} must have a name/namepath${modeInfo}.`, null, tag);\n\n continue;\n }\n\n // REQUIRED TYPE\n const mustHaveTypePosition = utils.tagMustHaveTypePosition(tag.tag, otherModeMaps);\n if (mustHaveTypePosition !== false && !tag.type) {\n const modeInfo = mustHaveTypePosition === true ? '' : ` in \"${mode}\" mode`;\n report(`Tag @${tag.tag} must have a type${modeInfo}.`, null, tag);\n\n continue;\n }\n\n // REQUIRED TYPE OR NAME/NAMEPATH\n const tagMissingRequiredTypeOrNamepath = utils.tagMissingRequiredTypeOrNamepath(tag, otherModeMaps);\n if (tagMissingRequiredTypeOrNamepath !== false && !allowEmptyNamepaths) {\n const modeInfo = tagMissingRequiredTypeOrNamepath === true ? '' : ` in \"${mode}\" mode`;\n report(`Tag @${tag.tag} must have either a type or namepath${modeInfo}.`, null, tag);\n\n continue;\n }\n\n // VALID TYPE\n const hasTypePosition = mightHaveTypePosition === true && Boolean(tag.type);\n if (hasTypePosition) {\n validTypeParsing(tag.type);\n }\n\n // VALID NAME/NAMEPATH\n const hasNameOrNamepathPosition = (\n tagMustHaveNamePosition !== false ||\n utils.tagMightHaveNamepath(tag.tag)\n ) && Boolean(tag.name);\n\n if (hasNameOrNamepathPosition) {\n if (mode !== 'jsdoc' && tag.tag === 'template') {\n for (const namepath of utils.parseClosureTemplateTag(tag)) {\n validNamepathParsing(namepath);\n }\n } else {\n validNamepathParsing(tag.name, tag.tag);\n }\n }\n\n for (const inlineTag of tag.inlineTags) {\n if (inlineTags.has(inlineTag.tag) && !inlineTag.text && !inlineTag.namepathOrURL) {\n report(`Inline tag \"${inlineTag.tag}\" missing content`, null, tag);\n }\n }\n }\n\n for (const inlineTag of jsdoc.inlineTags) {\n if (inlineTags.has(inlineTag.tag) && !inlineTag.text && !inlineTag.namepathOrURL) {\n report(`Inline tag \"${inlineTag.tag}\" missing content`);\n }\n }\n}, {\n iterateAllJsdocs: true,\n meta: {\n docs: {\n description: 'Requires all types to be valid JSDoc or Closure compiler types without syntax errors.',\n url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/valid-types.md#repos-sticky-header',\n },\n schema: [\n {\n additionalProperties: false,\n properties: {\n allowEmptyNamepaths: {\n default: false,\n type: 'boolean',\n },\n },\n type: 'object',\n },\n ],\n type: 'suggestion',\n },\n});\n"],"mappings":";;;;;;AAAA,IAAAA,aAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,aAAA,GAAAD,OAAA;AAI8B,SAAAD,uBAAAG,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAE9B,MAAMG,UAAU,GAAG,IAAIC,GAAG,CAAC,CACzB,MAAM,EAAE,UAAU,EAAE,WAAW,EAC/B,UAAU,CACX,CAAC;AAEF,MAAMC,sBAAsB,GAAG,IAAID,GAAG,CAAC,CACrC,QAAQ,EACR,IAAI,EACJ,UAAU,EACV,QAAQ,CACT,CAAC;AAEF,MAAME,YAAY,GAAG,QAAQ;AAE7B,MAAMC,aAAa,GAAG,IAAIH,GAAG,CAAC;AAC5B;AACA;AACA,gBAAgB,EAChB,wBAAwB,EACxB,0CAA0C,EAC1C,sBAAsB,EACtB,aAAa,EACb,YAAY,EACZ,WAAW,EACX,oBAAoB,EACpB,6BAA6B,EAC7B,OAAO,EACP,kBAAkB,EAClB,gCAAgC,EAChC,YAAY,EACZ,WAAW,EACX,WAAW,EACX,mBAAmB,EACnB,cAAc,EACd,cAAc,EACd,YAAY,EACZ,cAAc,EACd,aAAa,EACb,wBA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wB,GAAG,CAACoD,SAAS,CAACzD,GAAG,CAAC,IAAI,CAACyD,SAAS,CAACC,IAAI,IAAI,CAACD,SAAS,CAACE,aAAa,EAAE;MAChFjE,MAAM,CAAC,eAAe+D,SAAS,CAACzD,GAAG,mBAAmB,CAAC;IACzD;EACF;AACF,CAAC,EAAE;EACD4D,gBAAgB,EAAE,IAAI;EACtBvC,IAAI,EAAE;IACJwC,IAAI,EAAE;MACJhB,WAAW,EAAE,uFAAuF;MACpGiB,GAAG,EAAE;IACP,CAAC;IACDC,MAAM,EAAE,CACN;MACEC,oBAAoB,EAAE,KAAK;MAC3BC,UAAU,EAAE;QACVpE,mBAAmB,EAAE;UACnBjB,OAAO,EAAE,KAAK;UACdkC,IAAI,EAAE;QACR;MACF,CAAC;MACDA,IAAI,EAAE;IACR,CAAC,CACF;IACDA,IAAI,EAAE;EACR;AACF,CAAC,CAAC;AAAAoD,MAAA,CAAA5E,OAAA,GAAAA,OAAA,CAAAV,OAAA","ignoreList":[]}
package/package.json CHANGED
@@ -160,5 +160,5 @@
160
160
  "test-cov": "cross-env TIMING=1 c8 --reporter text npm run test-no-cov",
161
161
  "test-index": "npm run test-no-cov -- test/rules/index.js"
162
162
  },
163
- "version": "51.4.1"
163
+ "version": "52.0.1"
164
164
  }
@@ -308,7 +308,7 @@ const alignTransform = ({
308
308
  }
309
309
 
310
310
  const postHyphenSpacing = customSpacings?.postHyphen ?? 1;
311
- const hyphenSpacing = /^\s*-\s+/u;
311
+ const hyphenSpacing = /^\s*-\s+/v;
312
312
  tokens.description = tokens.description.replace(
313
313
  hyphenSpacing, '-' + ''.padStart(postHyphenSpacing, ' '),
314
314
  );
@@ -30,14 +30,14 @@ const preTagSpaceLength = 1;
30
30
  // If a space is present, we should ignore it
31
31
  const firstLinePrefixLength = preTagSpaceLength;
32
32
 
33
- const hasCaptionRegex = /^\s*<caption>([\s\S]*?)<\/caption>/u;
33
+ const hasCaptionRegex = /^\s*<caption>([\s\S]*?)<\/caption>/v;
34
34
 
35
35
  /**
36
36
  * @param {string} str
37
37
  * @returns {string}
38
38
  */
39
39
  const escapeStringRegexp = (str) => {
40
- return str.replaceAll(/[.*+?^${}()|[\]\\]/gu, '\\$&');
40
+ return str.replaceAll(/[.*+?^$\{\}\(\)\|\[\]\\]/gv, '\\$&');
41
41
  };
42
42
 
43
43
  /**
@@ -46,7 +46,7 @@ const escapeStringRegexp = (str) => {
46
46
  * @returns {import('./iterateJsdoc.js').Integer}
47
47
  */
48
48
  const countChars = (str, ch) => {
49
- return (str.match(new RegExp(escapeStringRegexp(ch), 'gu')) || []).length;
49
+ return (str.match(new RegExp(escapeStringRegexp(ch), 'gv')) || []).length;
50
50
  };
51
51
 
52
52
  /**
@@ -221,7 +221,7 @@ export const getJsdocProcessorPlugin = (options = {}) => {
221
221
  string,
222
222
  }) {
223
223
  const src = paddedIndent ?
224
- string.replaceAll(new RegExp(`(^|\n) {${paddedIndent}}(?!$)`, 'gu'), '\n') :
224
+ string.replaceAll(new RegExp(`(^|\n) {${paddedIndent}}(?!$)`, 'gv'), '\n') :
225
225
  string;
226
226
 
227
227
  // Programmatic ESLint API: https://eslint.org/docs/developer-guide/nodejs-api
@@ -274,7 +274,7 @@ export const getJsdocProcessorPlugin = (options = {}) => {
274
274
  let defaultFileName;
275
275
  if (!filename) {
276
276
  if (typeof jsFileName === 'string' && jsFileName.includes('.')) {
277
- defaultFileName = jsFileName.replace(/\.[^.]*$/u, `.${ext}`);
277
+ defaultFileName = jsFileName.replace(/\.[^.]*$/v, `.${ext}`);
278
278
  } else {
279
279
  defaultFileName = `dummy.${ext}`;
280
280
  }
@@ -376,7 +376,7 @@ export const getJsdocProcessorPlugin = (options = {}) => {
376
376
 
377
377
  // If `allowedLanguagesToProcess` is falsy, all languages should be processed.
378
378
  if (allowedLanguagesToProcess) {
379
- const matches = (/^\s*```(?<language>\S+)([\s\S]*)```\s*$/u).exec(source);
379
+ const matches = (/^\s*```(?<language>\S+)([\s\S]*)```\s*$/v).exec(source);
380
380
  if (matches?.groups && !allowedLanguagesToProcess.includes(
381
381
  matches.groups.language.toLowerCase(),
382
382
  )) {
@@ -602,7 +602,7 @@ export const getJsdocProcessorPlugin = (options = {}) => {
602
602
  */
603
603
  (ast).comments
604
604
  ).filter((comment) => {
605
- return (/^\*\s/u).test(comment.value);
605
+ return (/^\*\s/v).test(comment.value);
606
606
  }).map((comment) => {
607
607
  const [
608
608
  start,
@@ -615,7 +615,7 @@ export const getJsdocProcessorPlugin = (options = {}) => {
615
615
  cols,
616
616
  ] = getLinesCols(textToStart);
617
617
 
618
- // const lines = [...textToStart.matchAll(/\n/gu)].length
618
+ // const lines = [...textToStart.matchAll(/\n/gv)].length
619
619
  // const lastLinePos = textToStart.lastIndexOf('\n');
620
620
  // const cols = lastLinePos === -1
621
621
  // ? 0
@@ -756,7 +756,7 @@ const getUtils = (
756
756
  const text = sourceCode.getText();
757
757
  const lastLineBreakPos = text.slice(
758
758
  0, jsdocNode.range[0],
759
- ).search(/\n[ \t]*$/u);
759
+ ).search(/\n[ \t]*$/v);
760
760
  if (lastLineBreakPos > -1) {
761
761
  return fixer.removeRange([
762
762
  lastLineBreakPos, jsdocNode.range[1],
@@ -764,7 +764,7 @@ const getUtils = (
764
764
  }
765
765
 
766
766
  return fixer.removeRange(
767
- (/\s/u).test(text.charAt(jsdocNode.range[1])) ?
767
+ (/\s/v).test(text.charAt(jsdocNode.range[1])) ?
768
768
  [
769
769
  jsdocNode.range[0], jsdocNode.range[1] + 1,
770
770
  ] :
@@ -2118,7 +2118,7 @@ const iterateAllJsdocs = (iterator, ruleConfig, contexts, additiveCommentContext
2118
2118
  const utils = getBasicUtils(context, /** @type {Settings} */ (settings));
2119
2119
  for (const jsdocNode of jsdocNodes) {
2120
2120
  const jsdocNde = /** @type {unknown} */ (jsdocNode);
2121
- if (!(/^\/\*\*\s/u).test(sourceCode.getText(
2121
+ if (!(/^\/\*\*\s/v).test(sourceCode.getText(
2122
2122
  /** @type {import('estree').Node} */
2123
2123
  (jsdocNde),
2124
2124
  ))) {
package/src/jsdocUtils.js CHANGED
@@ -647,12 +647,12 @@ const getPreferredTagNameSimple = (
647
647
  value,
648
648
  ]) => {
649
649
  return [
650
- key.replace(/^tag /u, ''), value,
650
+ key.replace(/^tag /v, ''), value,
651
651
  ];
652
652
  }),
653
653
  );
654
654
 
655
- if (Object.prototype.hasOwnProperty.call(tagPreferenceFixed, name)) {
655
+ if (Object.hasOwn(tagPreferenceFixed, name)) {
656
656
  return tagPreferenceFixed[name];
657
657
  }
658
658
 
@@ -1480,7 +1480,7 @@ const hasThrowValue = (node, innerFunction) => {
1480
1480
  */
1481
1481
  /*
1482
1482
  const isInlineTag = (tag) => {
1483
- return /^(@link|@linkcode|@linkplain|@tutorial) /u.test(tag);
1483
+ return /^(@link|@linkcode|@linkplain|@tutorial) /v.test(tag);
1484
1484
  };
1485
1485
  */
1486
1486
 
@@ -1495,7 +1495,7 @@ const parseClosureTemplateTag = (tag) => {
1495
1495
  return tag.name
1496
1496
  .split(',')
1497
1497
  .map((type) => {
1498
- return type.trim().replace(/^\[?(?<name>.*?)=.*$/u, '$<name>');
1498
+ return type.trim().replace(/^\[?(?<name>.*?)=.*$/v, '$<name>');
1499
1499
  });
1500
1500
  };
1501
1501
 
@@ -1649,7 +1649,7 @@ const getTagsByType = (context, mode, tags) => {
1649
1649
  * @returns {string}
1650
1650
  */
1651
1651
  const getIndent = (sourceCode) => {
1652
- return (sourceCode.text.match(/^\n*([ \t]+)/u)?.[1] ?? '') + ' ';
1652
+ return (sourceCode.text.match(/^\n*([ \t]+)/v)?.[1] ?? '') + ' ';
1653
1653
  };
1654
1654
 
1655
1655
  /**
@@ -1789,7 +1789,7 @@ const exemptSpeciaMethods = (jsdoc, node, context, schema) => {
1789
1789
  * @returns {string}
1790
1790
  */
1791
1791
  const dropPathSegmentQuotes = (str) => {
1792
- return str.replaceAll(/\.(['"])(.*)\1/gu, '.$2');
1792
+ return str.replaceAll(/\.(['"])(.*)\1/gv, '.$2');
1793
1793
  };
1794
1794
 
1795
1795
  /**
@@ -1822,8 +1822,8 @@ const pathDoesNotBeginWith = (name, otherPathName) => {
1822
1822
  * @returns {RegExp}
1823
1823
  */
1824
1824
  const getRegexFromString = (regexString, requiredFlags) => {
1825
- const match = regexString.match(/^\/(.*)\/([gimyus]*)$/us);
1826
- let flags = 'u';
1825
+ const match = regexString.match(/^\/(.*)\/([gimyvus]*)$/vs);
1826
+ let flags = 'v';
1827
1827
  let regex = regexString;
1828
1828
  if (match) {
1829
1829
  [
@@ -1831,7 +1831,7 @@ const getRegexFromString = (regexString, requiredFlags) => {
1831
1831
  flags,
1832
1832
  ] = match;
1833
1833
  if (!flags) {
1834
- flags = 'u';
1834
+ flags = 'v';
1835
1835
  }
1836
1836
  }
1837
1837
 
@@ -5,7 +5,7 @@ import iterateJsdoc from '../iterateJsdoc.js';
5
5
  * @returns {string}
6
6
  */
7
7
  const trimStart = (string) => {
8
- return string.replace(/^\s+/u, '');
8
+ return string.replace(/^\s+/v, '');
9
9
  };
10
10
 
11
11
  export default iterateJsdoc(({
@@ -16,14 +16,14 @@ const preTagSpaceLength = 1;
16
16
  // If a space is present, we should ignore it
17
17
  const firstLinePrefixLength = preTagSpaceLength;
18
18
 
19
- const hasCaptionRegex = /^\s*<caption>([\s\S]*?)<\/caption>/u;
19
+ const hasCaptionRegex = /^\s*<caption>([\s\S]*?)<\/caption>/v;
20
20
 
21
21
  /**
22
22
  * @param {string} str
23
23
  * @returns {string}
24
24
  */
25
25
  const escapeStringRegexp = (str) => {
26
- return str.replaceAll(/[.*+?^${}()|[\]\\]/gu, '\\$&');
26
+ return str.replaceAll(/[.*+?^$\{\}\(\)\|\[\]\\]/gv, '\\$&');
27
27
  };
28
28
 
29
29
  /**
@@ -32,7 +32,7 @@ const escapeStringRegexp = (str) => {
32
32
  * @returns {import('../iterateJsdoc.js').Integer}
33
33
  */
34
34
  const countChars = (str, ch) => {
35
- return (str.match(new RegExp(escapeStringRegexp(ch), 'gu')) || []).length;
35
+ return (str.match(new RegExp(escapeStringRegexp(ch), 'gv')) || []).length;
36
36
  };
37
37
 
38
38
  /** @type {import('eslint').Linter.RulesRecord} */
@@ -244,7 +244,7 @@ export default iterateJsdoc(({
244
244
  const cliConfigStr = JSON.stringify(cliConfig);
245
245
 
246
246
  const src = paddedIndent ?
247
- string.replaceAll(new RegExp(`(^|\n) {${paddedIndent}}(?!$)`, 'gu'), '\n') :
247
+ string.replaceAll(new RegExp(`(^|\n) {${paddedIndent}}(?!$)`, 'gv'), '\n') :
248
248
  string;
249
249
 
250
250
  // Programmatic ESLint API: https://eslint.org/docs/developer-guide/nodejs-api
@@ -345,7 +345,7 @@ export default iterateJsdoc(({
345
345
  if (!filename) {
346
346
  const jsFileName = context.getFilename();
347
347
  if (typeof jsFileName === 'string' && jsFileName.includes('.')) {
348
- defaultFileName = jsFileName.replace(/\.[^.]*$/u, `.${ext}`);
348
+ defaultFileName = jsFileName.replace(/\.[^.]*$/v, `.${ext}`);
349
349
  } else {
350
350
  defaultFileName = `dummy.${ext}`;
351
351
  }
@@ -6,10 +6,10 @@ import iterateJsdoc from '../iterateJsdoc.js';
6
6
  * @returns {string}
7
7
  */
8
8
  const maskExcludedContent = (str, excludeTags) => {
9
- const regContent = new RegExp(`([ \\t]+\\*)[ \\t]@(?:${excludeTags.join('|')})(?=[ \\n])([\\w|\\W]*?\\n)(?=[ \\t]*\\*(?:[ \\t]*@\\w+\\s|\\/))`, 'gu');
9
+ const regContent = new RegExp(`([ \\t]+\\*)[ \\t]@(?:${excludeTags.join('|')})(?=[ \\n])([\\w\\|\\W]*?\\n)(?=[ \\t]*\\*(?:[ \\t]*@\\w+\\s|\\/))`, 'gv');
10
10
 
11
11
  return str.replace(regContent, (_match, margin, code) => {
12
- return (margin + '\n').repeat(code.match(/\n/gu).length);
12
+ return (margin + '\n').repeat(code.match(/\n/gv).length);
13
13
  });
14
14
  };
15
15
 
@@ -18,10 +18,10 @@ const maskExcludedContent = (str, excludeTags) => {
18
18
  * @returns {string}
19
19
  */
20
20
  const maskCodeBlocks = (str) => {
21
- const regContent = /([ \t]+\*)[ \t]```[^\n]*?([\w|\W]*?\n)(?=[ \t]*\*(?:[ \t]*(?:```|@\w+\s)|\/))/gu;
21
+ const regContent = /([ \t]+\*)[ \t]```[^\n]*?([\w\|\W]*?\n)(?=[ \t]*\*(?:[ \t]*(?:```|@\w+\s)|\/))/gv;
22
22
 
23
23
  return str.replaceAll(regContent, (_match, margin, code) => {
24
- return (margin + '\n').repeat(code.match(/\n/gu).length);
24
+ return (margin + '\n').repeat(code.match(/\n/gv).length);
25
25
  });
26
26
  };
27
27
 
@@ -38,12 +38,12 @@ export default iterateJsdoc(({
38
38
  ],
39
39
  } = options;
40
40
 
41
- const reg = /^(?:\/?\**|[ \t]*)\*[ \t]{2}/gmu;
41
+ const reg = /^(?:\/?\**|[ \t]*)\*[ \t]{2}/gmv;
42
42
  const textWithoutCodeBlocks = maskCodeBlocks(sourceCode.getText(jsdocNode));
43
43
  const text = excludeTags.length ? maskExcludedContent(textWithoutCodeBlocks, excludeTags) : textWithoutCodeBlocks;
44
44
 
45
45
  if (reg.test(text)) {
46
- const lineBreaks = text.slice(0, reg.lastIndex).match(/\n/gu) || [];
46
+ const lineBreaks = text.slice(0, reg.lastIndex).match(/\n/gv) || [];
47
47
  report('There must be no indentation.', null, {
48
48
  line: lineBreaks.length,
49
49
  });
@@ -93,8 +93,8 @@ const checkNotAlignedPerTag = (utils, tag, customSpacings) => {
93
93
  };
94
94
 
95
95
  const postHyphenSpacing = customSpacings?.postHyphen ?? 1;
96
- const exactHyphenSpacing = new RegExp(`^\\s*-\\s{${postHyphenSpacing},${postHyphenSpacing}}(?!\\s)`, 'u');
97
- const hasNoHyphen = !(/^\s*-(?!$)(?=\s)/u).test(tokens.description);
96
+ const exactHyphenSpacing = new RegExp(`^\\s*-\\s{${postHyphenSpacing},${postHyphenSpacing}}(?!\\s)`, 'v');
97
+ const hasNoHyphen = !(/^\s*-(?!$)(?=\s)/v).test(tokens.description);
98
98
  const hasExactHyphenSpacing = exactHyphenSpacing.test(
99
99
  tokens.description,
100
100
  );
@@ -144,7 +144,7 @@ const checkNotAlignedPerTag = (utils, tag, customSpacings) => {
144
144
  }
145
145
 
146
146
  if (!hasExactHyphenSpacing) {
147
- const hyphenSpacing = /^\s*-\s+/u;
147
+ const hyphenSpacing = /^\s*-\s+/v;
148
148
  tokens.description = tokens.description.replace(
149
149
  hyphenSpacing, '-' + ''.padStart(postHyphenSpacing, ' '),
150
150
  );
@@ -267,7 +267,7 @@ export default iterateJsdoc(({
267
267
  if (preferredTagName !== tagName) {
268
268
  report(message, (fixer) => {
269
269
  const replacement = sourceCode.getText(jsdocNode).replace(
270
- new RegExp(`@${escapeStringRegexp(tagName)}\\b`, 'u'),
270
+ new RegExp(`@${escapeStringRegexp(tagName)}\\b`, 'v'),
271
271
  `@${preferredTagName}`,
272
272
  );
273
273
 
@@ -73,7 +73,7 @@ export default iterateJsdoc(({
73
73
  const {
74
74
  name,
75
75
  } = tag;
76
- const names = name.split(/,\s*/u);
76
+ const names = name.split(/,\s*/v);
77
77
  for (const nme of names) {
78
78
  if (!usedNames.has(nme)) {
79
79
  report(`@template ${nme} not in use`, null, tag);
@@ -43,7 +43,7 @@ const adjustNames = (type, preferred, isGenericMatch, typeNodeName, node, parent
43
43
  parentMeta.dot = false;
44
44
  ret = 'Array';
45
45
  } else {
46
- const dotBracketEnd = preferred.match(/\.(?:<>)?$/u);
46
+ const dotBracketEnd = preferred.match(/\.(?:<>)?$/v);
47
47
  if (dotBracketEnd) {
48
48
  parentMeta.brackets = 'angle';
49
49
  parentMeta.dot = true;
@@ -69,7 +69,7 @@ const adjustNames = (type, preferred, isGenericMatch, typeNodeName, node, parent
69
69
 
70
70
  /** @type {import('jsdoc-type-pratt-parser').NameResult} */ (
71
71
  node
72
- ).value = ret.replace(/(?:\.|<>|\.<>|\[\])$/u, '');
72
+ ).value = ret.replace(/(?:\.|<>|\.<>|\[\])$/v, '');
73
73
 
74
74
  // For bare pseudo-types like `<>`
75
75
  if (!ret) {
@@ -29,7 +29,7 @@ export default iterateJsdoc(({
29
29
  const {
30
30
  allowedAuthors = null,
31
31
  allowedLicenses = null,
32
- licensePattern = '/([^\n\r]*)/gu',
32
+ licensePattern = '/([^\n\r]*)/gv',
33
33
  numericOnlyVariation = false,
34
34
  } = options;
35
35
 
@@ -53,7 +53,7 @@ export default iterateJsdoc(({
53
53
  const content = tag.name || tag.description || tag.type;
54
54
  if (content.trim() && (
55
55
  // Allow for JSDoc-block final asterisks
56
- key !== emptyTags.length - 1 || !(/^\s*\*+$/u).test(content)
56
+ key !== emptyTags.length - 1 || !(/^\s*\*+$/v).test(content)
57
57
  )) {
58
58
  const fix = () => {
59
59
  // By time of call in fixer, `tag` will have `line` added
@@ -83,10 +83,10 @@ export default iterateJsdoc(({
83
83
 
84
84
  if (nde.type === 'JsdocTypeImport') {
85
85
  let mod = nde.element.value.replace(
86
- /^(@[^/]+\/[^/]+|[^/]+).*$/u, '$1',
86
+ /^(@[^\/]+\/[^\/]+|[^\/]+).*$/v, '$1',
87
87
  );
88
88
 
89
- if ((/^[./]/u).test(mod)) {
89
+ if ((/^[.\/]/v).test(mod)) {
90
90
  return;
91
91
  }
92
92
 
@@ -68,7 +68,7 @@ export default iterateJsdoc(({
68
68
  // @ts-expect-error Should be a comment
69
69
  indent = /** @type {import('estree').Comment} */ (
70
70
  jsdocNode
71
- ).value.match(/^\*\n([\t ]*) \*/u)?.[1]?.slice(spaceDiff);
71
+ ).value.match(/^\*\n([\t ]*) \*/v)?.[1]?.slice(spaceDiff);
72
72
  if (!indent) {
73
73
  /** @type {import('eslint').AST.Token|import('estree').Comment|undefined} */
74
74
  let tokenPrior = tokenBefore;
@@ -2,7 +2,7 @@ import iterateJsdoc from '../iterateJsdoc.js';
2
2
 
3
3
  // If supporting Node >= 10, we could loosen the default to this for the
4
4
  // initial letter: \\p{Upper}
5
- const matchDescriptionDefault = '^\n?([A-Z`\\d_][\\s\\S]*[.?!`]\\s*)?$';
5
+ const matchDescriptionDefault = '^\n?([A-Z`\\d_][\\s\\S]*[.?!`\\p{RGI_Emoji}]\\s*)?$';
6
6
 
7
7
  /**
8
8
  * @param {string} value
@@ -43,7 +43,7 @@ export default iterateJsdoc(({
43
43
  }
44
44
 
45
45
  if (mainDescriptionMatch === false && (
46
- !tag || !Object.prototype.hasOwnProperty.call(tags, tag.tag))
46
+ !tag || !Object.hasOwn(tags, tag.tag))
47
47
  ) {
48
48
  return;
49
49
  }
@@ -114,7 +114,7 @@ export default iterateJsdoc(({
114
114
  utils.forEachPreferredTag(tag, (matchingJsdocTag, targetTagName) => {
115
115
  const desc = (matchingJsdocTag.name + ' ' + utils.getTagDescription(matchingJsdocTag)).trim();
116
116
 
117
- if (hasNoTag(targetTagName) && !(/.+/u).test(desc)) {
117
+ if (hasNoTag(targetTagName) && !(/.+/v).test(desc)) {
118
118
  report(
119
119
  'JSDoc description must not be empty.',
120
120
  null,
@@ -150,7 +150,7 @@ export default iterateJsdoc(({
150
150
  tagsWithNames.some((tag) => {
151
151
  const desc = /** @type {string} */ (
152
152
  utils.getTagDescription(tag)
153
- ).replace(/^[- ]*/u, '')
153
+ ).replace(/^[\- ]*/v, '')
154
154
  .trim();
155
155
 
156
156
  return validateDescription(desc, tag);
@@ -38,7 +38,7 @@ export default iterateJsdoc(({
38
38
 
39
39
  let reported = false;
40
40
  for (const tag of applicableTags) {
41
- const tagName = tag.name.replace(/^\[/u, '').replace(/(=.*)?\]$/u, '');
41
+ const tagName = tag.name.replace(/^\[/v, '').replace(/(=.*)?\]$/v, '');
42
42
  const allowed = !allowNameRegex || allowNameRegex.test(tagName);
43
43
  const disallowed = disallowNameRegex && disallowNameRegex.test(tagName);
44
44
  const hasRegex = allowNameRegex || disallowNameRegex;
@@ -5,8 +5,8 @@ import {
5
5
 
6
6
  // Neither a single nor 3+ asterisks are valid jsdoc per
7
7
  // https://jsdoc.app/about-getting-started.html#adding-documentation-comments-to-your-code
8
- const commentRegexp = /^\/\*(?!\*)/u;
9
- const extraAsteriskCommentRegexp = /^\/\*{3,}/u;
8
+ const commentRegexp = /^\/\*(?!\*)/v;
9
+ const extraAsteriskCommentRegexp = /^\/\*{3,}/v;
10
10
 
11
11
  export default iterateJsdoc(({
12
12
  allComments,
@@ -1,7 +1,7 @@
1
1
  import iterateJsdoc from '../iterateJsdoc.js';
2
2
 
3
- const anyWhitespaceLines = /^\s*$/u;
4
- const atLeastTwoLinesWhitespace = /^[ \t]*\n[ \t]*\n\s*$/u;
3
+ const anyWhitespaceLines = /^\s*$/v;
4
+ const atLeastTwoLinesWhitespace = /^[ \t]*\n[ \t]*\n\s*$/v;
5
5
 
6
6
  export default iterateJsdoc(({
7
7
  jsdoc,
@@ -14,13 +14,13 @@ export default iterateJsdoc(({
14
14
  if (noOptionalParamNames && tag.optional) {
15
15
  utils.reportJSDoc(`Optional param names are not permitted on @${tag.tag}.`, tag, () => {
16
16
  utils.changeTag(tag, {
17
- name: tag.name.replace(/([^=]*)(=.+)?/u, '$1'),
17
+ name: tag.name.replace(/([^=]*)(=.+)?/v, '$1'),
18
18
  });
19
19
  });
20
20
  } else if (tag.default) {
21
21
  utils.reportJSDoc(`Defaults are not permitted on @${tag.tag}.`, tag, () => {
22
22
  utils.changeTag(tag, {
23
- name: tag.name.replace(/([^=]*)(=.+)?/u, '[$1]'),
23
+ name: tag.name.replace(/([^=]*)(=.+)?/v, '[$1]'),
24
24
  });
25
25
  });
26
26
  }
@@ -1,13 +1,13 @@
1
1
  import iterateJsdoc from '../iterateJsdoc.js';
2
2
 
3
- const middleAsterisksBlockWS = /^([\t ]|\*(?!\*))+/u;
4
- const middleAsterisksNoBlockWS = /^\*+/u;
3
+ const middleAsterisksBlockWS = /^([\t ]|\*(?!\*))+/v;
4
+ const middleAsterisksNoBlockWS = /^\*+/v;
5
5
 
6
- const endAsterisksSingleLineBlockWS = /\*((?:\*|(?: |\t))*)\*$/u;
7
- const endAsterisksMultipleLineBlockWS = /((?:\*|(?: |\t))*)\*$/u;
6
+ const endAsterisksSingleLineBlockWS = /\*((?:\*|(?: |\t))*)\*$/v;
7
+ const endAsterisksMultipleLineBlockWS = /((?:\*|(?: |\t))*)\*$/v;
8
8
 
9
- const endAsterisksSingleLineNoBlockWS = /\*(\**)\*$/u;
10
- const endAsterisksMultipleLineNoBlockWS = /(\**)\*$/u;
9
+ const endAsterisksSingleLineNoBlockWS = /\*(\**)\*$/v;
10
+ const endAsterisksMultipleLineNoBlockWS = /(\**)\*$/v;
11
11
 
12
12
  export default iterateJsdoc(({
13
13
  context,
@@ -50,7 +50,7 @@ const typescriptGlobals = [
50
50
  * @returns {undefined|string|false}
51
51
  */
52
52
  const stripPseudoTypes = (str) => {
53
- return str && str.replace(/(?:\.|<>|\.<>|\[\])$/u, '');
53
+ return str && str.replace(/(?:\.|<>|\.<>|\[\])$/v, '');
54
54
  };
55
55
 
56
56
  export default iterateJsdoc(({
@@ -115,7 +115,7 @@ export default iterateJsdoc(({
115
115
  const allComments = sourceCode.getAllComments();
116
116
  const comments = allComments
117
117
  .filter((comment) => {
118
- return (/^\*\s/u).test(comment.value);
118
+ return (/^\*\s/v).test(comment.value);
119
119
  })
120
120
  .map((commentNode) => {
121
121
  return parseComment(commentNode, '');
@@ -123,9 +123,9 @@ export default iterateJsdoc(({
123
123
 
124
124
  const globals = allComments
125
125
  .filter((comment) => {
126
- return (/^\s*globals/u).test(comment.value);
126
+ return (/^\s*globals/v).test(comment.value);
127
127
  }).flatMap((commentNode) => {
128
- return commentNode.value.replace(/^\s*globals/u, '').trim().split(/,\s*/u);
128
+ return commentNode.value.replace(/^\s*globals/v, '').trim().split(/,\s*/v);
129
129
  }).concat(Object.keys(context.languageOptions.globals ?? []));
130
130
 
131
131
  const typedefDeclarations = comments