eslint-plugin-jsdoc 63.0.11 → 63.0.12

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 (171) hide show
  1. package/dist/WarnSettings.cjs +8 -1
  2. package/dist/WarnSettings.cjs.map +1 -1
  3. package/dist/alignTransform.cjs +10 -6
  4. package/dist/alignTransform.cjs.map +1 -1
  5. package/dist/buildForbidRuleDefinition.cjs +10 -3
  6. package/dist/buildForbidRuleDefinition.cjs.map +1 -1
  7. package/dist/buildRejectOrPreferRuleDefinition.cjs +14 -7
  8. package/dist/buildRejectOrPreferRuleDefinition.cjs.map +1 -1
  9. package/dist/defaultTagOrder.cjs +8 -1
  10. package/dist/defaultTagOrder.cjs.map +1 -1
  11. package/dist/exportParser.cjs +14 -6
  12. package/dist/exportParser.cjs.map +1 -1
  13. package/dist/generateDocs.cjs +44 -36
  14. package/dist/generateDocs.cjs.map +1 -1
  15. package/dist/generateOptions.cjs +18 -15
  16. package/dist/generateOptions.cjs.map +1 -1
  17. package/dist/generateRule.cjs +24 -24
  18. package/dist/generateRule.cjs.map +1 -1
  19. package/dist/generateRuleTypes.cjs +9 -6
  20. package/dist/generateRuleTypes.cjs.map +1 -1
  21. package/dist/getDefaultTagStructureForMode.cjs +8 -1
  22. package/dist/getDefaultTagStructureForMode.cjs.map +1 -1
  23. package/dist/getJsdocProcessorPlugin.cjs +28 -20
  24. package/dist/getJsdocProcessorPlugin.cjs.map +1 -1
  25. package/dist/index-cjs.cjs +159 -152
  26. package/dist/index-cjs.cjs.map +1 -1
  27. package/dist/index-esm.cjs +27 -16
  28. package/dist/index-esm.cjs.map +1 -1
  29. package/dist/index.cjs +172 -159
  30. package/dist/index.cjs.map +1 -1
  31. package/dist/iterateJsdoc.cjs +32 -22
  32. package/dist/iterateJsdoc.cjs.map +1 -1
  33. package/dist/jsdocUtils.cjs +86 -18
  34. package/dist/jsdocUtils.cjs.map +1 -1
  35. package/dist/rules/checkAccess.cjs +10 -2
  36. package/dist/rules/checkAccess.cjs.map +1 -1
  37. package/dist/rules/checkAlignment.cjs +10 -2
  38. package/dist/rules/checkAlignment.cjs.map +1 -1
  39. package/dist/rules/checkExamples.cjs +15 -6
  40. package/dist/rules/checkExamples.cjs.map +1 -1
  41. package/dist/rules/checkIndentation.cjs +9 -2
  42. package/dist/rules/checkIndentation.cjs.map +1 -1
  43. package/dist/rules/checkLineAlignment.cjs +14 -6
  44. package/dist/rules/checkLineAlignment.cjs.map +1 -1
  45. package/dist/rules/checkParamNames.cjs +9 -2
  46. package/dist/rules/checkParamNames.cjs.map +1 -1
  47. package/dist/rules/checkPropertyNames.cjs +9 -2
  48. package/dist/rules/checkPropertyNames.cjs.map +1 -1
  49. package/dist/rules/checkSyntax.cjs +10 -2
  50. package/dist/rules/checkSyntax.cjs.map +1 -1
  51. package/dist/rules/checkTagNames.cjs +11 -4
  52. package/dist/rules/checkTagNames.cjs.map +1 -1
  53. package/dist/rules/checkTemplateNames.cjs +20 -12
  54. package/dist/rules/checkTemplateNames.cjs.map +1 -1
  55. package/dist/rules/checkTypes.cjs +10 -4
  56. package/dist/rules/checkTypes.cjs.map +1 -1
  57. package/dist/rules/checkValues.cjs +17 -9
  58. package/dist/rules/checkValues.cjs.map +1 -1
  59. package/dist/rules/convertToJsdocComments.cjs +19 -13
  60. package/dist/rules/convertToJsdocComments.cjs.map +1 -1
  61. package/dist/rules/emptyTags.cjs +10 -2
  62. package/dist/rules/emptyTags.cjs.map +1 -1
  63. package/dist/rules/escapeInlineTags.cjs +10 -2
  64. package/dist/rules/escapeInlineTags.cjs.map +1 -1
  65. package/dist/rules/implementsOnClasses.cjs +10 -2
  66. package/dist/rules/implementsOnClasses.cjs.map +1 -1
  67. package/dist/rules/importsAsDependencies.cjs +20 -12
  68. package/dist/rules/importsAsDependencies.cjs.map +1 -1
  69. package/dist/rules/informativeDocs.cjs +12 -4
  70. package/dist/rules/informativeDocs.cjs.map +1 -1
  71. package/dist/rules/linesBeforeBlock.cjs +9 -2
  72. package/dist/rules/linesBeforeBlock.cjs.map +1 -1
  73. package/dist/rules/matchDescription.cjs +9 -2
  74. package/dist/rules/matchDescription.cjs.map +1 -1
  75. package/dist/rules/matchName.cjs +10 -2
  76. package/dist/rules/matchName.cjs.map +1 -1
  77. package/dist/rules/multilineBlocks.cjs +9 -2
  78. package/dist/rules/multilineBlocks.cjs.map +1 -1
  79. package/dist/rules/noBadBlocks.cjs +11 -4
  80. package/dist/rules/noBadBlocks.cjs.map +1 -1
  81. package/dist/rules/noBlankBlockDescriptions.cjs +10 -2
  82. package/dist/rules/noBlankBlockDescriptions.cjs.map +1 -1
  83. package/dist/rules/noBlankBlocks.cjs +10 -2
  84. package/dist/rules/noBlankBlocks.cjs.map +1 -1
  85. package/dist/rules/noDefaults.cjs +10 -2
  86. package/dist/rules/noDefaults.cjs.map +1 -1
  87. package/dist/rules/noMissingSyntax.cjs +9 -2
  88. package/dist/rules/noMissingSyntax.cjs.map +1 -1
  89. package/dist/rules/noMultiAsterisks.cjs +10 -2
  90. package/dist/rules/noMultiAsterisks.cjs.map +1 -1
  91. package/dist/rules/noRestrictedSyntax.cjs +9 -2
  92. package/dist/rules/noRestrictedSyntax.cjs.map +1 -1
  93. package/dist/rules/noTypes.cjs +9 -2
  94. package/dist/rules/noTypes.cjs.map +1 -1
  95. package/dist/rules/noUndefinedTypes.cjs +21 -13
  96. package/dist/rules/noUndefinedTypes.cjs.map +1 -1
  97. package/dist/rules/preferImportTag.cjs +28 -21
  98. package/dist/rules/preferImportTag.cjs.map +1 -1
  99. package/dist/rules/requireAsteriskPrefix.cjs +10 -2
  100. package/dist/rules/requireAsteriskPrefix.cjs.map +1 -1
  101. package/dist/rules/requireDescription.cjs +9 -2
  102. package/dist/rules/requireDescription.cjs.map +1 -1
  103. package/dist/rules/requireDescriptionCompleteSentence.cjs +15 -7
  104. package/dist/rules/requireDescriptionCompleteSentence.cjs.map +1 -1
  105. package/dist/rules/requireExample.cjs +10 -2
  106. package/dist/rules/requireExample.cjs.map +1 -1
  107. package/dist/rules/requireFileOverview.cjs +10 -2
  108. package/dist/rules/requireFileOverview.cjs.map +1 -1
  109. package/dist/rules/requireHyphenBeforeParamDescription.cjs +10 -2
  110. package/dist/rules/requireHyphenBeforeParamDescription.cjs.map +1 -1
  111. package/dist/rules/requireJsdoc.cjs +24 -17
  112. package/dist/rules/requireJsdoc.cjs.map +1 -1
  113. package/dist/rules/requireParam.cjs +9 -2
  114. package/dist/rules/requireParam.cjs.map +1 -1
  115. package/dist/rules/requireParamDescription.cjs +10 -2
  116. package/dist/rules/requireParamDescription.cjs.map +1 -1
  117. package/dist/rules/requireParamName.cjs +10 -2
  118. package/dist/rules/requireParamName.cjs.map +1 -1
  119. package/dist/rules/requireParamType.cjs +10 -2
  120. package/dist/rules/requireParamType.cjs.map +1 -1
  121. package/dist/rules/requireProperty.cjs +10 -2
  122. package/dist/rules/requireProperty.cjs.map +1 -1
  123. package/dist/rules/requirePropertyDescription.cjs +10 -2
  124. package/dist/rules/requirePropertyDescription.cjs.map +1 -1
  125. package/dist/rules/requirePropertyName.cjs +10 -2
  126. package/dist/rules/requirePropertyName.cjs.map +1 -1
  127. package/dist/rules/requirePropertyType.cjs +10 -2
  128. package/dist/rules/requirePropertyType.cjs.map +1 -1
  129. package/dist/rules/requireRejects.cjs +9 -2
  130. package/dist/rules/requireRejects.cjs.map +1 -1
  131. package/dist/rules/requireReturns.cjs +11 -4
  132. package/dist/rules/requireReturns.cjs.map +1 -1
  133. package/dist/rules/requireReturnsCheck.cjs +15 -8
  134. package/dist/rules/requireReturnsCheck.cjs.map +1 -1
  135. package/dist/rules/requireReturnsDescription.cjs +10 -2
  136. package/dist/rules/requireReturnsDescription.cjs.map +1 -1
  137. package/dist/rules/requireReturnsType.cjs +10 -2
  138. package/dist/rules/requireReturnsType.cjs.map +1 -1
  139. package/dist/rules/requireTags.cjs +9 -2
  140. package/dist/rules/requireTags.cjs.map +1 -1
  141. package/dist/rules/requireTemplate.cjs +13 -5
  142. package/dist/rules/requireTemplate.cjs.map +1 -1
  143. package/dist/rules/requireThrows.cjs +9 -2
  144. package/dist/rules/requireThrows.cjs.map +1 -1
  145. package/dist/rules/requireYields.cjs +9 -2
  146. package/dist/rules/requireYields.cjs.map +1 -1
  147. package/dist/rules/requireYieldsCheck.cjs +9 -2
  148. package/dist/rules/requireYieldsCheck.cjs.map +1 -1
  149. package/dist/rules/sortTags.cjs +12 -4
  150. package/dist/rules/sortTags.cjs.map +1 -1
  151. package/dist/rules/tagLines.cjs +9 -2
  152. package/dist/rules/tagLines.cjs.map +1 -1
  153. package/dist/rules/textEscaping.cjs +9 -2
  154. package/dist/rules/textEscaping.cjs.map +1 -1
  155. package/dist/rules/tsMethodSignatureStyle.cjs +18 -10
  156. package/dist/rules/tsMethodSignatureStyle.cjs.map +1 -1
  157. package/dist/rules/tsNoEmptyObjectType.cjs +13 -5
  158. package/dist/rules/tsNoEmptyObjectType.cjs.map +1 -1
  159. package/dist/rules/tsNoUnnecessaryTemplateExpression.cjs +16 -8
  160. package/dist/rules/tsNoUnnecessaryTemplateExpression.cjs.map +1 -1
  161. package/dist/rules/tsPreferFunctionType.cjs +16 -8
  162. package/dist/rules/tsPreferFunctionType.cjs.map +1 -1
  163. package/dist/rules/typeFormatting.cjs +17 -9
  164. package/dist/rules/typeFormatting.cjs.map +1 -1
  165. package/dist/rules/validTypes.cjs +18 -10
  166. package/dist/rules/validTypes.cjs.map +1 -1
  167. package/dist/tagNames.cjs +9 -4
  168. package/dist/tagNames.cjs.map +1 -1
  169. package/dist/utils/hasReturnValue.cjs +8 -1
  170. package/dist/utils/hasReturnValue.cjs.map +1 -1
  171. package/package.json +1 -1
@@ -1,10 +1,18 @@
1
- import iterateJsdoc from '../iterateJsdoc.js';
2
- import eslint, { ESLint } from 'eslint';
3
- import semver from 'semver';
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _iterateJsdoc = _interopRequireDefault(require("../iterateJsdoc.cjs"));
8
+ var _eslint = _interopRequireWildcard(require("eslint"));
9
+ var _semver = _interopRequireDefault(require("semver"));
10
+ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
11
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
4
12
  const {
5
13
  // @ts-expect-error Older ESLint
6
14
  CLIEngine
7
- } = eslint;
15
+ } = _eslint.default;
8
16
  const zeroBasedLineIndexAdjust = -1;
9
17
  const likelyNestedJSDocIndentSpace = 1;
10
18
  const preTagSpaceLength = 1;
@@ -95,13 +103,13 @@ const getLinesCols = text => {
95
103
  const colDelta = matchLines ? text.slice(text.lastIndexOf('\n') + 1).length : text.length;
96
104
  return [matchLines, colDelta];
97
105
  };
98
- export default iterateJsdoc(({
106
+ var _default = exports.default = (0, _iterateJsdoc.default)(({
99
107
  context,
100
108
  globalState,
101
109
  report,
102
110
  utils
103
111
  }) => {
104
- if (semver.gte(ESLint.version, '8.0.0')) {
112
+ if (_semver.default.gte(_eslint.ESLint.version, '8.0.0')) {
105
113
  report('This rule does not work for ESLint 8+; you should disable this rule and use' + 'the processor mentioned in the docs.', null, {
106
114
  column: 1,
107
115
  line: 1
@@ -509,4 +517,5 @@ export default iterateJsdoc(({
509
517
  type: 'suggestion'
510
518
  }
511
519
  });
520
+ module.exports = exports.default;
512
521
  //# sourceMappingURL=checkExamples.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"checkExamples.cjs","names":[],"sources":["../../src/rules/checkExamples.js"],"sourcesContent":["import iterateJsdoc from '../iterateJsdoc.js';\nimport eslint, {\n ESLint,\n} from 'eslint';\nimport semver from 'semver';\n\nconst {\n // @ts-expect-error Older ESLint\n CLIEngine,\n} = eslint;\n\nconst zeroBasedLineIndexAdjust = -1;\nconst likelyNestedJSDocIndentSpace = 1;\nconst preTagSpaceLength = 1;\n\n// If a space is present, we should ignore it\nconst firstLinePrefixLength = preTagSpaceLength;\n\nconst hasCaptionRegex = /^\\s*<caption>([\\s\\S]*?)<\\/caption>/v;\n\n/**\n * @param {string} str\n * @returns {string}\n */\nconst escapeStringRegexp = (str) => {\n return str.replaceAll(/[.*+?^$\\{\\}\\(\\)\\|\\[\\]\\\\]/gv, '\\\\$&');\n};\n\n/**\n * @param {string} str\n * @param {string} ch\n * @returns {import('../iterateJsdoc.js').Integer}\n */\nconst countChars = (str, ch) => {\n return (str.match(new RegExp(escapeStringRegexp(ch), 'gv')) || []).length;\n};\n\n/** @type {import('eslint').Linter.RulesRecord} */\nconst defaultMdRules = {\n // \"always\" newline rule at end unlikely in sample code\n '@stylistic/eol-last': 0,\n\n // Often wish to start `@example` code after newline; also may use\n // empty lines for spacing\n '@stylistic/no-multiple-empty-lines': 0,\n\n // Can generally look nicer to pad a little even if code imposes more stringency\n '@stylistic/padded-blocks': 0,\n\n '@typescript-eslint/no-unused-vars': 0,\n\n // \"always\" newline rule at end unlikely in sample code\n 'eol-last': 0,\n\n // Wouldn't generally expect example paths to resolve relative to JS file\n 'import/no-unresolved': 0,\n\n // Snippets likely too short to always include import/export info\n 'import/unambiguous': 0,\n\n 'jsdoc/require-file-overview': 0,\n\n // The end of a multiline comment would end the comment the example is in.\n 'jsdoc/require-jsdoc': 0,\n\n // See import/no-unresolved\n 'n/no-missing-import': 0,\n 'n/no-missing-require': 0,\n\n // Unlikely to have inadvertent debugging within examples\n 'no-console': 0,\n\n // Often wish to start `@example` code after newline; also may use\n // empty lines for spacing\n 'no-multiple-empty-lines': 0,\n // Many variables in examples will be `undefined`\n 'no-undef': 0,\n\n // Common to define variables for clarity without always using them\n 'no-unused-vars': 0,\n\n // See import/no-unresolved\n 'node/no-missing-import': 0,\n\n 'node/no-missing-require': 0,\n\n // Can generally look nicer to pad a little even if code imposes more stringency\n 'padded-blocks': 0,\n};\n\n/** @type {import('eslint').Linter.RulesRecord} */\nconst defaultExpressionRules = {\n ...defaultMdRules,\n '@stylistic/quotes': [\n 'error', 'double',\n ],\n '@stylistic/semi': [\n 'error', 'never',\n ],\n '@typescript-eslint/no-unused-expressions': 'off',\n 'chai-friendly/no-unused-expressions': 'off',\n 'no-empty-function': 'off',\n 'no-new': 'off',\n 'no-unused-expressions': 'off',\n quotes: [\n 'error', 'double',\n ],\n semi: [\n 'error', 'never',\n ],\n strict: 'off',\n};\n\n/**\n * @param {string} text\n * @returns {[\n * import('../iterateJsdoc.js').Integer,\n * import('../iterateJsdoc.js').Integer\n * ]}\n */\nconst getLinesCols = (text) => {\n const matchLines = countChars(text, '\\n');\n\n const colDelta = matchLines ?\n text.slice(text.lastIndexOf('\\n') + 1).length :\n text.length;\n\n return [\n matchLines, colDelta,\n ];\n};\n\nexport default iterateJsdoc(({\n context,\n globalState,\n report,\n utils,\n}) => {\n if (semver.gte(ESLint.version, '8.0.0')) {\n report(\n 'This rule does not work for ESLint 8+; you should disable this rule and use' +\n 'the processor mentioned in the docs.',\n null,\n {\n column: 1,\n line: 1,\n },\n );\n\n return;\n }\n\n if (!globalState.has('checkExamples-matchingFileName')) {\n globalState.set('checkExamples-matchingFileName', new Map());\n }\n\n const matchingFileNameMap = /** @type {Map<string, string>} */ (\n globalState.get('checkExamples-matchingFileName')\n );\n\n const options = context.options[0] || {};\n let {\n exampleCodeRegex = null,\n rejectExampleCodeRegex = null,\n } = options;\n const {\n allowInlineConfig = true,\n baseConfig = {},\n captionRequired = false,\n checkDefaults = false,\n checkEslintrc = true,\n checkParams = false,\n checkProperties = false,\n configFile,\n matchingFileName = null,\n matchingFileNameDefaults = null,\n matchingFileNameParams = null,\n matchingFileNameProperties = null,\n noDefaultExampleRules = false,\n paddedIndent = 0,\n reportUnusedDisableDirectives = true,\n } = options;\n\n // Make this configurable?\n /**\n * @type {never[]}\n */\n const rulePaths = [];\n\n const mdRules = noDefaultExampleRules ? undefined : defaultMdRules;\n\n const expressionRules = noDefaultExampleRules ? undefined : defaultExpressionRules;\n\n if (exampleCodeRegex) {\n exampleCodeRegex = utils.getRegexFromString(exampleCodeRegex);\n }\n\n if (rejectExampleCodeRegex) {\n rejectExampleCodeRegex = utils.getRegexFromString(rejectExampleCodeRegex);\n }\n\n /**\n * @param {{\n * filename: string,\n * defaultFileName: string|undefined,\n * source: string,\n * targetTagName: string,\n * rules?: import('eslint').Linter.RulesRecord|undefined,\n * lines?: import('../iterateJsdoc.js').Integer,\n * cols?: import('../iterateJsdoc.js').Integer,\n * skipInit?: boolean,\n * sources?: {\n * nonJSPrefacingCols: import('../iterateJsdoc.js').Integer,\n * nonJSPrefacingLines: import('../iterateJsdoc.js').Integer,\n * string: string,\n * }[],\n * tag?: import('comment-parser').Spec & {\n * line?: import('../iterateJsdoc.js').Integer,\n * }|{\n * line: import('../iterateJsdoc.js').Integer,\n * }\n * }} cfg\n */\n const checkSource = ({\n cols = 0,\n defaultFileName,\n filename,\n lines = 0,\n rules = expressionRules,\n skipInit,\n source,\n sources = [],\n tag = {\n line: 0,\n },\n targetTagName,\n }) => {\n if (!skipInit) {\n sources.push({\n nonJSPrefacingCols: cols,\n nonJSPrefacingLines: lines,\n string: source,\n });\n }\n\n /**\n * @param {{\n * nonJSPrefacingCols: import('../iterateJsdoc.js').Integer,\n * nonJSPrefacingLines: import('../iterateJsdoc.js').Integer,\n * string: string\n * }} cfg\n */\n const checkRules = function ({\n nonJSPrefacingCols,\n nonJSPrefacingLines,\n string,\n }) {\n const cliConfig = {\n allowInlineConfig,\n baseConfig,\n configFile,\n reportUnusedDisableDirectives,\n rulePaths,\n rules,\n useEslintrc: checkEslintrc,\n };\n const cliConfigStr = JSON.stringify(cliConfig);\n\n const src = paddedIndent ?\n string.replaceAll(new RegExp(`(^|\\n) {${paddedIndent}}(?!$)`, 'gv'), '\\n') :\n string;\n\n // Programmatic ESLint API: https://eslint.org/docs/developer-guide/nodejs-api\n const fileNameMapKey = filename ?\n 'a' + cliConfigStr + filename :\n 'b' + cliConfigStr + defaultFileName;\n const file = filename || defaultFileName;\n let cliFile;\n if (matchingFileNameMap.has(fileNameMapKey)) {\n cliFile = matchingFileNameMap.get(fileNameMapKey);\n } else {\n const cli = new CLIEngine(cliConfig);\n let config;\n if (filename || checkEslintrc) {\n config = cli.getConfigForFile(file);\n }\n\n // We need a new instance to ensure that the rules that may only\n // be available to `file` (if it has its own `.eslintrc`),\n // will be defined.\n cliFile = new CLIEngine({\n allowInlineConfig,\n baseConfig: {\n ...baseConfig,\n ...config,\n },\n configFile,\n reportUnusedDisableDirectives,\n rulePaths,\n rules,\n useEslintrc: false,\n });\n matchingFileNameMap.set(fileNameMapKey, cliFile);\n }\n\n const {\n results: [\n {\n messages,\n },\n ],\n } = cliFile.executeOnText(src);\n\n if (!('line' in tag)) {\n tag.line = tag.source[0].number;\n }\n\n // NOTE: `tag.line` can be 0 if of form `/** @tag ... */`\n const codeStartLine = /**\n * @type {import('comment-parser').Spec & {\n * line: import('../iterateJsdoc.js').Integer,\n * }}\n */ (tag).line + nonJSPrefacingLines;\n const codeStartCol = likelyNestedJSDocIndentSpace;\n\n for (const {\n column,\n line,\n message,\n ruleId,\n severity,\n } of messages) {\n const startLine = codeStartLine + line + zeroBasedLineIndexAdjust;\n const startCol = codeStartCol + (\n\n // This might not work for line 0, but line 0 is unlikely for examples\n line <= 1 ? nonJSPrefacingCols + firstLinePrefixLength : preTagSpaceLength\n ) + column;\n\n report(\n '@' + targetTagName + ' ' + (severity === 2 ? 'error' : 'warning') +\n (ruleId ? ' (' + ruleId + ')' : '') + ': ' +\n message,\n null,\n {\n column: startCol,\n line: startLine,\n },\n );\n }\n };\n\n for (const targetSource of sources) {\n checkRules(targetSource);\n }\n };\n\n /**\n *\n * @param {string} filename\n * @param {string} [ext] Since `eslint-plugin-markdown` v2, and\n * ESLint 7, this is the default which other JS-fenced rules will used.\n * Formerly \"md\" was the default.\n * @returns {{defaultFileName: string|undefined, filename: string}}\n */\n const getFilenameInfo = (filename, ext = 'md/*.js') => {\n let defaultFileName;\n if (!filename) {\n // @ts-expect-error ESLint < 10\n const jsFileName = context.getFilename();\n if (typeof jsFileName === 'string' && jsFileName.includes('.')) {\n defaultFileName = jsFileName.replace(/\\.[^.]*$/v, `.${ext}`);\n } else {\n defaultFileName = `dummy.${ext}`;\n }\n }\n\n return {\n defaultFileName,\n filename,\n };\n };\n\n if (checkDefaults) {\n const filenameInfo = getFilenameInfo(matchingFileNameDefaults, 'jsdoc-defaults');\n utils.forEachPreferredTag('default', (tag, targetTagName) => {\n if (!tag.description.trim()) {\n return;\n }\n\n checkSource({\n source: `(${utils.getTagDescription(tag)})`,\n targetTagName,\n ...filenameInfo,\n });\n });\n }\n\n if (checkParams) {\n const filenameInfo = getFilenameInfo(matchingFileNameParams, 'jsdoc-params');\n utils.forEachPreferredTag('param', (tag, targetTagName) => {\n if (!tag.default || !tag.default.trim()) {\n return;\n }\n\n checkSource({\n source: `(${tag.default})`,\n targetTagName,\n ...filenameInfo,\n });\n });\n }\n\n if (checkProperties) {\n const filenameInfo = getFilenameInfo(matchingFileNameProperties, 'jsdoc-properties');\n utils.forEachPreferredTag('property', (tag, targetTagName) => {\n if (!tag.default || !tag.default.trim()) {\n return;\n }\n\n checkSource({\n source: `(${tag.default})`,\n targetTagName,\n ...filenameInfo,\n });\n });\n }\n\n const tagName = /** @type {string} */ (utils.getPreferredTagName({\n tagName: 'example',\n }));\n if (!utils.hasTag(tagName)) {\n return;\n }\n\n const matchingFilenameInfo = getFilenameInfo(matchingFileName);\n\n utils.forEachPreferredTag('example', (tag, targetTagName) => {\n let source = /** @type {string} */ (utils.getTagDescription(tag));\n const match = source.match(hasCaptionRegex);\n\n if (captionRequired && (!match || !match[1].trim())) {\n report('Caption is expected for examples.', null, tag);\n }\n\n source = source.replace(hasCaptionRegex, '');\n const [\n lines,\n cols,\n ] = match ? getLinesCols(match[0]) : [\n 0, 0,\n ];\n\n if (exampleCodeRegex && !exampleCodeRegex.test(source) ||\n rejectExampleCodeRegex && rejectExampleCodeRegex.test(source)\n ) {\n return;\n }\n\n const sources = [];\n let skipInit = false;\n if (exampleCodeRegex) {\n let nonJSPrefacingCols = 0;\n let nonJSPrefacingLines = 0;\n\n let startingIndex = 0;\n let lastStringCount = 0;\n\n let exampleCode;\n exampleCodeRegex.lastIndex = 0;\n while ((exampleCode = exampleCodeRegex.exec(source)) !== null) {\n const {\n '0': n0,\n '1': n1,\n index,\n } = exampleCode;\n\n // Count anything preceding user regex match (can affect line numbering)\n const preMatch = source.slice(startingIndex, index);\n\n const [\n preMatchLines,\n colDelta,\n ] = getLinesCols(preMatch);\n\n let nonJSPreface;\n let nonJSPrefaceLineCount;\n if (n1) {\n const idx = n0.indexOf(n1);\n nonJSPreface = n0.slice(0, idx);\n nonJSPrefaceLineCount = countChars(nonJSPreface, '\\n');\n } else {\n nonJSPreface = '';\n nonJSPrefaceLineCount = 0;\n }\n\n nonJSPrefacingLines += lastStringCount + preMatchLines + nonJSPrefaceLineCount;\n\n // Ignore `preMatch` delta if newlines here\n if (nonJSPrefaceLineCount) {\n const charsInLastLine = nonJSPreface.slice(nonJSPreface.lastIndexOf('\\n') + 1).length;\n\n nonJSPrefacingCols += charsInLastLine;\n } else {\n nonJSPrefacingCols += colDelta + nonJSPreface.length;\n }\n\n const string = n1 || n0;\n sources.push({\n nonJSPrefacingCols,\n nonJSPrefacingLines,\n string,\n });\n startingIndex = exampleCodeRegex.lastIndex;\n lastStringCount = countChars(string, '\\n');\n if (!exampleCodeRegex.global) {\n break;\n }\n }\n\n skipInit = true;\n }\n\n checkSource({\n cols,\n lines,\n rules: mdRules,\n skipInit,\n source,\n sources,\n tag,\n targetTagName,\n ...matchingFilenameInfo,\n });\n });\n}, {\n iterateAllJsdocs: true,\n meta: {\n docs: {\n description: '@deprecated - Use `getJsdocProcessorPlugin` processor; ensures that (JavaScript) samples within `@example` tags adhere to ESLint rules.',\n url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/check-examples.md#repos-sticky-header',\n },\n schema: [\n {\n additionalProperties: false,\n properties: {\n allowInlineConfig: {\n default: true,\n type: 'boolean',\n },\n baseConfig: {\n type: 'object',\n },\n captionRequired: {\n default: false,\n type: 'boolean',\n },\n checkDefaults: {\n default: false,\n type: 'boolean',\n },\n checkEslintrc: {\n default: true,\n type: 'boolean',\n },\n checkParams: {\n default: false,\n type: 'boolean',\n },\n checkProperties: {\n default: false,\n type: 'boolean',\n },\n configFile: {\n type: 'string',\n },\n exampleCodeRegex: {\n type: 'string',\n },\n matchingFileName: {\n type: 'string',\n },\n matchingFileNameDefaults: {\n type: 'string',\n },\n matchingFileNameParams: {\n type: 'string',\n },\n matchingFileNameProperties: {\n type: 'string',\n },\n noDefaultExampleRules: {\n default: false,\n type: 'boolean',\n },\n paddedIndent: {\n default: 0,\n type: 'integer',\n },\n rejectExampleCodeRegex: {\n type: 'string',\n },\n reportUnusedDisableDirectives: {\n default: true,\n type: 'boolean',\n },\n },\n type: 'object',\n },\n ],\n type: 'suggestion',\n },\n});\n"],"mappings":"AAAA,OAAO,YAAY,MAAM,oBAAoB;AAC7C,OAAO,MAAM,IACX,MAAM,QACD,QAAQ;AACf,OAAO,MAAM,MAAM,QAAQ;AAE3B,MAAM;EACJ;EACA;AACF,CAAC,GAAG,MAAM;AAEV,MAAM,wBAAwB,GAAG,CAAC,CAAC;AACnC,MAAM,4BAA4B,GAAG,CAAC;AACtC,MAAM,iBAAiB,GAAG,CAAC;;AAE3B;AACA,MAAM,qBAAqB,GAAG,iBAAiB;AAE/C,MAAM,eAAe,GAAG,qCAAqC;;AAE7D;AACA;AACA;AACA;AACA,MAAM,kBAAkB,GAAI,GA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AAE,KAAK;UACd,IAAI,EAAE;QACR,CAAC;QACD,YAAY,EAAE;UACZ,OAAO,EAAE,CAAC;UACV,IAAI,EAAE;QACR,CAAC;QACD,sBAAsB,EAAE;UACtB,IAAI,EAAE;QACR,CAAC;QACD,6BAA6B,EAAE;UAC7B,OAAO,EAAE,IAAI;UACb,IAAI,EAAE;QACR;MACF,CAAC;MACD,IAAI,EAAE;IACR,CAAC,CACF;IACD,IAAI,EAAE;EACR;AACF,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"checkExamples.cjs","names":["eslint","iterateJsdoc","semver","ESLint"],"sources":["../../src/rules/checkExamples.js"],"sourcesContent":["import iterateJsdoc from '../iterateJsdoc.js';\nimport eslint, {\n ESLint,\n} from 'eslint';\nimport semver from 'semver';\n\nconst {\n // @ts-expect-error Older ESLint\n CLIEngine,\n} = eslint;\n\nconst zeroBasedLineIndexAdjust = -1;\nconst likelyNestedJSDocIndentSpace = 1;\nconst preTagSpaceLength = 1;\n\n// If a space is present, we should ignore it\nconst firstLinePrefixLength = preTagSpaceLength;\n\nconst hasCaptionRegex = /^\\s*<caption>([\\s\\S]*?)<\\/caption>/v;\n\n/**\n * @param {string} str\n * @returns {string}\n */\nconst escapeStringRegexp = (str) => {\n return str.replaceAll(/[.*+?^$\\{\\}\\(\\)\\|\\[\\]\\\\]/gv, '\\\\$&');\n};\n\n/**\n * @param {string} str\n * @param {string} ch\n * @returns {import('../iterateJsdoc.js').Integer}\n */\nconst countChars = (str, ch) => {\n return (str.match(new RegExp(escapeStringRegexp(ch), 'gv')) || []).length;\n};\n\n/** @type {import('eslint').Linter.RulesRecord} */\nconst defaultMdRules = {\n // \"always\" newline rule at end unlikely in sample code\n '@stylistic/eol-last': 0,\n\n // Often wish to start `@example` code after newline; also may use\n // empty lines for spacing\n '@stylistic/no-multiple-empty-lines': 0,\n\n // Can generally look nicer to pad a little even if code imposes more stringency\n '@stylistic/padded-blocks': 0,\n\n '@typescript-eslint/no-unused-vars': 0,\n\n // \"always\" newline rule at end unlikely in sample code\n 'eol-last': 0,\n\n // Wouldn't generally expect example paths to resolve relative to JS file\n 'import/no-unresolved': 0,\n\n // Snippets likely too short to always include import/export info\n 'import/unambiguous': 0,\n\n 'jsdoc/require-file-overview': 0,\n\n // The end of a multiline comment would end the comment the example is in.\n 'jsdoc/require-jsdoc': 0,\n\n // See import/no-unresolved\n 'n/no-missing-import': 0,\n 'n/no-missing-require': 0,\n\n // Unlikely to have inadvertent debugging within examples\n 'no-console': 0,\n\n // Often wish to start `@example` code after newline; also may use\n // empty lines for spacing\n 'no-multiple-empty-lines': 0,\n // Many variables in examples will be `undefined`\n 'no-undef': 0,\n\n // Common to define variables for clarity without always using them\n 'no-unused-vars': 0,\n\n // See import/no-unresolved\n 'node/no-missing-import': 0,\n\n 'node/no-missing-require': 0,\n\n // Can generally look nicer to pad a little even if code imposes more stringency\n 'padded-blocks': 0,\n};\n\n/** @type {import('eslint').Linter.RulesRecord} */\nconst defaultExpressionRules = {\n ...defaultMdRules,\n '@stylistic/quotes': [\n 'error', 'double',\n ],\n '@stylistic/semi': [\n 'error', 'never',\n ],\n '@typescript-eslint/no-unused-expressions': 'off',\n 'chai-friendly/no-unused-expressions': 'off',\n 'no-empty-function': 'off',\n 'no-new': 'off',\n 'no-unused-expressions': 'off',\n quotes: [\n 'error', 'double',\n ],\n semi: [\n 'error', 'never',\n ],\n strict: 'off',\n};\n\n/**\n * @param {string} text\n * @returns {[\n * import('../iterateJsdoc.js').Integer,\n * import('../iterateJsdoc.js').Integer\n * ]}\n */\nconst getLinesCols = (text) => {\n const matchLines = countChars(text, '\\n');\n\n const colDelta = matchLines ?\n text.slice(text.lastIndexOf('\\n') + 1).length :\n text.length;\n\n return [\n matchLines, colDelta,\n ];\n};\n\nexport default iterateJsdoc(({\n context,\n globalState,\n report,\n utils,\n}) => {\n if (semver.gte(ESLint.version, '8.0.0')) {\n report(\n 'This rule does not work for ESLint 8+; you should disable this rule and use' +\n 'the processor mentioned in the docs.',\n null,\n {\n column: 1,\n line: 1,\n },\n );\n\n return;\n }\n\n if (!globalState.has('checkExamples-matchingFileName')) {\n globalState.set('checkExamples-matchingFileName', new Map());\n }\n\n const matchingFileNameMap = /** @type {Map<string, string>} */ (\n globalState.get('checkExamples-matchingFileName')\n );\n\n const options = context.options[0] || {};\n let {\n exampleCodeRegex = null,\n rejectExampleCodeRegex = null,\n } = options;\n const {\n allowInlineConfig = true,\n baseConfig = {},\n captionRequired = false,\n checkDefaults = false,\n checkEslintrc = true,\n checkParams = false,\n checkProperties = false,\n configFile,\n matchingFileName = null,\n matchingFileNameDefaults = null,\n matchingFileNameParams = null,\n matchingFileNameProperties = null,\n noDefaultExampleRules = false,\n paddedIndent = 0,\n reportUnusedDisableDirectives = true,\n } = options;\n\n // Make this configurable?\n /**\n * @type {never[]}\n */\n const rulePaths = [];\n\n const mdRules = noDefaultExampleRules ? undefined : defaultMdRules;\n\n const expressionRules = noDefaultExampleRules ? undefined : defaultExpressionRules;\n\n if (exampleCodeRegex) {\n exampleCodeRegex = utils.getRegexFromString(exampleCodeRegex);\n }\n\n if (rejectExampleCodeRegex) {\n rejectExampleCodeRegex = utils.getRegexFromString(rejectExampleCodeRegex);\n }\n\n /**\n * @param {{\n * filename: string,\n * defaultFileName: string|undefined,\n * source: string,\n * targetTagName: string,\n * rules?: import('eslint').Linter.RulesRecord|undefined,\n * lines?: import('../iterateJsdoc.js').Integer,\n * cols?: import('../iterateJsdoc.js').Integer,\n * skipInit?: boolean,\n * sources?: {\n * nonJSPrefacingCols: import('../iterateJsdoc.js').Integer,\n * nonJSPrefacingLines: import('../iterateJsdoc.js').Integer,\n * string: string,\n * }[],\n * tag?: import('comment-parser').Spec & {\n * line?: import('../iterateJsdoc.js').Integer,\n * }|{\n * line: import('../iterateJsdoc.js').Integer,\n * }\n * }} cfg\n */\n const checkSource = ({\n cols = 0,\n defaultFileName,\n filename,\n lines = 0,\n rules = expressionRules,\n skipInit,\n source,\n sources = [],\n tag = {\n line: 0,\n },\n targetTagName,\n }) => {\n if (!skipInit) {\n sources.push({\n nonJSPrefacingCols: cols,\n nonJSPrefacingLines: lines,\n string: source,\n });\n }\n\n /**\n * @param {{\n * nonJSPrefacingCols: import('../iterateJsdoc.js').Integer,\n * nonJSPrefacingLines: import('../iterateJsdoc.js').Integer,\n * string: string\n * }} cfg\n */\n const checkRules = function ({\n nonJSPrefacingCols,\n nonJSPrefacingLines,\n string,\n }) {\n const cliConfig = {\n allowInlineConfig,\n baseConfig,\n configFile,\n reportUnusedDisableDirectives,\n rulePaths,\n rules,\n useEslintrc: checkEslintrc,\n };\n const cliConfigStr = JSON.stringify(cliConfig);\n\n const src = paddedIndent ?\n string.replaceAll(new RegExp(`(^|\\n) {${paddedIndent}}(?!$)`, 'gv'), '\\n') :\n string;\n\n // Programmatic ESLint API: https://eslint.org/docs/developer-guide/nodejs-api\n const fileNameMapKey = filename ?\n 'a' + cliConfigStr + filename :\n 'b' + cliConfigStr + defaultFileName;\n const file = filename || defaultFileName;\n let cliFile;\n if (matchingFileNameMap.has(fileNameMapKey)) {\n cliFile = matchingFileNameMap.get(fileNameMapKey);\n } else {\n const cli = new CLIEngine(cliConfig);\n let config;\n if (filename || checkEslintrc) {\n config = cli.getConfigForFile(file);\n }\n\n // We need a new instance to ensure that the rules that may only\n // be available to `file` (if it has its own `.eslintrc`),\n // will be defined.\n cliFile = new CLIEngine({\n allowInlineConfig,\n baseConfig: {\n ...baseConfig,\n ...config,\n },\n configFile,\n reportUnusedDisableDirectives,\n rulePaths,\n rules,\n useEslintrc: false,\n });\n matchingFileNameMap.set(fileNameMapKey, cliFile);\n }\n\n const {\n results: [\n {\n messages,\n },\n ],\n } = cliFile.executeOnText(src);\n\n if (!('line' in tag)) {\n tag.line = tag.source[0].number;\n }\n\n // NOTE: `tag.line` can be 0 if of form `/** @tag ... */`\n const codeStartLine = /**\n * @type {import('comment-parser').Spec & {\n * line: import('../iterateJsdoc.js').Integer,\n * }}\n */ (tag).line + nonJSPrefacingLines;\n const codeStartCol = likelyNestedJSDocIndentSpace;\n\n for (const {\n column,\n line,\n message,\n ruleId,\n severity,\n } of messages) {\n const startLine = codeStartLine + line + zeroBasedLineIndexAdjust;\n const startCol = codeStartCol + (\n\n // This might not work for line 0, but line 0 is unlikely for examples\n line <= 1 ? nonJSPrefacingCols + firstLinePrefixLength : preTagSpaceLength\n ) + column;\n\n report(\n '@' + targetTagName + ' ' + (severity === 2 ? 'error' : 'warning') +\n (ruleId ? ' (' + ruleId + ')' : '') + ': ' +\n message,\n null,\n {\n column: startCol,\n line: startLine,\n },\n );\n }\n };\n\n for (const targetSource of sources) {\n checkRules(targetSource);\n }\n };\n\n /**\n *\n * @param {string} filename\n * @param {string} [ext] Since `eslint-plugin-markdown` v2, and\n * ESLint 7, this is the default which other JS-fenced rules will used.\n * Formerly \"md\" was the default.\n * @returns {{defaultFileName: string|undefined, filename: string}}\n */\n const getFilenameInfo = (filename, ext = 'md/*.js') => {\n let defaultFileName;\n if (!filename) {\n // @ts-expect-error ESLint < 10\n const jsFileName = context.getFilename();\n if (typeof jsFileName === 'string' && jsFileName.includes('.')) {\n defaultFileName = jsFileName.replace(/\\.[^.]*$/v, `.${ext}`);\n } else {\n defaultFileName = `dummy.${ext}`;\n }\n }\n\n return {\n defaultFileName,\n filename,\n };\n };\n\n if (checkDefaults) {\n const filenameInfo = getFilenameInfo(matchingFileNameDefaults, 'jsdoc-defaults');\n utils.forEachPreferredTag('default', (tag, targetTagName) => {\n if (!tag.description.trim()) {\n return;\n }\n\n checkSource({\n source: `(${utils.getTagDescription(tag)})`,\n targetTagName,\n ...filenameInfo,\n });\n });\n }\n\n if (checkParams) {\n const filenameInfo = getFilenameInfo(matchingFileNameParams, 'jsdoc-params');\n utils.forEachPreferredTag('param', (tag, targetTagName) => {\n if (!tag.default || !tag.default.trim()) {\n return;\n }\n\n checkSource({\n source: `(${tag.default})`,\n targetTagName,\n ...filenameInfo,\n });\n });\n }\n\n if (checkProperties) {\n const filenameInfo = getFilenameInfo(matchingFileNameProperties, 'jsdoc-properties');\n utils.forEachPreferredTag('property', (tag, targetTagName) => {\n if (!tag.default || !tag.default.trim()) {\n return;\n }\n\n checkSource({\n source: `(${tag.default})`,\n targetTagName,\n ...filenameInfo,\n });\n });\n }\n\n const tagName = /** @type {string} */ (utils.getPreferredTagName({\n tagName: 'example',\n }));\n if (!utils.hasTag(tagName)) {\n return;\n }\n\n const matchingFilenameInfo = getFilenameInfo(matchingFileName);\n\n utils.forEachPreferredTag('example', (tag, targetTagName) => {\n let source = /** @type {string} */ (utils.getTagDescription(tag));\n const match = source.match(hasCaptionRegex);\n\n if (captionRequired && (!match || !match[1].trim())) {\n report('Caption is expected for examples.', null, tag);\n }\n\n source = source.replace(hasCaptionRegex, '');\n const [\n lines,\n cols,\n ] = match ? getLinesCols(match[0]) : [\n 0, 0,\n ];\n\n if (exampleCodeRegex && !exampleCodeRegex.test(source) ||\n rejectExampleCodeRegex && rejectExampleCodeRegex.test(source)\n ) {\n return;\n }\n\n const sources = [];\n let skipInit = false;\n if (exampleCodeRegex) {\n let nonJSPrefacingCols = 0;\n let nonJSPrefacingLines = 0;\n\n let startingIndex = 0;\n let lastStringCount = 0;\n\n let exampleCode;\n exampleCodeRegex.lastIndex = 0;\n while ((exampleCode = exampleCodeRegex.exec(source)) !== null) {\n const {\n '0': n0,\n '1': n1,\n index,\n } = exampleCode;\n\n // Count anything preceding user regex match (can affect line numbering)\n const preMatch = source.slice(startingIndex, index);\n\n const [\n preMatchLines,\n colDelta,\n ] = getLinesCols(preMatch);\n\n let nonJSPreface;\n let nonJSPrefaceLineCount;\n if (n1) {\n const idx = n0.indexOf(n1);\n nonJSPreface = n0.slice(0, idx);\n nonJSPrefaceLineCount = countChars(nonJSPreface, '\\n');\n } else {\n nonJSPreface = '';\n nonJSPrefaceLineCount = 0;\n }\n\n nonJSPrefacingLines += lastStringCount + preMatchLines + nonJSPrefaceLineCount;\n\n // Ignore `preMatch` delta if newlines here\n if (nonJSPrefaceLineCount) {\n const charsInLastLine = nonJSPreface.slice(nonJSPreface.lastIndexOf('\\n') + 1).length;\n\n nonJSPrefacingCols += charsInLastLine;\n } else {\n nonJSPrefacingCols += colDelta + nonJSPreface.length;\n }\n\n const string = n1 || n0;\n sources.push({\n nonJSPrefacingCols,\n nonJSPrefacingLines,\n string,\n });\n startingIndex = exampleCodeRegex.lastIndex;\n lastStringCount = countChars(string, '\\n');\n if (!exampleCodeRegex.global) {\n break;\n }\n }\n\n skipInit = true;\n }\n\n checkSource({\n cols,\n lines,\n rules: mdRules,\n skipInit,\n source,\n sources,\n tag,\n targetTagName,\n ...matchingFilenameInfo,\n });\n });\n}, {\n iterateAllJsdocs: true,\n meta: {\n docs: {\n description: '@deprecated - Use `getJsdocProcessorPlugin` processor; ensures that (JavaScript) samples within `@example` tags adhere to ESLint rules.',\n url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/check-examples.md#repos-sticky-header',\n },\n schema: [\n {\n additionalProperties: false,\n properties: {\n allowInlineConfig: {\n default: true,\n type: 'boolean',\n },\n baseConfig: {\n type: 'object',\n },\n captionRequired: {\n default: false,\n type: 'boolean',\n },\n checkDefaults: {\n default: false,\n type: 'boolean',\n },\n checkEslintrc: {\n default: true,\n type: 'boolean',\n },\n checkParams: {\n default: false,\n type: 'boolean',\n },\n checkProperties: {\n default: false,\n type: 'boolean',\n },\n configFile: {\n type: 'string',\n },\n exampleCodeRegex: {\n type: 'string',\n },\n matchingFileName: {\n type: 'string',\n },\n matchingFileNameDefaults: {\n type: 'string',\n },\n matchingFileNameParams: {\n type: 'string',\n },\n matchingFileNameProperties: {\n type: 'string',\n },\n noDefaultExampleRules: {\n default: false,\n type: 'boolean',\n },\n paddedIndent: {\n default: 0,\n type: 'integer',\n },\n rejectExampleCodeRegex: {\n type: 'string',\n },\n reportUnusedDisableDirectives: {\n default: true,\n type: 'boolean',\n },\n },\n type: 'object',\n },\n ],\n type: 'suggestion',\n },\n});\n"],"mappings":";;;;;;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,CAAC;QACD,UAAU,EAAE;UACV,IAAI,EAAE;QACR,CAAC;QACD,gBAAgB,EAAE;UAChB,IAAI,EAAE;QACR,CAAC;QACD,gBAAgB,EAAE;UAChB,IAAI,EAAE;QACR,CAAC;QACD,wBAAwB,EAAE;UACxB,IAAI,EAAE;QACR,CAAC;QACD,sBAAsB,EAAE;UACtB,IAAI,EAAE;QACR,CAAC;QACD,0BAA0B,EAAE;UAC1B,IAAI,EAAE;QACR,CAAC;QACD,qBAAqB,EAAE;UACrB,OAAO,EAAE,KAAK;UACd,IAAI,EAAE;QACR,CAAC;QACD,YAAY,EAAE;UACZ,OAAO,EAAE,CAAC;UACV,IAAI,EAAE;QACR,CAAC;QACD,sBAAsB,EAAE;UACtB,IAAI,EAAE;QACR,CAAC;QACD,6BAA6B,EAAE;UAC7B,OAAO,EAAE,IAAI;UACb,IAAI,EAAE;QACR;MACF,CAAC;MACD,IAAI,EAAE;IACR,CAAC,CACF;IACD,IAAI,EAAE;EACR;AACF,CAAC,CAAC;AAAA","ignoreList":[]}
@@ -1,5 +1,11 @@
1
- import iterateJsdoc from '../iterateJsdoc.js';
1
+ "use strict";
2
2
 
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _iterateJsdoc = _interopRequireDefault(require("../iterateJsdoc.cjs"));
8
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
3
9
  /**
4
10
  * @param {string} str
5
11
  * @param {string[]} excludeTags
@@ -33,7 +39,7 @@ const getLineNumber = (lines, lineIndex) => {
33
39
  const lineBreaks = precedingText.match(/\n/gv) || [];
34
40
  return lineBreaks.length + 1;
35
41
  };
36
- export default iterateJsdoc(({
42
+ var _default = exports.default = (0, _iterateJsdoc.default)(({
37
43
  context,
38
44
  jsdocNode,
39
45
  report,
@@ -160,4 +166,5 @@ report a padding issue:
160
166
  type: 'layout'
161
167
  }
162
168
  });
169
+ module.exports = exports.default;
163
170
  //# sourceMappingURL=checkIndentation.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"checkIndentation.cjs","names":[],"sources":["../../src/rules/checkIndentation.js"],"sourcesContent":["import iterateJsdoc from '../iterateJsdoc.js';\n\n/**\n * @param {string} str\n * @param {string[]} excludeTags\n * @returns {string}\n */\nconst maskExcludedContent = (str, excludeTags) => {\n const regContent = new RegExp(`([ \\\\t]+\\\\*)[ \\\\t]@(?:${excludeTags.join('|')})(?=[ \\\\n])([\\\\w\\\\|\\\\W]*?\\\\n)(?=[ \\\\t]*\\\\*(?:[ \\\\t]*@\\\\w+\\\\s|\\\\/))`, 'gv');\n\n return str.replace(regContent, (_match, margin, code) => {\n return (margin + '\\n').repeat(code.match(/\\n/gv).length);\n });\n};\n\n/**\n * @param {string} str\n * @returns {string}\n */\nconst maskCodeBlocks = (str) => {\n const regContent = /([ \\t]+\\*)[ \\t]```[^\\n]*?([\\w\\|\\W]*?\\n)(?=[ \\t]*\\*(?:[ \\t]*(?:```|@\\w+\\s)|\\/))/gv;\n\n return str.replaceAll(regContent, (_match, margin, code) => {\n return (margin + '\\n').repeat(code.match(/\\n/gv).length);\n });\n};\n\n/**\n * @param {string[]} lines\n * @param {number} lineIndex\n * @returns {number}\n */\nconst getLineNumber = (lines, lineIndex) => {\n const precedingText = lines.slice(0, lineIndex).join('\\n');\n const lineBreaks = precedingText.match(/\\n/gv) || [];\n return lineBreaks.length + 1;\n};\n\nexport default iterateJsdoc(({\n context,\n jsdocNode,\n report,\n sourceCode,\n}) => {\n const options = context.options[0] || {};\n const /** @type {{excludeTags: string[], allowIndentedSections: boolean}} */ {\n allowIndentedSections = false,\n excludeTags = [\n 'example',\n ],\n } = options;\n\n const textWithoutCodeBlocks = maskCodeBlocks(sourceCode.getText(jsdocNode));\n const text = excludeTags.length ? maskExcludedContent(textWithoutCodeBlocks, excludeTags) : textWithoutCodeBlocks;\n\n if (allowIndentedSections) {\n // When allowIndentedSections is enabled, only check for indentation on tag lines\n // and the very first line of the main description\n const lines = text.split('\\n');\n let hasSeenContent = false;\n let currentSectionIndent = null;\n\n for (const [\n lineIndex,\n line,\n ] of lines.entries()) {\n // Check for indentation (two or more spaces after *)\n const indentMatch = line.match(/^(?:\\/?\\**|[\\t ]*)\\*([\\t ]{2,})/v);\n\n if (indentMatch) {\n // Check what comes after the indentation\n const afterIndent = line.slice(indentMatch[0].length);\n const indentAmount = indentMatch[1].length;\n\n // If this is a tag line with indentation, always report\n if (/^@\\w+/v.test(afterIndent)) {\n report('There must be no indentation.', null, {\n line: getLineNumber(lines, lineIndex),\n });\n return;\n }\n\n // If we haven't seen any content yet (main description first line) and there's content, report\n if (!hasSeenContent && afterIndent.trim().length > 0) {\n report('There must be no indentation.', null, {\n line: getLineNumber(lines, lineIndex),\n });\n return;\n }\n\n // For continuation lines, check consistency\n if (hasSeenContent && afterIndent.trim().length > 0) {\n if (currentSectionIndent === null) {\n // First indented line in this section, set the indent level\n currentSectionIndent = indentAmount;\n } else if (indentAmount < currentSectionIndent) {\n // Indentation is less than the established level (inconsistent)\n report('There must be no indentation.', null, {\n line: getLineNumber(lines, lineIndex),\n });\n return;\n }\n }\n } else if (/^\\s*\\*\\s+\\S/v.test(line)) {\n // No indentation on this line, reset section indent tracking\n // (unless it's just whitespace or a closing comment)\n currentSectionIndent = null;\n }\n\n // Track if we've seen any content (non-whitespace after the *)\n if (/^\\s*\\*\\s+\\S/v.test(line)) {\n hasSeenContent = true;\n }\n\n // Reset section indent when we encounter a tag\n if (/@\\w+/v.test(line)) {\n currentSectionIndent = null;\n }\n }\n } else {\n const reg = /^(?:\\/?\\**|[ \\t]*)\\*[ \\t]{2}/gmv;\n if (reg.test(text)) {\n const lineBreaks = text.slice(0, reg.lastIndex).match(/\\n/gv) || [];\n report('There must be no indentation.', null, {\n line: lineBreaks.length,\n });\n }\n }\n}, {\n iterateAllJsdocs: true,\n meta: {\n docs: {\n description: 'Reports invalid padding inside JSDoc blocks.',\n url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/check-indentation.md#repos-sticky-header',\n },\n schema: [\n {\n additionalProperties: false,\n properties: {\n allowIndentedSections: {\n description: 'Allows indentation of nested sections on subsequent lines (like bullet lists)',\n type: 'boolean',\n },\n excludeTags: {\n description: `Array of tags (e.g., \\`['example', 'description']\\`) whose content will be\n\"hidden\" from the \\`check-indentation\\` rule. Defaults to \\`['example']\\`.\n\nBy default, the whole JSDoc block will be checked for invalid padding.\nThat would include \\`@example\\` blocks too, which can get in the way\nof adding full, readable examples of code without ending up with multiple\nlinting issues.\n\nWhen disabled (by passing \\`excludeTags: []\\` option), the following code *will*\nreport a padding issue:\n\n\\`\\`\\`js\n/**\n * @example\n * anArray.filter((a) => {\n * return a.b;\n * });\n */\n\\`\\`\\``,\n items: {\n pattern: '^\\\\S+$',\n type: 'string',\n },\n type: 'array',\n },\n },\n type: 'object',\n },\n ],\n type: 'layout',\n },\n});\n"],"mappings":"AAAA,OAAO,YAAY,MAAM,oBAAoB;;AAE7C;AACA;AACA;AACA;AACA;AACA,MAAM,mBAAmB,GAAG,CAAC,GAAG,EAAE,WAAW,KAAK;EAChD,MAAM,UAAU,GAAG,IAAI,MAAM,CAAC,yBAAyB,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC,oEAAoE,EAAE,IAAI,CAAC;EAEvJ,OAAO,GAAG,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,KAAK;IACvD,OAAO,CAAC,MAAM,GAAG,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC;EAC1D,CAAC,CAAC;AACJ,CAAC;;AAED;AACA;AACA;AACA;AACA,MAAM,cAAc,GAAI,GAAG,IAAK;EAC9B,MAAM,UAAU,GAAG,kFAAkF;EAErG,OAAO,GAAG,CAAC,UAAU,CAAC,UAAU,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,KAAK;IAC1D,OAAO,CAAC,MAAM,GAAG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C7C,IAAI,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;MAClB,MAAM,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,SAAS,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,EAAE;MACnE,MAAM,CAAC,+BAA+B,EAAE,IAAI,EAAE;QAC5C,IAAI,EAAE,UAAU,CAAC;MACnB,CAAC,CAAC;IACJ;EACF;AACF,CAAC,EAAE;EACD,gBAAgB,EAAE,IAAI;EACtB,IAAI,EAAE;IACJ,IAAI,EAAE;MACJ,WAAW,EAAE,8CAA8C;MAC3D,GAAG,EAAE;IACP,CAAC;IACD,MAAM,EAAE,CACN;MACE,oBAAoB,EAAE,KAAK;MAC3B,UAAU,EAAE;QACV,qBAAqB,EAAE;UACrB,WAAW,EAAE,+EAA+E;UAC5F,IAAI,EAAE;QACR,CAAC;QACD,WAAW,EAAE;UACX,WAAW,EAAE;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;UACK,KAAK,EAAE;YACL,OAAO,EAAE,QAAQ;YACjB,IAAI,EAAE;UACR,CAAC;UACD,IAAI,EAAE;QACR;MACF,CAAC;MACD,IAAI,EAAE;IACR,CAAC,CACF;IACD,IAAI,EAAE;EACR;AACF,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"checkIndentation.cjs","names":["iterateJsdoc"],"sources":["../../src/rules/checkIndentation.js"],"sourcesContent":["import iterateJsdoc from '../iterateJsdoc.js';\n\n/**\n * @param {string} str\n * @param {string[]} excludeTags\n * @returns {string}\n */\nconst maskExcludedContent = (str, excludeTags) => {\n const regContent = new RegExp(`([ \\\\t]+\\\\*)[ \\\\t]@(?:${excludeTags.join('|')})(?=[ \\\\n])([\\\\w\\\\|\\\\W]*?\\\\n)(?=[ \\\\t]*\\\\*(?:[ \\\\t]*@\\\\w+\\\\s|\\\\/))`, 'gv');\n\n return str.replace(regContent, (_match, margin, code) => {\n return (margin + '\\n').repeat(code.match(/\\n/gv).length);\n });\n};\n\n/**\n * @param {string} str\n * @returns {string}\n */\nconst maskCodeBlocks = (str) => {\n const regContent = /([ \\t]+\\*)[ \\t]```[^\\n]*?([\\w\\|\\W]*?\\n)(?=[ \\t]*\\*(?:[ \\t]*(?:```|@\\w+\\s)|\\/))/gv;\n\n return str.replaceAll(regContent, (_match, margin, code) => {\n return (margin + '\\n').repeat(code.match(/\\n/gv).length);\n });\n};\n\n/**\n * @param {string[]} lines\n * @param {number} lineIndex\n * @returns {number}\n */\nconst getLineNumber = (lines, lineIndex) => {\n const precedingText = lines.slice(0, lineIndex).join('\\n');\n const lineBreaks = precedingText.match(/\\n/gv) || [];\n return lineBreaks.length + 1;\n};\n\nexport default iterateJsdoc(({\n context,\n jsdocNode,\n report,\n sourceCode,\n}) => {\n const options = context.options[0] || {};\n const /** @type {{excludeTags: string[], allowIndentedSections: boolean}} */ {\n allowIndentedSections = false,\n excludeTags = [\n 'example',\n ],\n } = options;\n\n const textWithoutCodeBlocks = maskCodeBlocks(sourceCode.getText(jsdocNode));\n const text = excludeTags.length ? maskExcludedContent(textWithoutCodeBlocks, excludeTags) : textWithoutCodeBlocks;\n\n if (allowIndentedSections) {\n // When allowIndentedSections is enabled, only check for indentation on tag lines\n // and the very first line of the main description\n const lines = text.split('\\n');\n let hasSeenContent = false;\n let currentSectionIndent = null;\n\n for (const [\n lineIndex,\n line,\n ] of lines.entries()) {\n // Check for indentation (two or more spaces after *)\n const indentMatch = line.match(/^(?:\\/?\\**|[\\t ]*)\\*([\\t ]{2,})/v);\n\n if (indentMatch) {\n // Check what comes after the indentation\n const afterIndent = line.slice(indentMatch[0].length);\n const indentAmount = indentMatch[1].length;\n\n // If this is a tag line with indentation, always report\n if (/^@\\w+/v.test(afterIndent)) {\n report('There must be no indentation.', null, {\n line: getLineNumber(lines, lineIndex),\n });\n return;\n }\n\n // If we haven't seen any content yet (main description first line) and there's content, report\n if (!hasSeenContent && afterIndent.trim().length > 0) {\n report('There must be no indentation.', null, {\n line: getLineNumber(lines, lineIndex),\n });\n return;\n }\n\n // For continuation lines, check consistency\n if (hasSeenContent && afterIndent.trim().length > 0) {\n if (currentSectionIndent === null) {\n // First indented line in this section, set the indent level\n currentSectionIndent = indentAmount;\n } else if (indentAmount < currentSectionIndent) {\n // Indentation is less than the established level (inconsistent)\n report('There must be no indentation.', null, {\n line: getLineNumber(lines, lineIndex),\n });\n return;\n }\n }\n } else if (/^\\s*\\*\\s+\\S/v.test(line)) {\n // No indentation on this line, reset section indent tracking\n // (unless it's just whitespace or a closing comment)\n currentSectionIndent = null;\n }\n\n // Track if we've seen any content (non-whitespace after the *)\n if (/^\\s*\\*\\s+\\S/v.test(line)) {\n hasSeenContent = true;\n }\n\n // Reset section indent when we encounter a tag\n if (/@\\w+/v.test(line)) {\n currentSectionIndent = null;\n }\n }\n } else {\n const reg = /^(?:\\/?\\**|[ \\t]*)\\*[ \\t]{2}/gmv;\n if (reg.test(text)) {\n const lineBreaks = text.slice(0, reg.lastIndex).match(/\\n/gv) || [];\n report('There must be no indentation.', null, {\n line: lineBreaks.length,\n });\n }\n }\n}, {\n iterateAllJsdocs: true,\n meta: {\n docs: {\n description: 'Reports invalid padding inside JSDoc blocks.',\n url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/check-indentation.md#repos-sticky-header',\n },\n schema: [\n {\n additionalProperties: false,\n properties: {\n allowIndentedSections: {\n description: 'Allows indentation of nested sections on subsequent lines (like bullet lists)',\n type: 'boolean',\n },\n excludeTags: {\n description: `Array of tags (e.g., \\`['example', 'description']\\`) whose content will be\n\"hidden\" from the \\`check-indentation\\` rule. Defaults to \\`['example']\\`.\n\nBy default, the whole JSDoc block will be checked for invalid padding.\nThat would include \\`@example\\` blocks too, which can get in the way\nof adding full, readable examples of code without ending up with multiple\nlinting issues.\n\nWhen disabled (by passing \\`excludeTags: []\\` option), the following code *will*\nreport a padding issue:\n\n\\`\\`\\`js\n/**\n * @example\n * anArray.filter((a) => {\n * return a.b;\n * });\n */\n\\`\\`\\``,\n items: {\n pattern: '^\\\\S+$',\n type: 'string',\n },\n type: 'array',\n },\n },\n type: 'object',\n },\n ],\n type: 'layout',\n },\n});\n"],"mappings":";;;;;;AAAA;AAA8C;AAE9C;AACA;AACA;AACA;AACA;AACA,MAAM,mBAAmB,GAAG,CAAC,GAAG,EAAE,WAAW,KAAK;EAChD,MAAM,UAAU,GAAG,IAAI,MAAM,CAAC,yBAAyB,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC,oEAAoE,EAAE,IAAI,CAAC;EAEvJ,OAAO,GAAG,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,KAAK;IACvD,OAAO,CAAC,MAAM,GAAG,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC;EAC1D,CAAC,CAAC;AACJ,CAAC;;AAED;AACA;AACA;AACA;AACA,MAAM,cAAc,GAAI,GAAG,IAAK;EAC9B,MAAM,UAAU,GAAG,kFAAkF;EAErG,OAAO,GAAG,CAAC,UAAU,CAAC,UAAU,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,KAAK;IAC1D,OAAO,CAAC,MAAM,GAAG,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC;EAC1D,CAAC,CAAC;AACJ,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA,MAAM,aAAa,GAAG,CAAC,KAAK,EAAE,SAAS,KAAK;EAC1C,MAAM,aAAa,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,SAAS,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;EAC1D,MAAM,UAAU,GAAG,aAAa,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,EAAE;EACpD,OAAO,UAAU,CAAC,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,8CAA8C;MAC3D,GAAG,EAAE;IACP,CAAC;IACD,MAAM,EAAE,CACN;MACE,oBAAoB,EAAE,KAAK;MAC3B,UAAU,EAAE;QACV,qBAAqB,EAAE;UACrB,WAAW,EAAE,+EAA+E;UAC5F,IAAI,EAAE;QACR,CAAC;QACD,WAAW,EAAE;UACX,WAAW,EAAE;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;UACK,KAAK,EAAE;YACL,OAAO,EAAE,QAAQ;YACjB,IAAI,EAAE;UACR,CAAC;UACD,IAAI,EAAE;QACR;MACF,CAAC;MACD,IAAI,EAAE;IACR,CAAC,CACF;IACD,IAAI,EAAE;EACR;AACF,CAAC,CAAC;AAAA","ignoreList":[]}
@@ -1,9 +1,16 @@
1
- import alignTransform from '../alignTransform.js';
2
- import iterateJsdoc from '../iterateJsdoc.js';
3
- import { transforms } from 'comment-parser';
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _alignTransform = _interopRequireDefault(require("../alignTransform.cjs"));
8
+ var _iterateJsdoc = _interopRequireDefault(require("../iterateJsdoc.cjs"));
9
+ var _commentParser = require("comment-parser");
10
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
4
11
  const {
5
12
  flow: commentFlow
6
- } = transforms;
13
+ } = _commentParser.transforms;
7
14
 
8
15
  /**
9
16
  * Detects if a line starts with a markdown list marker
@@ -200,7 +207,7 @@ const checkAlignment = ({
200
207
  utils,
201
208
  wrapIndent
202
209
  }) => {
203
- const transform = commentFlow(alignTransform({
210
+ const transform = commentFlow((0, _alignTransform.default)({
204
211
  customSpacings,
205
212
  disableWrapIndent,
206
213
  indent,
@@ -223,7 +230,7 @@ const checkAlignment = ({
223
230
  });
224
231
  }
225
232
  };
226
- export default iterateJsdoc(({
233
+ var _default = exports.default = (0, _iterateJsdoc.default)(({
227
234
  context,
228
235
  indent,
229
236
  jsdoc,
@@ -387,4 +394,5 @@ Default to the empty string (no indent).`,
387
394
  type: 'layout'
388
395
  }
389
396
  });
397
+ module.exports = exports.default;
390
398
  //# sourceMappingURL=checkLineAlignment.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"checkLineAlignment.cjs","names":[],"sources":["../../src/rules/checkLineAlignment.js"],"sourcesContent":["import alignTransform from '../alignTransform.js';\nimport iterateJsdoc from '../iterateJsdoc.js';\nimport {\n transforms,\n} from 'comment-parser';\n\nconst {\n flow: commentFlow,\n} = transforms;\n\n/**\n * Detects if a line starts with a markdown list marker\n * Supports: -, *, numbered lists (1., 2., etc.)\n * This explicitly excludes hyphens that are part of JSDoc tag syntax\n * @param {string} text - The text to check\n * @param {boolean} isFirstLineOfTag - True if this is the first line (tag line)\n * @returns {boolean} - True if the text starts with a list marker\n */\nconst startsWithListMarker = (text, isFirstLineOfTag = false) => {\n // On the first line of a tag, the hyphen is typically the JSDoc separator,\n // not a list marker\n if (isFirstLineOfTag) {\n return false;\n }\n\n // Match lines that start with optional whitespace, then a list marker\n // - or * followed by a space\n // or a number followed by . or ) and a space\n return /^\\s*(?:[\\-*]|\\d+(?:\\.|\\)))\\s+/v.test(text);\n};\n\n/**\n * Checks if we should allow extra indentation beyond wrapIndent.\n * This is true for list continuation lines (lines with more indent than wrapIndent\n * that follow a list item).\n * @param {import('comment-parser').Spec} tag - The tag being checked\n * @param {import('../iterateJsdoc.js').Integer} idx - Current line index (0-based in tag.source.slice(1))\n * @returns {boolean} - True if extra indentation should be allowed\n */\nconst shouldAllowExtraIndent = (tag, idx) => {\n // Check if any previous line in this tag had a list marker\n // idx is 0-based in the continuation lines (tag.source.slice(1))\n // So tag.source[0] is the tag line, tag.source[idx+1] is current line\n let hasSeenListMarker = false;\n\n // Check all lines from the tag line onwards\n for (let lineIdx = 0; lineIdx <= idx + 1; lineIdx++) {\n const line = tag.source[lineIdx];\n const isFirstLine = lineIdx === 0;\n if (line?.tokens?.description && startsWithListMarker(line.tokens.description, isFirstLine)) {\n hasSeenListMarker = true;\n break;\n }\n }\n\n return hasSeenListMarker;\n};\n\n/**\n * @typedef {{\n * postDelimiter: import('../iterateJsdoc.js').Integer,\n * postHyphen: import('../iterateJsdoc.js').Integer,\n * postName: import('../iterateJsdoc.js').Integer,\n * postTag: import('../iterateJsdoc.js').Integer,\n * postType: import('../iterateJsdoc.js').Integer,\n * }} CustomSpacings\n */\n\n/**\n * @param {import('../iterateJsdoc.js').Utils} utils\n * @param {import('comment-parser').Spec & {\n * line: import('../iterateJsdoc.js').Integer\n * }} tag\n * @param {CustomSpacings} customSpacings\n */\nconst checkNotAlignedPerTag = (utils, tag, customSpacings) => {\n /*\n start +\n delimiter +\n postDelimiter +\n tag +\n postTag +\n type +\n postType +\n name +\n postName +\n description +\n end +\n lineEnd\n */\n\n /**\n * @typedef {\"tag\"|\"type\"|\"name\"|\"description\"} ContentProp\n */\n\n /** @type {(\"postDelimiter\"|\"postTag\"|\"postType\"|\"postName\")[]} */\n let spacerProps;\n /** @type {ContentProp[]} */\n let contentProps;\n const mightHaveNamepath = utils.tagMightHaveNameOrNamepath(tag.tag);\n if (mightHaveNamepath) {\n spacerProps = [\n 'postDelimiter', 'postTag', 'postType', 'postName',\n ];\n contentProps = [\n 'tag', 'type', 'name', 'description',\n ];\n } else {\n spacerProps = [\n 'postDelimiter', 'postTag', 'postType',\n ];\n contentProps = [\n 'tag', 'type', 'description',\n ];\n }\n\n const {\n tokens,\n } = tag.source[0];\n\n /**\n * @param {import('../iterateJsdoc.js').Integer} idx\n * @param {(notRet: boolean, contentProp: ContentProp) => void} [callbck]\n */\n const followedBySpace = (idx, callbck) => {\n const nextIndex = idx + 1;\n\n return spacerProps.slice(nextIndex).some((spacerProp, innerIdx) => {\n const contentProp = contentProps[nextIndex + innerIdx];\n\n const spacePropVal = tokens[spacerProp];\n\n const ret = spacePropVal;\n\n if (callbck) {\n callbck(!ret, contentProp);\n }\n\n return ret && (callbck || !contentProp);\n });\n };\n\n const postHyphenSpacing = customSpacings?.postHyphen ?? 1;\n const exactHyphenSpacing = new RegExp(`^\\\\s*-\\\\s{${postHyphenSpacing},${postHyphenSpacing}}(?!\\\\s)`, 'v');\n const hasNoHyphen = !(/^\\s*-(?!$)(?=\\s)/v).test(tokens.description);\n const hasExactHyphenSpacing = exactHyphenSpacing.test(\n tokens.description,\n );\n\n // If checking alignment on multiple lines, need to check other `source`\n // items\n // Go through `post*` spacing properties and exit to indicate problem if\n // extra spacing detected\n const ok = !spacerProps.some((spacerProp, idx) => {\n const contentProp = contentProps[idx];\n const contentPropVal = tokens[contentProp];\n const spacerPropVal = tokens[spacerProp];\n const spacing = customSpacings?.[spacerProp] || 1;\n\n // There will be extra alignment if...\n\n // 1. The spaces don't match the space it should have (1 or custom spacing) OR\n return spacerPropVal.length !== spacing && spacerPropVal.length !== 0 ||\n\n // 2. There is a (single) space, no immediate content, and yet another\n // space is found subsequently (not separated by intervening content)\n spacerPropVal && !contentPropVal && followedBySpace(idx);\n }) && (hasNoHyphen || hasExactHyphenSpacing);\n if (ok) {\n return;\n }\n\n const fix = () => {\n for (const [\n idx,\n spacerProp,\n ] of spacerProps.entries()) {\n const contentProp = contentProps[idx];\n const contentPropVal = tokens[contentProp];\n\n if (contentPropVal) {\n const spacing = customSpacings?.[spacerProp] || 1;\n tokens[spacerProp] = ''.padStart(spacing, ' ');\n followedBySpace(idx, (hasSpace, contentPrp) => {\n if (hasSpace) {\n tokens[contentPrp] = '';\n }\n });\n } else {\n tokens[spacerProp] = '';\n }\n }\n\n if (!hasExactHyphenSpacing) {\n const hyphenSpacing = /^\\s*-\\s+/v;\n tokens.description = tokens.description.replace(\n hyphenSpacing, '-' + ''.padStart(postHyphenSpacing, ' '),\n );\n }\n\n utils.setTag(tag, tokens);\n };\n\n utils.reportJSDoc('Expected JSDoc block lines to not be aligned.', tag, fix, true);\n};\n\n/**\n * @param {object} cfg\n * @param {CustomSpacings} cfg.customSpacings\n * @param {string} cfg.indent\n * @param {import('comment-parser').Block} cfg.jsdoc\n * @param {import('eslint').Rule.Node & {\n * range: [number, number]\n * }} cfg.jsdocNode\n * @param {boolean} cfg.preserveMainDescriptionPostDelimiter\n * @param {import('../iterateJsdoc.js').Report} cfg.report\n * @param {string[]} cfg.tags\n * @param {import('../iterateJsdoc.js').Utils} cfg.utils\n * @param {string} cfg.wrapIndent\n * @param {boolean} cfg.disableWrapIndent\n * @returns {void}\n */\nconst checkAlignment = ({\n customSpacings,\n disableWrapIndent,\n indent,\n jsdoc,\n jsdocNode,\n preserveMainDescriptionPostDelimiter,\n report,\n tags,\n utils,\n wrapIndent,\n}) => {\n const transform = commentFlow(\n alignTransform({\n customSpacings,\n disableWrapIndent,\n indent,\n preserveMainDescriptionPostDelimiter,\n tags,\n wrapIndent,\n }),\n );\n const transformedJsdoc = transform(jsdoc);\n\n const comment = '/*' +\n /**\n * @type {import('eslint').Rule.Node & {\n * range: [number, number], value: string\n * }}\n */ (jsdocNode).value + '*/';\n\n const formatted = utils.stringify(transformedJsdoc)\n .trimStart();\n\n if (comment !== formatted) {\n report(\n 'Expected JSDoc block lines to be aligned.',\n /** @type {import('eslint').Rule.ReportFixer} */ (fixer) => {\n return fixer.replaceText(jsdocNode, formatted);\n },\n );\n }\n};\n\nexport default iterateJsdoc(({\n context,\n indent,\n jsdoc,\n jsdocNode,\n report,\n utils,\n}) => {\n const {\n customSpacings,\n disableWrapIndent = false,\n preserveMainDescriptionPostDelimiter,\n tags: applicableTags = [\n 'param', 'arg', 'argument', 'property', 'prop', 'returns', 'return', 'template',\n ],\n wrapIndent = '',\n } = context.options[1] || {};\n\n if (context.options[0] === 'always') {\n // Skip if it contains only a single line.\n if (!(\n /**\n * @type {import('eslint').Rule.Node & {\n * range: [number, number], value: string\n * }}\n */\n (jsdocNode).value.includes('\\n')\n )) {\n return;\n }\n\n checkAlignment({\n customSpacings,\n disableWrapIndent,\n indent,\n jsdoc,\n jsdocNode,\n preserveMainDescriptionPostDelimiter,\n report,\n tags: applicableTags,\n utils,\n wrapIndent,\n });\n\n return;\n }\n\n const foundTags = utils.getPresentTags(applicableTags);\n if (context.options[0] !== 'any') {\n for (const tag of foundTags) {\n checkNotAlignedPerTag(\n utils,\n /**\n * @type {import('comment-parser').Spec & {\n * line: import('../iterateJsdoc.js').Integer\n * }}\n */\n (tag),\n customSpacings,\n );\n }\n }\n\n for (const tag of foundTags) {\n if (tag.source.length > 1) {\n let idx = 0;\n for (const {\n tokens,\n // Avoid the tag line\n } of tag.source.slice(1)) {\n idx++;\n\n if (\n !tokens.description ||\n // Avoid first lines after multiline type\n tokens.type ||\n tokens.name\n ) {\n continue;\n }\n\n // Don't include a single separating space/tab\n const actualIndent = tokens.postDelimiter.slice(1);\n const hasCorrectWrapIndent = actualIndent === wrapIndent;\n\n // Allow extra indentation if this line or previous lines contain list markers\n // This preserves nested list structure\n const hasExtraIndent = actualIndent.length > wrapIndent.length &&\n actualIndent.startsWith(wrapIndent);\n const isInListContext = shouldAllowExtraIndent(tag, idx - 1);\n\n if (!disableWrapIndent && !hasCorrectWrapIndent &&\n !(hasExtraIndent && isInListContext)) {\n utils.reportJSDoc('Expected wrap indent', {\n line: tag.source[0].number + idx,\n }, () => {\n tokens.postDelimiter = tokens.postDelimiter.charAt(0) + wrapIndent;\n });\n return;\n }\n }\n }\n }\n}, {\n iterateAllJsdocs: true,\n meta: {\n docs: {\n description: 'Reports invalid alignment of JSDoc block lines.',\n url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/check-line-alignment.md#repos-sticky-header',\n },\n fixable: 'whitespace',\n schema: [\n {\n description: `If the string value is\n\\`\"always\"\\` then a problem is raised when the lines are not aligned.\nIf it is \\`\"never\"\\` then a problem should be raised when there is more than\none space between each line's parts. If it is \\`\"any\"\\`, no alignment is made.\nDefaults to \\`\"never\"\\`.\n\nNote that in addition to alignment, the \"never\" and \"always\" options will both\nensure that at least one space is present after the asterisk delimiter.`,\n enum: [\n 'always', 'never', 'any',\n ],\n type: 'string',\n },\n {\n additionalProperties: false,\n properties: {\n customSpacings: {\n additionalProperties: false,\n description: `An object with any of the following spacing keys set to an integer.\nIf a spacing is not defined, it defaults to one.`,\n properties: {\n postDelimiter: {\n description: 'Affects spacing after the asterisk (e.g., `* @param`)',\n type: 'integer',\n },\n postHyphen: {\n description: 'Affects spacing after any hyphens in the description (e.g., `* @param {someType} name - A description`)',\n type: 'integer',\n },\n postName: {\n description: 'Affects spacing after the name (e.g., `* @param {someType} name `)',\n type: 'integer',\n },\n postTag: {\n description: 'Affects spacing after the tag (e.g., `* @param `)',\n type: 'integer',\n },\n postType: {\n description: 'Affects spacing after the type (e.g., `* @param {someType} `)',\n type: 'integer',\n },\n },\n type: 'object',\n },\n disableWrapIndent: {\n description: 'Disables `wrapIndent`; existing wrap indentation is preserved without changes.',\n type: 'boolean',\n },\n preserveMainDescriptionPostDelimiter: {\n default: false,\n description: `A boolean to determine whether to preserve the post-delimiter spacing of the\nmain description. If \\`false\\` or unset, will be set to a single space.`,\n type: 'boolean',\n },\n tags: {\n description: `Use this to change the tags which are sought for alignment changes. Defaults to an array of\n\\`['param', 'arg', 'argument', 'property', 'prop', 'returns', 'return', 'template']\\`.`,\n items: {\n type: 'string',\n },\n type: 'array',\n },\n wrapIndent: {\n description: `The indent that will be applied for tag text after the first line.\nDefault to the empty string (no indent).`,\n type: 'string',\n },\n },\n type: 'object',\n },\n ],\n type: 'layout',\n },\n});\n"],"mappings":"AAAA,OAAO,cAAc,MAAM,sBAAsB;AACjD,OAAO,YAAY,MAAM,oBAAoB;AAC7C,SACE,UAAU,QACL,gBAAgB;AAEvB,MAAM;EACJ,IAAI,EAAE;AACR,CAAC,GAAG,UAAU;;AAEd;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM,oBAAoB,GAAG,CAAC,IAAI,EAAE,gBAAgB,GAAG,KAAK,KAAK;EAC/D;EACA;EACA,IAAI,gBAAgB,EAAE;IACpB,OAAO,KAAK;EACd;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UACD,IAAI,EAAE;QACR,CAAC;QACD,iBAAiB,EAAE;UACjB,WAAW,EAAE,gFAAgF;UAC7F,IAAI,EAAE;QACR,CAAC;QACD,oCAAoC,EAAE;UACpC,OAAO,EAAE,KAAK;UACd,WAAW,EAAE;AACzB,wEAAwE;UAC5D,IAAI,EAAE;QACR,CAAC;QACD,IAAI,EAAE;UACJ,WAAW,EAAE;AACzB,uFAAuF;UAC3E,KAAK,EAAE;YACL,IAAI,EAAE;UACR,CAAC;UACD,IAAI,EAAE;QACR,CAAC;QACD,UAAU,EAAE;UACV,WAAW,EAAE;AACzB,yCAAyC;UAC7B,IAAI,EAAE;QACR;MACF,CAAC;MACD,IAAI,EAAE;IACR,CAAC,CACF;IACD,IAAI,EAAE;EACR;AACF,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"checkLineAlignment.cjs","names":["transforms","alignTransform","iterateJsdoc"],"sources":["../../src/rules/checkLineAlignment.js"],"sourcesContent":["import alignTransform from '../alignTransform.js';\nimport iterateJsdoc from '../iterateJsdoc.js';\nimport {\n transforms,\n} from 'comment-parser';\n\nconst {\n flow: commentFlow,\n} = transforms;\n\n/**\n * Detects if a line starts with a markdown list marker\n * Supports: -, *, numbered lists (1., 2., etc.)\n * This explicitly excludes hyphens that are part of JSDoc tag syntax\n * @param {string} text - The text to check\n * @param {boolean} isFirstLineOfTag - True if this is the first line (tag line)\n * @returns {boolean} - True if the text starts with a list marker\n */\nconst startsWithListMarker = (text, isFirstLineOfTag = false) => {\n // On the first line of a tag, the hyphen is typically the JSDoc separator,\n // not a list marker\n if (isFirstLineOfTag) {\n return false;\n }\n\n // Match lines that start with optional whitespace, then a list marker\n // - or * followed by a space\n // or a number followed by . or ) and a space\n return /^\\s*(?:[\\-*]|\\d+(?:\\.|\\)))\\s+/v.test(text);\n};\n\n/**\n * Checks if we should allow extra indentation beyond wrapIndent.\n * This is true for list continuation lines (lines with more indent than wrapIndent\n * that follow a list item).\n * @param {import('comment-parser').Spec} tag - The tag being checked\n * @param {import('../iterateJsdoc.js').Integer} idx - Current line index (0-based in tag.source.slice(1))\n * @returns {boolean} - True if extra indentation should be allowed\n */\nconst shouldAllowExtraIndent = (tag, idx) => {\n // Check if any previous line in this tag had a list marker\n // idx is 0-based in the continuation lines (tag.source.slice(1))\n // So tag.source[0] is the tag line, tag.source[idx+1] is current line\n let hasSeenListMarker = false;\n\n // Check all lines from the tag line onwards\n for (let lineIdx = 0; lineIdx <= idx + 1; lineIdx++) {\n const line = tag.source[lineIdx];\n const isFirstLine = lineIdx === 0;\n if (line?.tokens?.description && startsWithListMarker(line.tokens.description, isFirstLine)) {\n hasSeenListMarker = true;\n break;\n }\n }\n\n return hasSeenListMarker;\n};\n\n/**\n * @typedef {{\n * postDelimiter: import('../iterateJsdoc.js').Integer,\n * postHyphen: import('../iterateJsdoc.js').Integer,\n * postName: import('../iterateJsdoc.js').Integer,\n * postTag: import('../iterateJsdoc.js').Integer,\n * postType: import('../iterateJsdoc.js').Integer,\n * }} CustomSpacings\n */\n\n/**\n * @param {import('../iterateJsdoc.js').Utils} utils\n * @param {import('comment-parser').Spec & {\n * line: import('../iterateJsdoc.js').Integer\n * }} tag\n * @param {CustomSpacings} customSpacings\n */\nconst checkNotAlignedPerTag = (utils, tag, customSpacings) => {\n /*\n start +\n delimiter +\n postDelimiter +\n tag +\n postTag +\n type +\n postType +\n name +\n postName +\n description +\n end +\n lineEnd\n */\n\n /**\n * @typedef {\"tag\"|\"type\"|\"name\"|\"description\"} ContentProp\n */\n\n /** @type {(\"postDelimiter\"|\"postTag\"|\"postType\"|\"postName\")[]} */\n let spacerProps;\n /** @type {ContentProp[]} */\n let contentProps;\n const mightHaveNamepath = utils.tagMightHaveNameOrNamepath(tag.tag);\n if (mightHaveNamepath) {\n spacerProps = [\n 'postDelimiter', 'postTag', 'postType', 'postName',\n ];\n contentProps = [\n 'tag', 'type', 'name', 'description',\n ];\n } else {\n spacerProps = [\n 'postDelimiter', 'postTag', 'postType',\n ];\n contentProps = [\n 'tag', 'type', 'description',\n ];\n }\n\n const {\n tokens,\n } = tag.source[0];\n\n /**\n * @param {import('../iterateJsdoc.js').Integer} idx\n * @param {(notRet: boolean, contentProp: ContentProp) => void} [callbck]\n */\n const followedBySpace = (idx, callbck) => {\n const nextIndex = idx + 1;\n\n return spacerProps.slice(nextIndex).some((spacerProp, innerIdx) => {\n const contentProp = contentProps[nextIndex + innerIdx];\n\n const spacePropVal = tokens[spacerProp];\n\n const ret = spacePropVal;\n\n if (callbck) {\n callbck(!ret, contentProp);\n }\n\n return ret && (callbck || !contentProp);\n });\n };\n\n const postHyphenSpacing = customSpacings?.postHyphen ?? 1;\n const exactHyphenSpacing = new RegExp(`^\\\\s*-\\\\s{${postHyphenSpacing},${postHyphenSpacing}}(?!\\\\s)`, 'v');\n const hasNoHyphen = !(/^\\s*-(?!$)(?=\\s)/v).test(tokens.description);\n const hasExactHyphenSpacing = exactHyphenSpacing.test(\n tokens.description,\n );\n\n // If checking alignment on multiple lines, need to check other `source`\n // items\n // Go through `post*` spacing properties and exit to indicate problem if\n // extra spacing detected\n const ok = !spacerProps.some((spacerProp, idx) => {\n const contentProp = contentProps[idx];\n const contentPropVal = tokens[contentProp];\n const spacerPropVal = tokens[spacerProp];\n const spacing = customSpacings?.[spacerProp] || 1;\n\n // There will be extra alignment if...\n\n // 1. The spaces don't match the space it should have (1 or custom spacing) OR\n return spacerPropVal.length !== spacing && spacerPropVal.length !== 0 ||\n\n // 2. There is a (single) space, no immediate content, and yet another\n // space is found subsequently (not separated by intervening content)\n spacerPropVal && !contentPropVal && followedBySpace(idx);\n }) && (hasNoHyphen || hasExactHyphenSpacing);\n if (ok) {\n return;\n }\n\n const fix = () => {\n for (const [\n idx,\n spacerProp,\n ] of spacerProps.entries()) {\n const contentProp = contentProps[idx];\n const contentPropVal = tokens[contentProp];\n\n if (contentPropVal) {\n const spacing = customSpacings?.[spacerProp] || 1;\n tokens[spacerProp] = ''.padStart(spacing, ' ');\n followedBySpace(idx, (hasSpace, contentPrp) => {\n if (hasSpace) {\n tokens[contentPrp] = '';\n }\n });\n } else {\n tokens[spacerProp] = '';\n }\n }\n\n if (!hasExactHyphenSpacing) {\n const hyphenSpacing = /^\\s*-\\s+/v;\n tokens.description = tokens.description.replace(\n hyphenSpacing, '-' + ''.padStart(postHyphenSpacing, ' '),\n );\n }\n\n utils.setTag(tag, tokens);\n };\n\n utils.reportJSDoc('Expected JSDoc block lines to not be aligned.', tag, fix, true);\n};\n\n/**\n * @param {object} cfg\n * @param {CustomSpacings} cfg.customSpacings\n * @param {string} cfg.indent\n * @param {import('comment-parser').Block} cfg.jsdoc\n * @param {import('eslint').Rule.Node & {\n * range: [number, number]\n * }} cfg.jsdocNode\n * @param {boolean} cfg.preserveMainDescriptionPostDelimiter\n * @param {import('../iterateJsdoc.js').Report} cfg.report\n * @param {string[]} cfg.tags\n * @param {import('../iterateJsdoc.js').Utils} cfg.utils\n * @param {string} cfg.wrapIndent\n * @param {boolean} cfg.disableWrapIndent\n * @returns {void}\n */\nconst checkAlignment = ({\n customSpacings,\n disableWrapIndent,\n indent,\n jsdoc,\n jsdocNode,\n preserveMainDescriptionPostDelimiter,\n report,\n tags,\n utils,\n wrapIndent,\n}) => {\n const transform = commentFlow(\n alignTransform({\n customSpacings,\n disableWrapIndent,\n indent,\n preserveMainDescriptionPostDelimiter,\n tags,\n wrapIndent,\n }),\n );\n const transformedJsdoc = transform(jsdoc);\n\n const comment = '/*' +\n /**\n * @type {import('eslint').Rule.Node & {\n * range: [number, number], value: string\n * }}\n */ (jsdocNode).value + '*/';\n\n const formatted = utils.stringify(transformedJsdoc)\n .trimStart();\n\n if (comment !== formatted) {\n report(\n 'Expected JSDoc block lines to be aligned.',\n /** @type {import('eslint').Rule.ReportFixer} */ (fixer) => {\n return fixer.replaceText(jsdocNode, formatted);\n },\n );\n }\n};\n\nexport default iterateJsdoc(({\n context,\n indent,\n jsdoc,\n jsdocNode,\n report,\n utils,\n}) => {\n const {\n customSpacings,\n disableWrapIndent = false,\n preserveMainDescriptionPostDelimiter,\n tags: applicableTags = [\n 'param', 'arg', 'argument', 'property', 'prop', 'returns', 'return', 'template',\n ],\n wrapIndent = '',\n } = context.options[1] || {};\n\n if (context.options[0] === 'always') {\n // Skip if it contains only a single line.\n if (!(\n /**\n * @type {import('eslint').Rule.Node & {\n * range: [number, number], value: string\n * }}\n */\n (jsdocNode).value.includes('\\n')\n )) {\n return;\n }\n\n checkAlignment({\n customSpacings,\n disableWrapIndent,\n indent,\n jsdoc,\n jsdocNode,\n preserveMainDescriptionPostDelimiter,\n report,\n tags: applicableTags,\n utils,\n wrapIndent,\n });\n\n return;\n }\n\n const foundTags = utils.getPresentTags(applicableTags);\n if (context.options[0] !== 'any') {\n for (const tag of foundTags) {\n checkNotAlignedPerTag(\n utils,\n /**\n * @type {import('comment-parser').Spec & {\n * line: import('../iterateJsdoc.js').Integer\n * }}\n */\n (tag),\n customSpacings,\n );\n }\n }\n\n for (const tag of foundTags) {\n if (tag.source.length > 1) {\n let idx = 0;\n for (const {\n tokens,\n // Avoid the tag line\n } of tag.source.slice(1)) {\n idx++;\n\n if (\n !tokens.description ||\n // Avoid first lines after multiline type\n tokens.type ||\n tokens.name\n ) {\n continue;\n }\n\n // Don't include a single separating space/tab\n const actualIndent = tokens.postDelimiter.slice(1);\n const hasCorrectWrapIndent = actualIndent === wrapIndent;\n\n // Allow extra indentation if this line or previous lines contain list markers\n // This preserves nested list structure\n const hasExtraIndent = actualIndent.length > wrapIndent.length &&\n actualIndent.startsWith(wrapIndent);\n const isInListContext = shouldAllowExtraIndent(tag, idx - 1);\n\n if (!disableWrapIndent && !hasCorrectWrapIndent &&\n !(hasExtraIndent && isInListContext)) {\n utils.reportJSDoc('Expected wrap indent', {\n line: tag.source[0].number + idx,\n }, () => {\n tokens.postDelimiter = tokens.postDelimiter.charAt(0) + wrapIndent;\n });\n return;\n }\n }\n }\n }\n}, {\n iterateAllJsdocs: true,\n meta: {\n docs: {\n description: 'Reports invalid alignment of JSDoc block lines.',\n url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/check-line-alignment.md#repos-sticky-header',\n },\n fixable: 'whitespace',\n schema: [\n {\n description: `If the string value is\n\\`\"always\"\\` then a problem is raised when the lines are not aligned.\nIf it is \\`\"never\"\\` then a problem should be raised when there is more than\none space between each line's parts. If it is \\`\"any\"\\`, no alignment is made.\nDefaults to \\`\"never\"\\`.\n\nNote that in addition to alignment, the \"never\" and \"always\" options will both\nensure that at least one space is present after the asterisk delimiter.`,\n enum: [\n 'always', 'never', 'any',\n ],\n type: 'string',\n },\n {\n additionalProperties: false,\n properties: {\n customSpacings: {\n additionalProperties: false,\n description: `An object with any of the following spacing keys set to an integer.\nIf a spacing is not defined, it defaults to one.`,\n properties: {\n postDelimiter: {\n description: 'Affects spacing after the asterisk (e.g., `* @param`)',\n type: 'integer',\n },\n postHyphen: {\n description: 'Affects spacing after any hyphens in the description (e.g., `* @param {someType} name - A description`)',\n type: 'integer',\n },\n postName: {\n description: 'Affects spacing after the name (e.g., `* @param {someType} name `)',\n type: 'integer',\n },\n postTag: {\n description: 'Affects spacing after the tag (e.g., `* @param `)',\n type: 'integer',\n },\n postType: {\n description: 'Affects spacing after the type (e.g., `* @param {someType} `)',\n type: 'integer',\n },\n },\n type: 'object',\n },\n disableWrapIndent: {\n description: 'Disables `wrapIndent`; existing wrap indentation is preserved without changes.',\n type: 'boolean',\n },\n preserveMainDescriptionPostDelimiter: {\n default: false,\n description: `A boolean to determine whether to preserve the post-delimiter spacing of the\nmain description. If \\`false\\` or unset, will be set to a single space.`,\n type: 'boolean',\n },\n tags: {\n description: `Use this to change the tags which are sought for alignment changes. Defaults to an array of\n\\`['param', 'arg', 'argument', 'property', 'prop', 'returns', 'return', 'template']\\`.`,\n items: {\n type: 'string',\n },\n type: 'array',\n },\n wrapIndent: {\n description: `The indent that will be applied for tag text after the first line.\nDefault to the empty string (no indent).`,\n type: 'string',\n },\n },\n type: 'object',\n },\n ],\n type: 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YACR,CAAC;YACD,UAAU,EAAE;cACV,WAAW,EAAE,0GAA0G;cACvH,IAAI,EAAE;YACR,CAAC;YACD,QAAQ,EAAE;cACR,WAAW,EAAE,sEAAsE;cACnF,IAAI,EAAE;YACR,CAAC;YACD,OAAO,EAAE;cACP,WAAW,EAAE,oDAAoD;cACjE,IAAI,EAAE;YACR,CAAC;YACD,QAAQ,EAAE;cACR,WAAW,EAAE,iEAAiE;cAC9E,IAAI,EAAE;YACR;UACF,CAAC;UACD,IAAI,EAAE;QACR,CAAC;QACD,iBAAiB,EAAE;UACjB,WAAW,EAAE,gFAAgF;UAC7F,IAAI,EAAE;QACR,CAAC;QACD,oCAAoC,EAAE;UACpC,OAAO,EAAE,KAAK;UACd,WAAW,EAAE;AACzB,wEAAwE;UAC5D,IAAI,EAAE;QACR,CAAC;QACD,IAAI,EAAE;UACJ,WAAW,EAAE;AACzB,uFAAuF;UAC3E,KAAK,EAAE;YACL,IAAI,EAAE;UACR,CAAC;UACD,IAAI,EAAE;QACR,CAAC;QACD,UAAU,EAAE;UACV,WAAW,EAAE;AACzB,yCAAyC;UAC7B,IAAI,EAAE;QACR;MACF,CAAC;MACD,IAAI,EAAE;IACR,CAAC,CACF;IACD,IAAI,EAAE;EACR;AACF,CAAC,CAAC;AAAA","ignoreList":[]}
@@ -1,5 +1,11 @@
1
- import iterateJsdoc from '../iterateJsdoc.js';
1
+ "use strict";
2
2
 
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _iterateJsdoc = _interopRequireDefault(require("../iterateJsdoc.cjs"));
8
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
3
9
  /**
4
10
  * @param {string} targetTagName
5
11
  * @param {boolean} allowExtraTrailingParamDocs
@@ -254,7 +260,7 @@ const validateParameterNamesDeep = (targetTagName, _allowExtraTrailingParamDocs,
254
260
  const allowedNodes = ['ArrowFunctionExpression', 'FunctionDeclaration', 'FunctionExpression', 'TSDeclareFunction',
255
261
  // Add this to above defaults
256
262
  'TSMethodSignature', 'TSPropertySignature'];
257
- export default iterateJsdoc(({
263
+ var _default = exports.default = (0, _iterateJsdoc.default)(({
258
264
  context,
259
265
  jsdoc,
260
266
  node,
@@ -397,4 +403,5 @@ are present and can therefore be documented. Defaults to \`false\`.`,
397
403
  type: 'suggestion'
398
404
  }
399
405
  });
406
+ module.exports = exports.default;
400
407
  //# sourceMappingURL=checkParamNames.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"checkParamNames.cjs","names":[],"sources":["../../src/rules/checkParamNames.js"],"sourcesContent":["import iterateJsdoc from '../iterateJsdoc.js';\n\n/**\n * @param {string} targetTagName\n * @param {boolean} allowExtraTrailingParamDocs\n * @param {boolean} checkDestructured\n * @param {boolean} checkRestProperty\n * @param {RegExp} checkTypesRegex\n * @param {boolean} disableExtraPropertyReporting\n * @param {boolean} disableMissingParamChecks\n * @param {boolean} enableFixer\n * @param {import('../jsdocUtils.js').ParamNameInfo[]} functionParameterNames\n * @param {import('comment-parser').Block} jsdoc\n * @param {import('../iterateJsdoc.js').Utils} utils\n * @param {import('../iterateJsdoc.js').Report} report\n * @returns {boolean}\n */\nconst validateParameterNames = (\n targetTagName,\n allowExtraTrailingParamDocs,\n checkDestructured,\n checkRestProperty,\n checkTypesRegex,\n disableExtraPropertyReporting,\n disableMissingParamChecks,\n enableFixer,\n functionParameterNames, jsdoc, utils, report,\n) => {\n const paramTags = Object.entries(jsdoc.tags).filter(([\n , tag,\n ]) => {\n return tag.tag === targetTagName;\n });\n const paramTagsNonNested = paramTags.filter(([\n , tag,\n ]) => {\n return !tag.name.includes('.');\n });\n\n let dotted = 0;\n let thisOffset = 0;\n\n return paramTags.some(([\n , tag,\n // eslint-disable-next-line complexity\n ], index) => {\n /** @type {import('../iterateJsdoc.js').Integer} */\n let tagsIndex;\n const dupeTagInfo = paramTags.find(([\n tgsIndex,\n tg,\n ], idx) => {\n tagsIndex = Number(tgsIndex);\n\n return tg.name === tag.name && idx !== index;\n });\n if (dupeTagInfo) {\n utils.reportJSDoc(`Duplicate @${targetTagName} \"${tag.name}\"`, dupeTagInfo[1], enableFixer ? () => {\n utils.removeTag(tagsIndex);\n } : null);\n\n return true;\n }\n\n if (tag.name.includes('.')) {\n dotted++;\n\n return false;\n }\n\n let functionParameterName = functionParameterNames[index - dotted + thisOffset];\n if (functionParameterName === 'this' && tag.name.trim() !== 'this') {\n ++thisOffset;\n functionParameterName = functionParameterNames[index - dotted + thisOffset];\n }\n\n if (!functionParameterName) {\n if (allowExtraTrailingParamDocs) {\n return false;\n }\n\n report(\n `@${targetTagName} \"${tag.name}\" does not match an existing function parameter.`,\n null,\n tag,\n );\n\n return true;\n }\n\n if (\n typeof functionParameterName === 'object' &&\n 'name' in functionParameterName &&\n Array.isArray(functionParameterName.name)\n ) {\n const actualName = tag.name.trim();\n const expectedName = functionParameterName.name[index];\n if (actualName === expectedName) {\n thisOffset--;\n return false;\n }\n\n report(\n `Expected @${targetTagName} name to be \"${expectedName}\". Got \"${actualName}\".`,\n null,\n tag,\n );\n return true;\n }\n\n if (Array.isArray(functionParameterName)) {\n if (!checkDestructured) {\n return false;\n }\n\n if (tag.type && tag.type.search(checkTypesRegex) === -1) {\n return false;\n }\n\n const [\n parameterName,\n {\n annotationParamName,\n hasPropertyRest,\n names: properties,\n rests,\n },\n ] =\n /**\n * @type {[string | undefined, import('../jsdocUtils.js').FlattendRootInfo & {\n * annotationParamName?: string | undefined;\n }]} */ (functionParameterName);\n if (annotationParamName !== undefined) {\n const name = tag.name.trim();\n if (name !== annotationParamName) {\n report(`@${targetTagName} \"${name}\" does not match parameter name \"${annotationParamName}\"`, null, tag);\n }\n }\n\n const tagName = parameterName === undefined ? tag.name.trim() : parameterName;\n const expectedNames = properties.map((name) => {\n return `${tagName}.${name}`;\n });\n const actualNames = paramTags.map(([\n , paramTag,\n ]) => {\n return paramTag.name.trim();\n });\n const actualTypes = paramTags.map(([\n , paramTag,\n ]) => {\n return paramTag.type;\n });\n\n const missingProperties = [];\n\n /** @type {string[]} */\n const notCheckingNames = [];\n\n for (const [\n idx,\n name,\n ] of expectedNames.entries()) {\n if (notCheckingNames.some((notCheckingName) => {\n return name.startsWith(notCheckingName);\n })) {\n continue;\n }\n\n const actualNameIdx = actualNames.findIndex((actualName) => {\n return utils.comparePaths(name)(actualName);\n });\n if (actualNameIdx === -1) {\n if (!checkRestProperty && rests[idx]) {\n continue;\n }\n\n const missingIndex = actualNames.findIndex((actualName) => {\n return utils.pathDoesNotBeginWith(name, actualName);\n });\n const line = tag.source[0].number - 1 + (missingIndex > -1 ? missingIndex : actualNames.length);\n missingProperties.push({\n name,\n tagPlacement: {\n line: line === 0 ? 1 : line,\n },\n });\n } else if (actualTypes[actualNameIdx].search(checkTypesRegex) === -1 && actualTypes[actualNameIdx] !== '') {\n notCheckingNames.push(name);\n }\n }\n\n const hasMissing = missingProperties.length;\n if (hasMissing) {\n for (const {\n name: missingProperty,\n tagPlacement,\n } of missingProperties) {\n report(`Missing @${targetTagName} \"${missingProperty}\"`, null, tagPlacement);\n }\n }\n\n if (!hasPropertyRest || checkRestProperty) {\n /** @type {[string, import('comment-parser').Spec][]} */\n const extraProperties = [];\n for (const [\n idx,\n name,\n ] of actualNames.entries()) {\n const match = name.startsWith(tag.name.trim() + '.');\n if (\n match && !expectedNames.some(\n utils.comparePaths(name),\n ) && !utils.comparePaths(name)(tag.name) &&\n (!disableExtraPropertyReporting || properties.some((prop) => {\n return prop.split('.').length >= name.split('.').length - 1;\n }))\n ) {\n extraProperties.push([\n name, paramTags[idx][1],\n ]);\n }\n }\n\n if (extraProperties.length) {\n for (const [\n extraProperty,\n tg,\n ] of extraProperties) {\n report(`@${targetTagName} \"${extraProperty}\" does not exist on ${tag.name}`, null, tg);\n }\n\n return true;\n }\n }\n\n return hasMissing;\n }\n\n let funcParamName;\n if (typeof functionParameterName === 'object') {\n const {\n name,\n } = functionParameterName;\n funcParamName = name;\n } else {\n funcParamName = functionParameterName;\n }\n\n if (funcParamName !== tag.name.trim()) {\n // Todo: Improve for array or object child items\n const actualNames = paramTagsNonNested.map(([\n , {\n name,\n },\n ]) => {\n return name.trim();\n });\n\n const expectedNames = functionParameterNames.map((item, idx) => {\n if (/**\n * @type {[string|undefined, (import('../jsdocUtils.js').FlattendRootInfo & {\n * annotationParamName?: string,\n })]} */ (item)?.[1]?.names) {\n return actualNames[idx];\n }\n\n return item;\n }).filter((item) => {\n return item !== 'this';\n });\n\n // When disableMissingParamChecks is true tag names can be omitted.\n // Report when the tag names do not match the expected names or they are used out of order.\n if (disableMissingParamChecks) {\n const usedExpectedNames = expectedNames.map((a) => {\n return a?.toString();\n }).filter((expectedName) => {\n return expectedName && actualNames.includes(expectedName);\n });\n const usedInOrder = actualNames.every((actualName, idx) => {\n return actualName === usedExpectedNames[idx];\n });\n if (usedInOrder) {\n return false;\n }\n }\n\n report(\n `Expected @${targetTagName} names to be \"${\n expectedNames.map((expectedName) => {\n return typeof expectedName === 'object' &&\n 'name' in expectedName &&\n expectedName.restElement ?\n '...' + expectedName.name :\n expectedName;\n }).join(', ')\n }\". Got \"${actualNames.join(', ')}\".`,\n null,\n tag,\n );\n\n return true;\n }\n\n return false;\n });\n};\n\n/**\n * @param {string} targetTagName\n * @param {boolean} _allowExtraTrailingParamDocs\n * @param {{\n * name: string,\n * idx: import('../iterateJsdoc.js').Integer\n * }[]} jsdocParameterNames\n * @param {import('comment-parser').Block} jsdoc\n * @param {import('../iterateJsdoc.js').Report} report\n * @returns {boolean}\n */\nconst validateParameterNamesDeep = (\n targetTagName, _allowExtraTrailingParamDocs,\n jsdocParameterNames, jsdoc, report,\n) => {\n /** @type {string} */\n let lastRealParameter;\n\n return jsdocParameterNames.some(({\n idx,\n name: jsdocParameterName,\n }) => {\n const isPropertyPath = jsdocParameterName.includes('.');\n\n if (isPropertyPath) {\n if (!lastRealParameter) {\n report(`@${targetTagName} path declaration (\"${jsdocParameterName}\") appears before any real parameter.`, null, jsdoc.tags[idx]);\n\n return true;\n }\n\n let pathRootNodeName = jsdocParameterName.slice(0, jsdocParameterName.indexOf('.'));\n\n if (pathRootNodeName.endsWith('[]')) {\n pathRootNodeName = pathRootNodeName.slice(0, -2);\n }\n\n if (pathRootNodeName !== lastRealParameter) {\n report(\n `@${targetTagName} path declaration (\"${jsdocParameterName}\") root node name (\"${pathRootNodeName}\") ` +\n `does not match previous real parameter name (\"${lastRealParameter}\").`,\n null,\n jsdoc.tags[idx],\n );\n\n return true;\n }\n } else {\n lastRealParameter = jsdocParameterName;\n }\n\n return false;\n });\n};\n\nconst allowedNodes = [\n 'ArrowFunctionExpression', 'FunctionDeclaration', 'FunctionExpression', 'TSDeclareFunction',\n // Add this to above defaults\n 'TSMethodSignature', 'TSPropertySignature',\n];\n\nexport default iterateJsdoc(({\n context,\n jsdoc,\n node,\n report,\n utils,\n}) => {\n const {\n allowExtraTrailingParamDocs,\n checkDestructured = true,\n checkRestProperty = false,\n checkTypesPattern = '/^(?:[oO]bject|[aA]rray|PlainObject|Generic(?:Object|Array))$/',\n disableExtraPropertyReporting = false,\n disableMissingParamChecks = false,\n enableFixer = false,\n useDefaultObjectProperties = false,\n } = context.options[0] || {};\n\n const nde = /** @type {import('@typescript-eslint/types').TSESTree.Node} */ (node);\n\n // Although we might just remove global settings contexts from applying to\n // this rule (as they can cause problems with `getFunctionParameterNames`\n // checks if they are not functions but say variables), the user may\n // instead wish to narrow contexts in those settings, so this check\n // is still useful\n if (!allowedNodes.includes(nde.type) ||\n nde.type === 'TSPropertySignature' &&\n (/** @type {import('@typescript-eslint/types').TSESTree.TSPropertySignature} */ (\n nde\n )?.typeAnnotation?.typeAnnotation?.type !== 'TSFunctionType')) {\n return;\n }\n\n const checkTypesRegex = utils.getRegexFromString(checkTypesPattern);\n\n const jsdocParameterNamesDeep = utils.getJsdocTagsDeep('param');\n if (!jsdocParameterNamesDeep || !jsdocParameterNamesDeep.length) {\n return;\n }\n\n const functionParameterNames = utils.getFunctionParameterNames(useDefaultObjectProperties);\n\n const targetTagName = /** @type {string} */ (utils.getPreferredTagName({\n tagName: 'param',\n }));\n const isError = validateParameterNames(\n targetTagName,\n allowExtraTrailingParamDocs,\n checkDestructured,\n checkRestProperty,\n checkTypesRegex,\n disableExtraPropertyReporting,\n disableMissingParamChecks,\n enableFixer,\n functionParameterNames,\n jsdoc,\n utils,\n report,\n );\n\n if (isError || !checkDestructured) {\n return;\n }\n\n validateParameterNamesDeep(\n targetTagName, allowExtraTrailingParamDocs, jsdocParameterNamesDeep, jsdoc, report,\n );\n}, {\n contextDefaults: allowedNodes,\n meta: {\n docs: {\n description: 'Checks for dupe `@param` names, that nested param names have roots, and that parameter names in function declarations match JSDoc param names.',\n url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/check-param-names.md#repos-sticky-header',\n },\n fixable: 'code',\n schema: [\n {\n additionalProperties: false,\n properties: {\n allowExtraTrailingParamDocs: {\n description: `If set to \\`true\\`, this option will allow extra \\`@param\\` definitions (e.g.,\nrepresenting future expected or virtual params) to be present without needing\ntheir presence within the function signature. Other inconsistencies between\n\\`@param\\`'s and present function parameters will still be reported.`,\n type: 'boolean',\n },\n checkDestructured: {\n description: 'Whether to check destructured properties. Defaults to `true`.',\n type: 'boolean',\n },\n checkRestProperty: {\n description: `If set to \\`true\\`, will require that rest properties are documented and\nthat any extraneous properties (which may have been within the rest property)\nare documented. Defaults to \\`false\\`.`,\n type: 'boolean',\n },\n checkTypesPattern: {\n description: `Defines a regular expression pattern to indicate which types should be\nchecked for destructured content (and that those not matched should not\nbe checked).\n\nWhen one specifies a type, unless it is of a generic type, like \\`object\\`\nor \\`array\\`, it may be considered unnecessary to have that object's\ndestructured components required, especially where generated docs will\nlink back to the specified type. For example:\n\n\\`\\`\\`js\n/**\n * @param {SVGRect} bbox - a SVGRect\n */\nexport const bboxToObj = function ({x, y, width, height}) {\n return {x, y, width, height};\n};\n\\`\\`\\`\n\nBy default \\`checkTypesPattern\\` is set to\n\\`/^(?:[oO]bject|[aA]rray|PlainObject|Generic(?:Object|Array))$/v\\`,\nmeaning that destructuring will be required only if the type of the \\`@param\\`\n(the text between curly brackets) is a match for \"Object\" or \"Array\" (with or\nwithout initial caps), \"PlainObject\", or \"GenericObject\", \"GenericArray\" (or\nif no type is present). So in the above example, the lack of a match will\nmean that no complaint will be given about the undocumented destructured\nparameters.\n\nNote that the \\`/\\` delimiters are optional, but necessary to add flags.\n\nDefaults to using (only) the \\`v\\` flag, so to add your own flags, encapsulate\nyour expression as a string, but like a literal, e.g., \\`/^object$/vi\\`.\n\nYou could set this regular expression to a more expansive list, or you\ncould restrict it such that even types matching those strings would not\nneed destructuring.`,\n type: 'string',\n },\n disableExtraPropertyReporting: {\n description: `Whether to check for extra destructured properties. Defaults to \\`false\\`. Change\nto \\`true\\` if you want to be able to document properties which are not actually\ndestructured. Keep as \\`false\\` if you expect properties to be documented in\ntheir own types. Note that extra properties will always be reported if another\nitem at the same level is destructured as destructuring will prevent other\naccess and this option is only intended to permit documenting extra properties\nthat are available and actually used in the function.`,\n type: 'boolean',\n },\n disableMissingParamChecks: {\n description: 'Whether to avoid checks for missing `@param` definitions. Defaults to `false`. Change to `true` if you want to be able to omit properties.',\n type: 'boolean',\n },\n enableFixer: {\n description: `Set to \\`true\\` to auto-remove \\`@param\\` duplicates (based on identical\nnames).\n\nNote that this option will remove duplicates of the same name even if\nthe definitions do not match in other ways (e.g., the second param will\nbe removed even if it has a different type or description).`,\n type: 'boolean',\n },\n useDefaultObjectProperties: {\n description: `Set to \\`true\\` if you wish to avoid reporting of child property documentation\nwhere instead of destructuring, a whole plain object is supplied as default\nvalue but you wish its keys to be considered as signalling that the properties\nare present and can therefore be documented. Defaults to \\`false\\`.`,\n type: 'boolean',\n },\n },\n type: 'object',\n },\n ],\n type: 'suggestion',\n },\n});\n"],"mappings":"AAAA,OAAO,YAAY,MAAM,oBAAoB;;AAE7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;A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,CAAC,CACF;IACD,IAAI,EAAE;EACR;AACF,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"checkParamNames.cjs","names":["iterateJsdoc"],"sources":["../../src/rules/checkParamNames.js"],"sourcesContent":["import iterateJsdoc from '../iterateJsdoc.js';\n\n/**\n * @param {string} targetTagName\n * @param {boolean} allowExtraTrailingParamDocs\n * @param {boolean} checkDestructured\n * @param {boolean} checkRestProperty\n * @param {RegExp} checkTypesRegex\n * @param {boolean} disableExtraPropertyReporting\n * @param {boolean} disableMissingParamChecks\n * @param {boolean} enableFixer\n * @param {import('../jsdocUtils.js').ParamNameInfo[]} functionParameterNames\n * @param {import('comment-parser').Block} jsdoc\n * @param {import('../iterateJsdoc.js').Utils} utils\n * @param {import('../iterateJsdoc.js').Report} report\n * @returns {boolean}\n */\nconst validateParameterNames = (\n targetTagName,\n allowExtraTrailingParamDocs,\n checkDestructured,\n checkRestProperty,\n checkTypesRegex,\n disableExtraPropertyReporting,\n disableMissingParamChecks,\n enableFixer,\n functionParameterNames, jsdoc, utils, report,\n) => {\n const paramTags = Object.entries(jsdoc.tags).filter(([\n , tag,\n ]) => {\n return tag.tag === targetTagName;\n });\n const paramTagsNonNested = paramTags.filter(([\n , tag,\n ]) => {\n return !tag.name.includes('.');\n });\n\n let dotted = 0;\n let thisOffset = 0;\n\n return paramTags.some(([\n , tag,\n // eslint-disable-next-line complexity\n ], index) => {\n /** @type {import('../iterateJsdoc.js').Integer} */\n let tagsIndex;\n const dupeTagInfo = paramTags.find(([\n tgsIndex,\n tg,\n ], idx) => {\n tagsIndex = Number(tgsIndex);\n\n return tg.name === tag.name && idx !== index;\n });\n if (dupeTagInfo) {\n utils.reportJSDoc(`Duplicate @${targetTagName} \"${tag.name}\"`, dupeTagInfo[1], enableFixer ? () => {\n utils.removeTag(tagsIndex);\n } : null);\n\n return true;\n }\n\n if (tag.name.includes('.')) {\n dotted++;\n\n return false;\n }\n\n let functionParameterName = functionParameterNames[index - dotted + thisOffset];\n if (functionParameterName === 'this' && tag.name.trim() !== 'this') {\n ++thisOffset;\n functionParameterName = functionParameterNames[index - dotted + thisOffset];\n }\n\n if (!functionParameterName) {\n if (allowExtraTrailingParamDocs) {\n return false;\n }\n\n report(\n `@${targetTagName} \"${tag.name}\" does not match an existing function parameter.`,\n null,\n tag,\n );\n\n return true;\n }\n\n if (\n typeof functionParameterName === 'object' &&\n 'name' in functionParameterName &&\n Array.isArray(functionParameterName.name)\n ) {\n const actualName = tag.name.trim();\n const expectedName = functionParameterName.name[index];\n if (actualName === expectedName) {\n thisOffset--;\n return false;\n }\n\n report(\n `Expected @${targetTagName} name to be \"${expectedName}\". Got \"${actualName}\".`,\n null,\n tag,\n );\n return true;\n }\n\n if (Array.isArray(functionParameterName)) {\n if (!checkDestructured) {\n return false;\n }\n\n if (tag.type && tag.type.search(checkTypesRegex) === -1) {\n return false;\n }\n\n const [\n parameterName,\n {\n annotationParamName,\n hasPropertyRest,\n names: properties,\n rests,\n },\n ] =\n /**\n * @type {[string | undefined, import('../jsdocUtils.js').FlattendRootInfo & {\n * annotationParamName?: string | undefined;\n }]} */ (functionParameterName);\n if (annotationParamName !== undefined) {\n const name = tag.name.trim();\n if (name !== annotationParamName) {\n report(`@${targetTagName} \"${name}\" does not match parameter name \"${annotationParamName}\"`, null, tag);\n }\n }\n\n const tagName = parameterName === undefined ? tag.name.trim() : parameterName;\n const expectedNames = properties.map((name) => {\n return `${tagName}.${name}`;\n });\n const actualNames = paramTags.map(([\n , paramTag,\n ]) => {\n return paramTag.name.trim();\n });\n const actualTypes = paramTags.map(([\n , paramTag,\n ]) => {\n return paramTag.type;\n });\n\n const missingProperties = [];\n\n /** @type {string[]} */\n const notCheckingNames = [];\n\n for (const [\n idx,\n name,\n ] of expectedNames.entries()) {\n if (notCheckingNames.some((notCheckingName) => {\n return name.startsWith(notCheckingName);\n })) {\n continue;\n }\n\n const actualNameIdx = actualNames.findIndex((actualName) => {\n return utils.comparePaths(name)(actualName);\n });\n if (actualNameIdx === -1) {\n if (!checkRestProperty && rests[idx]) {\n continue;\n }\n\n const missingIndex = actualNames.findIndex((actualName) => {\n return utils.pathDoesNotBeginWith(name, actualName);\n });\n const line = tag.source[0].number - 1 + (missingIndex > -1 ? missingIndex : actualNames.length);\n missingProperties.push({\n name,\n tagPlacement: {\n line: line === 0 ? 1 : line,\n },\n });\n } else if (actualTypes[actualNameIdx].search(checkTypesRegex) === -1 && actualTypes[actualNameIdx] !== '') {\n notCheckingNames.push(name);\n }\n }\n\n const hasMissing = missingProperties.length;\n if (hasMissing) {\n for (const {\n name: missingProperty,\n tagPlacement,\n } of missingProperties) {\n report(`Missing @${targetTagName} \"${missingProperty}\"`, null, tagPlacement);\n }\n }\n\n if (!hasPropertyRest || checkRestProperty) {\n /** @type {[string, import('comment-parser').Spec][]} */\n const extraProperties = [];\n for (const [\n idx,\n name,\n ] of actualNames.entries()) {\n const match = name.startsWith(tag.name.trim() + '.');\n if (\n match && !expectedNames.some(\n utils.comparePaths(name),\n ) && !utils.comparePaths(name)(tag.name) &&\n (!disableExtraPropertyReporting || properties.some((prop) => {\n return prop.split('.').length >= name.split('.').length - 1;\n }))\n ) {\n extraProperties.push([\n name, paramTags[idx][1],\n ]);\n }\n }\n\n if (extraProperties.length) {\n for (const [\n extraProperty,\n tg,\n ] of extraProperties) {\n report(`@${targetTagName} \"${extraProperty}\" does not exist on ${tag.name}`, null, tg);\n }\n\n return true;\n }\n }\n\n return hasMissing;\n }\n\n let funcParamName;\n if (typeof functionParameterName === 'object') {\n const {\n name,\n } = functionParameterName;\n funcParamName = name;\n } else {\n funcParamName = functionParameterName;\n }\n\n if (funcParamName !== tag.name.trim()) {\n // Todo: Improve for array or object child items\n const actualNames = paramTagsNonNested.map(([\n , {\n name,\n },\n ]) => {\n return name.trim();\n });\n\n const expectedNames = functionParameterNames.map((item, idx) => {\n if (/**\n * @type {[string|undefined, (import('../jsdocUtils.js').FlattendRootInfo & {\n * annotationParamName?: string,\n })]} */ (item)?.[1]?.names) {\n return actualNames[idx];\n }\n\n return item;\n }).filter((item) => {\n return item !== 'this';\n });\n\n // When disableMissingParamChecks is true tag names can be omitted.\n // Report when the tag names do not match the expected names or they are used out of order.\n if (disableMissingParamChecks) {\n const usedExpectedNames = expectedNames.map((a) => {\n return a?.toString();\n }).filter((expectedName) => {\n return expectedName && actualNames.includes(expectedName);\n });\n const usedInOrder = actualNames.every((actualName, idx) => {\n return actualName === usedExpectedNames[idx];\n });\n if (usedInOrder) {\n return false;\n }\n }\n\n report(\n `Expected @${targetTagName} names to be \"${\n expectedNames.map((expectedName) => {\n return typeof expectedName === 'object' &&\n 'name' in expectedName &&\n expectedName.restElement ?\n '...' + expectedName.name :\n expectedName;\n }).join(', ')\n }\". Got \"${actualNames.join(', ')}\".`,\n null,\n tag,\n );\n\n return true;\n }\n\n return false;\n });\n};\n\n/**\n * @param {string} targetTagName\n * @param {boolean} _allowExtraTrailingParamDocs\n * @param {{\n * name: string,\n * idx: import('../iterateJsdoc.js').Integer\n * }[]} jsdocParameterNames\n * @param {import('comment-parser').Block} jsdoc\n * @param {import('../iterateJsdoc.js').Report} report\n * @returns {boolean}\n */\nconst validateParameterNamesDeep = (\n targetTagName, _allowExtraTrailingParamDocs,\n jsdocParameterNames, jsdoc, report,\n) => {\n /** @type {string} */\n let lastRealParameter;\n\n return jsdocParameterNames.some(({\n idx,\n name: jsdocParameterName,\n }) => {\n const isPropertyPath = jsdocParameterName.includes('.');\n\n if (isPropertyPath) {\n if (!lastRealParameter) {\n report(`@${targetTagName} path declaration (\"${jsdocParameterName}\") appears before any real parameter.`, null, jsdoc.tags[idx]);\n\n return true;\n }\n\n let pathRootNodeName = jsdocParameterName.slice(0, jsdocParameterName.indexOf('.'));\n\n if (pathRootNodeName.endsWith('[]')) {\n pathRootNodeName = pathRootNodeName.slice(0, -2);\n }\n\n if (pathRootNodeName !== lastRealParameter) {\n report(\n `@${targetTagName} path declaration (\"${jsdocParameterName}\") root node name (\"${pathRootNodeName}\") ` +\n `does not match previous real parameter name (\"${lastRealParameter}\").`,\n null,\n jsdoc.tags[idx],\n );\n\n return true;\n }\n } else {\n lastRealParameter = jsdocParameterName;\n }\n\n return false;\n });\n};\n\nconst allowedNodes = [\n 'ArrowFunctionExpression', 'FunctionDeclaration', 'FunctionExpression', 'TSDeclareFunction',\n // Add this to above defaults\n 'TSMethodSignature', 'TSPropertySignature',\n];\n\nexport default iterateJsdoc(({\n context,\n jsdoc,\n node,\n report,\n utils,\n}) => {\n const {\n allowExtraTrailingParamDocs,\n checkDestructured = true,\n checkRestProperty = false,\n checkTypesPattern = '/^(?:[oO]bject|[aA]rray|PlainObject|Generic(?:Object|Array))$/',\n disableExtraPropertyReporting = false,\n disableMissingParamChecks = false,\n enableFixer = false,\n useDefaultObjectProperties = false,\n } = context.options[0] || {};\n\n const nde = /** @type {import('@typescript-eslint/types').TSESTree.Node} */ (node);\n\n // Although we might just remove global settings contexts from applying to\n // this rule (as they can cause problems with `getFunctionParameterNames`\n // checks if they are not functions but say variables), the user may\n // instead wish to narrow contexts in those settings, so this check\n // is still useful\n if (!allowedNodes.includes(nde.type) ||\n nde.type === 'TSPropertySignature' &&\n (/** @type {import('@typescript-eslint/types').TSESTree.TSPropertySignature} */ (\n nde\n )?.typeAnnotation?.typeAnnotation?.type !== 'TSFunctionType')) {\n return;\n }\n\n const checkTypesRegex = utils.getRegexFromString(checkTypesPattern);\n\n const jsdocParameterNamesDeep = utils.getJsdocTagsDeep('param');\n if (!jsdocParameterNamesDeep || !jsdocParameterNamesDeep.length) {\n return;\n }\n\n const functionParameterNames = utils.getFunctionParameterNames(useDefaultObjectProperties);\n\n const targetTagName = /** @type {string} */ (utils.getPreferredTagName({\n tagName: 'param',\n }));\n const isError = validateParameterNames(\n targetTagName,\n allowExtraTrailingParamDocs,\n checkDestructured,\n checkRestProperty,\n checkTypesRegex,\n disableExtraPropertyReporting,\n disableMissingParamChecks,\n enableFixer,\n functionParameterNames,\n jsdoc,\n utils,\n report,\n );\n\n if (isError || !checkDestructured) {\n return;\n }\n\n validateParameterNamesDeep(\n targetTagName, allowExtraTrailingParamDocs, jsdocParameterNamesDeep, jsdoc, report,\n );\n}, {\n contextDefaults: allowedNodes,\n meta: {\n docs: {\n description: 'Checks for dupe `@param` names, that nested param names have roots, and that parameter names in function declarations match JSDoc param names.',\n url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/check-param-names.md#repos-sticky-header',\n },\n fixable: 'code',\n schema: [\n {\n additionalProperties: false,\n properties: {\n allowExtraTrailingParamDocs: {\n description: `If set to \\`true\\`, this option will allow extra \\`@param\\` definitions (e.g.,\nrepresenting future expected or virtual params) to be present without needing\ntheir presence within the function signature. Other inconsistencies between\n\\`@param\\`'s and present function parameters will still be reported.`,\n type: 'boolean',\n },\n checkDestructured: {\n description: 'Whether to check destructured properties. Defaults to `true`.',\n type: 'boolean',\n },\n checkRestProperty: {\n description: `If set to \\`true\\`, will require that rest properties are documented and\nthat any extraneous properties (which may have been within the rest property)\nare documented. Defaults to \\`false\\`.`,\n type: 'boolean',\n },\n checkTypesPattern: {\n description: `Defines a regular expression pattern to indicate which types should be\nchecked for destructured content (and that those not matched should not\nbe checked).\n\nWhen one specifies a type, unless it is of a generic type, like \\`object\\`\nor \\`array\\`, it may be considered unnecessary to have that object's\ndestructured components required, especially where generated docs will\nlink back to the specified type. For example:\n\n\\`\\`\\`js\n/**\n * @param {SVGRect} bbox - a SVGRect\n */\nexport const bboxToObj = function ({x, y, width, height}) {\n return {x, y, width, height};\n};\n\\`\\`\\`\n\nBy default \\`checkTypesPattern\\` is set to\n\\`/^(?:[oO]bject|[aA]rray|PlainObject|Generic(?:Object|Array))$/v\\`,\nmeaning that destructuring will be required only if the type of the \\`@param\\`\n(the text between curly brackets) is a match for \"Object\" or \"Array\" (with or\nwithout initial caps), \"PlainObject\", or \"GenericObject\", \"GenericArray\" (or\nif no type is present). So in the above example, the lack of a match will\nmean that no complaint will be given about the undocumented destructured\nparameters.\n\nNote that the \\`/\\` delimiters are optional, but necessary to add flags.\n\nDefaults to using (only) the \\`v\\` flag, so to add your own flags, encapsulate\nyour expression as a string, but like a literal, e.g., \\`/^object$/vi\\`.\n\nYou could set this regular expression to a more expansive list, or you\ncould restrict it such that even types matching those strings would not\nneed destructuring.`,\n type: 'string',\n },\n disableExtraPropertyReporting: {\n description: `Whether to check for extra destructured properties. Defaults to \\`false\\`. Change\nto \\`true\\` if you want to be able to document properties which are not actually\ndestructured. Keep as \\`false\\` if you expect properties to be documented in\ntheir own types. Note that extra properties will always be reported if another\nitem at the same level is destructured as destructuring will prevent other\naccess and this option is only intended to permit documenting extra properties\nthat are available and actually used in the function.`,\n type: 'boolean',\n },\n disableMissingParamChecks: {\n description: 'Whether to avoid checks for missing `@param` definitions. Defaults to `false`. Change to `true` if you want to be able to omit properties.',\n type: 'boolean',\n },\n enableFixer: {\n description: `Set to \\`true\\` to auto-remove \\`@param\\` duplicates (based on identical\nnames).\n\nNote that this option will remove duplicates of the same name even if\nthe definitions do not match in other ways (e.g., the second param will\nbe removed even if it has a different type or description).`,\n type: 'boolean',\n },\n useDefaultObjectProperties: {\n description: `Set to \\`true\\` if you wish to avoid reporting of child property documentation\nwhere instead of destructuring, a whole plain object is supplied as default\nvalue but you wish its keys to be considered as signalling that the properties\nare present and can therefore be documented. Defaults to \\`false\\`.`,\n type: 'boolean',\n },\n },\n type: 'object',\n },\n ],\n type: 'suggestion',\n },\n});\n"],"mappings":";;;;;;AAAA;AAA8C;AAE9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM,sBAAsB,GAAG,CAC7B,aAAa,EACb,2BAA2B,EAC3B,iBAAiB,EACjB,iBAAiB,EACjB,eAAe,EACf,6BAA6B,EAC7B,yBAAyB,EACzB,WAAW,EACX,sBAAsB,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,KACzC;EACH,MAAM,SAAS,GAAG,MAAM,CAAC,OAAO,CAAC,KAAK,C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GAAG,EAAE;IACP,CAAC;IACD,OAAO,EAAE,MAAM;IACf,MAAM,EAAE,CACN;MACE,oBAAoB,EAAE,KAAK;MAC3B,UAAU,EAAE;QACV,2BAA2B,EAAE;UAC3B,WAAW,EAAE;AACzB;AACA;AACA,qEAAqE;UACzD,IAAI,EAAE;QACR,CAAC;QACD,iBAAiB,EAAE;UACjB,WAAW,EAAE,+DAA+D;UAC5E,IAAI,EAAE;QACR,CAAC;QACD,iBAAiB,EAAE;UACjB,WAAW,EAAE;AACzB;AACA,uCAAuC;UAC3B,IAAI,EAAE;QACR,CAAC;QACD,iBAAiB,EAAE;UACjB,WAAW,EAAE;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB;UACR,IAAI,EAAE;QACR,CAAC;QACD,6BAA6B,EAAE;UAC7B,WAAW,EAAE;AACzB;AACA;AACA;AACA;AACA;AACA,sDAAsD;UAC1C,IAAI,EAAE;QACR,CAAC;QACD,yBAAyB,EAAE;UACzB,WAAW,EAAE,4IAA4I;UACzJ,IAAI,EAAE;QACR,CAAC;QACD,WAAW,EAAE;UACX,WAAW,EAAE;AACzB;AACA;AACA;AACA;AACA,4DAA4D;UAChD,IAAI,EAAE;QACR,CAAC;QACD,0BAA0B,EAAE;UAC1B,WAAW,EAAE;AACzB;AACA;AACA,oEAAoE;UACxD,IAAI,EAAE;QACR;MACF,CAAC;MACD,IAAI,EAAE;IACR,CAAC,CACF;IACD,IAAI,EAAE;EACR;AACF,CAAC,CAAC;AAAA","ignoreList":[]}
@@ -1,5 +1,11 @@
1
- import iterateJsdoc from '../iterateJsdoc.js';
1
+ "use strict";
2
2
 
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _iterateJsdoc = _interopRequireDefault(require("../iterateJsdoc.cjs"));
8
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
3
9
  /**
4
10
  * @param {string} targetTagName
5
11
  * @param {boolean} enableFixer
@@ -78,7 +84,7 @@ const validatePropertyNamesDeep = (targetTagName, jsdocPropertyNames, jsdoc, rep
78
84
  return false;
79
85
  });
80
86
  };
81
- export default iterateJsdoc(({
87
+ var _default = exports.default = (0, _iterateJsdoc.default)(({
82
88
  context,
83
89
  jsdoc,
84
90
  report,
@@ -125,4 +131,5 @@ be removed even if it has a different type or description).`,
125
131
  type: 'suggestion'
126
132
  }
127
133
  });
134
+ module.exports = exports.default;
128
135
  //# sourceMappingURL=checkPropertyNames.cjs.map