eslint-plugin-jsdoc 50.6.16 → 50.7.0

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 (155) hide show
  1. package/dist/alignTransform.cjs +10 -10
  2. package/dist/alignTransform.cjs.map +1 -1
  3. package/dist/exportParser.cjs +141 -135
  4. package/dist/exportParser.cjs.map +1 -1
  5. package/dist/generateRule.cjs +10 -12
  6. package/dist/generateRule.cjs.map +1 -1
  7. package/dist/getDefaultTagStructureForMode.cjs +73 -73
  8. package/dist/getDefaultTagStructureForMode.cjs.map +1 -1
  9. package/dist/getJsdocProcessorPlugin.cjs +121 -110
  10. package/dist/getJsdocProcessorPlugin.cjs.map +1 -1
  11. package/dist/index.cjs +17 -12
  12. package/dist/index.cjs.map +1 -1
  13. package/dist/index.d.ts +4 -3
  14. package/dist/index.d.ts.map +1 -1
  15. package/dist/iterateJsdoc.cjs +87 -66
  16. package/dist/iterateJsdoc.cjs.map +1 -1
  17. package/dist/jsdocUtils.cjs +144 -142
  18. package/dist/jsdocUtils.cjs.map +1 -1
  19. package/dist/rules/checkAlignment.cjs +2 -2
  20. package/dist/rules/checkAlignment.cjs.map +1 -1
  21. package/dist/rules/checkExamples.cjs +22 -28
  22. package/dist/rules/checkExamples.cjs.map +1 -1
  23. package/dist/rules/checkIndentation.cjs +2 -2
  24. package/dist/rules/checkIndentation.cjs.map +1 -1
  25. package/dist/rules/checkLineAlignment.cjs +14 -14
  26. package/dist/rules/checkLineAlignment.cjs.map +1 -1
  27. package/dist/rules/checkParamNames.cjs +21 -15
  28. package/dist/rules/checkParamNames.cjs.map +1 -1
  29. package/dist/rules/checkPropertyNames.cjs +2 -2
  30. package/dist/rules/checkPropertyNames.cjs.map +1 -1
  31. package/dist/rules/checkTagNames.cjs +11 -11
  32. package/dist/rules/checkTagNames.cjs.map +1 -1
  33. package/dist/rules/checkTemplateNames.cjs +21 -22
  34. package/dist/rules/checkTemplateNames.cjs.map +1 -1
  35. package/dist/rules/checkTypes.cjs +10 -10
  36. package/dist/rules/checkTypes.cjs.map +1 -1
  37. package/dist/rules/checkValues.cjs +11 -14
  38. package/dist/rules/checkValues.cjs.map +1 -1
  39. package/dist/rules/convertToJsdocComments.cjs +26 -27
  40. package/dist/rules/convertToJsdocComments.cjs.map +1 -1
  41. package/dist/rules/emptyTags.cjs +6 -6
  42. package/dist/rules/emptyTags.cjs.map +1 -1
  43. package/dist/rules/importsAsDependencies.cjs.map +1 -1
  44. package/dist/rules/informativeDocs.cjs +12 -12
  45. package/dist/rules/informativeDocs.cjs.map +1 -1
  46. package/dist/rules/linesBeforeBlock.cjs +12 -12
  47. package/dist/rules/linesBeforeBlock.cjs.map +1 -1
  48. package/dist/rules/matchDescription.cjs +1 -1
  49. package/dist/rules/matchDescription.cjs.map +1 -1
  50. package/dist/rules/matchName.cjs +4 -4
  51. package/dist/rules/matchName.cjs.map +1 -1
  52. package/dist/rules/multilineBlocks.cjs +10 -10
  53. package/dist/rules/multilineBlocks.cjs.map +1 -1
  54. package/dist/rules/noBadBlocks.cjs +3 -3
  55. package/dist/rules/noBadBlocks.cjs.map +1 -1
  56. package/dist/rules/noMultiAsterisks.cjs +6 -6
  57. package/dist/rules/noMultiAsterisks.cjs.map +1 -1
  58. package/dist/rules/noRestrictedSyntax.cjs +2 -2
  59. package/dist/rules/noRestrictedSyntax.cjs.map +1 -1
  60. package/dist/rules/noTypes.cjs.map +1 -1
  61. package/dist/rules/noUndefinedTypes.cjs +17 -20
  62. package/dist/rules/noUndefinedTypes.cjs.map +1 -1
  63. package/dist/rules/requireAsteriskPrefix.cjs +4 -4
  64. package/dist/rules/requireAsteriskPrefix.cjs.map +1 -1
  65. package/dist/rules/requireDescription.cjs +2 -2
  66. package/dist/rules/requireDescription.cjs.map +1 -1
  67. package/dist/rules/requireDescriptionCompleteSentence.cjs +8 -8
  68. package/dist/rules/requireDescriptionCompleteSentence.cjs.map +1 -1
  69. package/dist/rules/requireFileOverview.cjs +6 -6
  70. package/dist/rules/requireFileOverview.cjs.map +1 -1
  71. package/dist/rules/requireHyphenBeforeParamDescription.cjs +1 -4
  72. package/dist/rules/requireHyphenBeforeParamDescription.cjs.map +1 -1
  73. package/dist/rules/requireJsdoc.cjs +19 -19
  74. package/dist/rules/requireJsdoc.cjs.map +1 -1
  75. package/dist/rules/requireParam.cjs +12 -12
  76. package/dist/rules/requireParam.cjs.map +1 -1
  77. package/dist/rules/requireProperty.cjs +1 -1
  78. package/dist/rules/requireProperty.cjs.map +1 -1
  79. package/dist/rules/requireReturns.cjs +3 -3
  80. package/dist/rules/requireReturns.cjs.map +1 -1
  81. package/dist/rules/requireReturnsCheck.cjs +1 -1
  82. package/dist/rules/requireReturnsCheck.cjs.map +1 -1
  83. package/dist/rules/requireReturnsDescription.cjs +1 -1
  84. package/dist/rules/requireReturnsDescription.cjs.map +1 -1
  85. package/dist/rules/requireTemplate.cjs +16 -15
  86. package/dist/rules/requireTemplate.cjs.map +1 -1
  87. package/dist/rules/requireYields.cjs +4 -4
  88. package/dist/rules/requireYields.cjs.map +1 -1
  89. package/dist/rules/requireYieldsCheck.cjs +6 -6
  90. package/dist/rules/requireYieldsCheck.cjs.map +1 -1
  91. package/dist/rules/sortTags.cjs +13 -13
  92. package/dist/rules/sortTags.cjs.map +1 -1
  93. package/dist/rules/tagLines.cjs +11 -11
  94. package/dist/rules/tagLines.cjs.map +1 -1
  95. package/dist/rules/textEscaping.cjs +2 -2
  96. package/dist/rules/textEscaping.cjs.map +1 -1
  97. package/dist/rules/validTypes.cjs +15 -15
  98. package/dist/rules/validTypes.cjs.map +1 -1
  99. package/dist/tagNames.cjs +1 -1
  100. package/dist/tagNames.cjs.map +1 -1
  101. package/dist/utils/hasReturnValue.cjs +176 -176
  102. package/dist/utils/hasReturnValue.cjs.map +1 -1
  103. package/eslint.config.js +36 -32
  104. package/package.json +35 -35
  105. package/pnpm-workspace.yaml +1 -0
  106. package/src/alignTransform.js +15 -15
  107. package/src/exportParser.js +386 -373
  108. package/src/getDefaultTagStructureForMode.js +45 -45
  109. package/src/getJsdocProcessorPlugin.js +175 -128
  110. package/src/index.js +66 -37
  111. package/src/iterateJsdoc.js +61 -28
  112. package/src/jsdocUtils.js +354 -338
  113. package/src/rules/checkAlignment.js +2 -2
  114. package/src/rules/checkExamples.js +16 -20
  115. package/src/rules/checkIndentation.js +2 -2
  116. package/src/rules/checkLineAlignment.js +10 -10
  117. package/src/rules/checkParamNames.js +22 -14
  118. package/src/rules/checkPropertyNames.js +1 -1
  119. package/src/rules/checkTagNames.js +7 -7
  120. package/src/rules/checkTemplateNames.js +52 -38
  121. package/src/rules/checkTypes.js +7 -7
  122. package/src/rules/checkValues.js +16 -17
  123. package/src/rules/convertToJsdocComments.js +47 -37
  124. package/src/rules/emptyTags.js +14 -7
  125. package/src/rules/importsAsDependencies.js +3 -1
  126. package/src/rules/informativeDocs.js +58 -58
  127. package/src/rules/linesBeforeBlock.js +25 -17
  128. package/src/rules/matchDescription.js +1 -1
  129. package/src/rules/matchName.js +2 -2
  130. package/src/rules/multilineBlocks.js +10 -10
  131. package/src/rules/noBadBlocks.js +3 -3
  132. package/src/rules/noMultiAsterisks.js +4 -4
  133. package/src/rules/noRestrictedSyntax.js +1 -1
  134. package/src/rules/noTypes.js +1 -1
  135. package/src/rules/noUndefinedTypes.js +29 -23
  136. package/src/rules/requireAsteriskPrefix.js +3 -3
  137. package/src/rules/requireDescription.js +1 -1
  138. package/src/rules/requireDescriptionCompleteSentence.js +6 -6
  139. package/src/rules/requireFileOverview.js +3 -3
  140. package/src/rules/requireHyphenBeforeParamDescription.js +2 -5
  141. package/src/rules/requireJsdoc.js +14 -14
  142. package/src/rules/requireParam.js +9 -9
  143. package/src/rules/requireProperty.js +1 -1
  144. package/src/rules/requireReturns.js +1 -1
  145. package/src/rules/requireReturnsCheck.js +1 -1
  146. package/src/rules/requireReturnsDescription.js +1 -1
  147. package/src/rules/requireTemplate.js +59 -38
  148. package/src/rules/requireYields.js +3 -3
  149. package/src/rules/requireYieldsCheck.js +1 -1
  150. package/src/rules/sortTags.js +7 -7
  151. package/src/rules/tagLines.js +8 -8
  152. package/src/rules/textEscaping.js +2 -0
  153. package/src/rules/validTypes.js +29 -29
  154. package/src/tagNames.js +2 -2
  155. package/src/utils/hasReturnValue.js +298 -283
@@ -109,16 +109,16 @@ const getTypelessInfo = fields => {
109
109
  return !type;
110
110
  });
111
111
  const maxNamedTagLength = Math.max(...fields.tags.map(({
112
- tag,
113
- name
112
+ name,
113
+ tag
114
114
  }) => {
115
115
  return name.length === 0 ? -1 : tag.length;
116
116
  }).filter(length => {
117
117
  return length !== -1;
118
118
  })) + 1;
119
119
  const maxUnnamedTagLength = Math.max(...fields.tags.map(({
120
- tag,
121
- name
120
+ name,
121
+ tag
122
122
  }) => {
123
123
  return name.length === 0 ? tag.length : -1;
124
124
  }).filter(length => {
@@ -154,11 +154,11 @@ const space = len => {
154
154
  */
155
155
  const alignTransform = ({
156
156
  customSpacings,
157
- tags,
157
+ disableWrapIndent,
158
158
  indent,
159
159
  preserveMainDescriptionPostDelimiter,
160
- wrapIndent,
161
- disableWrapIndent
160
+ tags,
161
+ wrapIndent
162
162
  }) => {
163
163
  let intoTags = false;
164
164
  /** @type {Width} */
@@ -257,12 +257,12 @@ const alignTransform = ({
257
257
  };
258
258
  }
259
259
  switch (tokens.delimiter) {
260
- case '/**':
261
- tokens.start = indent;
262
- break;
263
260
  case '*':
264
261
  tokens.start = indent + ' ';
265
262
  break;
263
+ case '/**':
264
+ tokens.start = indent;
265
+ break;
266
266
  default:
267
267
  tokens.delimiter = '';
268
268
 
@@ -1 +1 @@
1
- {"version":3,"file":"alignTransform.cjs","names":["_commentParser","require","rewireSource","util","zeroWidth","name","start","tag","type","shouldAlign","tags","index","source","tokens","replace","includesTag","includes","iterator","previousTag","getWidth","width","Math","max","length","delimiter","getTypelessInfo","fields","hasNoTypes","every","maxNamedTagLength","map","filter","maxUnnamedTagLength","space","len","padStart","alignTransform","customSpacings","indent","preserveMainDescriptionPostDelimiter","wrapIndent","disableWrapIndent","intoTags","alignTokens","typelessInfo","nothingAfter","delim","description","postName","postType","postTag","untypedNameAdjustment","untypedTypeAdjustment","spacings","postDelimiter","update","line","indentTag","isEmpty","end","postHyphenSpacing","postHyphen","hyphenSpacing","reduce","tagIndentMode","ret","_default","exports","default","module"],"sources":["../src/alignTransform.js"],"sourcesContent":["/**\n * Transform based on https://github.com/syavorsky/comment-parser/blob/master/src/transforms/align.ts\n *\n * It contains some customizations to align based on the tags, and some custom options.\n */\n\nimport {\n // `comment-parser/primitives` export\n util,\n} from 'comment-parser';\n\n/**\n * @typedef {{\n * hasNoTypes: boolean,\n * maxNamedTagLength: import('./iterateJsdoc.js').Integer,\n * maxUnnamedTagLength: import('./iterateJsdoc.js').Integer\n * }} TypelessInfo\n */\n\nconst {\n rewireSource,\n} = util;\n\n/**\n * @typedef {{\n * name: import('./iterateJsdoc.js').Integer,\n * start: import('./iterateJsdoc.js').Integer,\n * tag: import('./iterateJsdoc.js').Integer,\n * type: import('./iterateJsdoc.js').Integer\n * }} Width\n */\n\n/** @type {Width} */\nconst zeroWidth = {\n name: 0,\n start: 0,\n tag: 0,\n type: 0,\n};\n\n/**\n * @param {string[]} tags\n * @param {import('./iterateJsdoc.js').Integer} index\n * @param {import('comment-parser').Line[]} source\n * @returns {boolean}\n */\nconst shouldAlign = (tags, index, source) => {\n const tag = source[index].tokens.tag.replace('@', '');\n const includesTag = tags.includes(tag);\n\n if (includesTag) {\n return true;\n }\n\n if (tag !== '') {\n return false;\n }\n\n for (let iterator = index; iterator >= 0; iterator--) {\n const previousTag = source[iterator].tokens.tag.replace('@', '');\n\n if (previousTag !== '') {\n if (tags.includes(previousTag)) {\n return true;\n }\n\n return false;\n }\n }\n\n return true;\n};\n\n/**\n * @param {string[]} tags\n * @returns {(\n * width: Width,\n * line: {\n * tokens: import('comment-parser').Tokens\n * },\n * index: import('./iterateJsdoc.js').Integer,\n * source: import('comment-parser').Line[]\n * ) => Width}\n */\nconst getWidth = (tags) => {\n return (width, {\n tokens,\n }, index, source) => {\n if (!shouldAlign(tags, index, source)) {\n return width;\n }\n\n return {\n name: Math.max(width.name, tokens.name.length),\n start: tokens.delimiter === '/**' ? tokens.start.length : width.start,\n tag: Math.max(width.tag, tokens.tag.length),\n type: Math.max(width.type, tokens.type.length),\n };\n };\n};\n\n/**\n * @param {{\n * description: string;\n * tags: import('comment-parser').Spec[];\n * problems: import('comment-parser').Problem[];\n * }} fields\n * @returns {TypelessInfo}\n */\nconst getTypelessInfo = (fields) => {\n const hasNoTypes = fields.tags.every(({\n type,\n }) => {\n return !type;\n });\n const maxNamedTagLength = Math.max(...fields.tags.map(({\n tag,\n name,\n }) => {\n return name.length === 0 ? -1 : tag.length;\n }).filter((length) => {\n return length !== -1;\n })) + 1;\n const maxUnnamedTagLength = Math.max(...fields.tags.map(({\n tag,\n name,\n }) => {\n return name.length === 0 ? tag.length : -1;\n }).filter((length) => {\n return length !== -1;\n })) + 1;\n return {\n hasNoTypes,\n maxNamedTagLength,\n maxUnnamedTagLength,\n };\n};\n\n/**\n * @param {import('./iterateJsdoc.js').Integer} len\n * @returns {string}\n */\nconst space = (len) => {\n return ''.padStart(len, ' ');\n};\n\n/**\n * @param {{\n * customSpacings: import('../src/rules/checkLineAlignment.js').CustomSpacings,\n * tags: string[],\n * indent: string,\n * preserveMainDescriptionPostDelimiter: boolean,\n * wrapIndent: string,\n * disableWrapIndent: boolean,\n * }} cfg\n * @returns {(\n * block: import('comment-parser').Block\n * ) => import('comment-parser').Block}\n */\nconst alignTransform = ({\n customSpacings,\n tags,\n indent,\n preserveMainDescriptionPostDelimiter,\n wrapIndent,\n disableWrapIndent,\n}) => {\n let intoTags = false;\n /** @type {Width} */\n let width;\n\n /**\n * @param {import('comment-parser').Tokens} tokens\n * @param {TypelessInfo} typelessInfo\n * @returns {import('comment-parser').Tokens}\n */\n const alignTokens = (tokens, typelessInfo) => {\n const nothingAfter = {\n delim: false,\n name: false,\n tag: false,\n type: false,\n };\n\n if (tokens.description === '') {\n nothingAfter.name = true;\n tokens.postName = '';\n\n if (tokens.name === '') {\n nothingAfter.type = true;\n tokens.postType = '';\n\n if (tokens.type === '') {\n nothingAfter.tag = true;\n tokens.postTag = '';\n\n /* c8 ignore next: Never happens because the !intoTags return. But it's here for consistency with the original align transform */\n if (tokens.tag === '') {\n nothingAfter.delim = true;\n }\n }\n }\n }\n\n let untypedNameAdjustment = 0;\n let untypedTypeAdjustment = 0;\n if (typelessInfo.hasNoTypes) {\n nothingAfter.tag = true;\n tokens.postTag = '';\n if (tokens.name === '') {\n untypedNameAdjustment = typelessInfo.maxNamedTagLength - tokens.tag.length;\n } else {\n untypedNameAdjustment = typelessInfo.maxNamedTagLength > typelessInfo.maxUnnamedTagLength ? 0 :\n Math.max(0, typelessInfo.maxUnnamedTagLength - (tokens.tag.length + tokens.name.length + 1));\n untypedTypeAdjustment = typelessInfo.maxNamedTagLength - tokens.tag.length;\n }\n }\n\n // Todo: Avoid fixing alignment of blocks with multiline wrapping of type\n if (tokens.tag === '' && tokens.type) {\n return tokens;\n }\n\n const spacings = {\n postDelimiter: customSpacings?.postDelimiter || 1,\n postName: customSpacings?.postName || 1,\n postTag: customSpacings?.postTag || 1,\n postType: customSpacings?.postType || 1,\n };\n\n tokens.postDelimiter = nothingAfter.delim ? '' : space(spacings.postDelimiter);\n\n if (!nothingAfter.tag) {\n tokens.postTag = space(width.tag - tokens.tag.length + spacings.postTag);\n }\n\n if (!nothingAfter.type) {\n tokens.postType = space(width.type - tokens.type.length + spacings.postType + untypedTypeAdjustment);\n }\n\n if (!nothingAfter.name) {\n // If post name is empty for all lines (name width 0), don't add post name spacing.\n tokens.postName = width.name === 0 ? '' : space(width.name - tokens.name.length + spacings.postName + untypedNameAdjustment);\n }\n\n return tokens;\n };\n\n /**\n * @param {import('comment-parser').Line} line\n * @param {import('./iterateJsdoc.js').Integer} index\n * @param {import('comment-parser').Line[]} source\n * @param {TypelessInfo} typelessInfo\n * @param {string|false} indentTag\n * @returns {import('comment-parser').Line}\n */\n const update = (line, index, source, typelessInfo, indentTag) => {\n /** @type {import('comment-parser').Tokens} */\n const tokens = {\n ...line.tokens,\n };\n\n if (tokens.tag !== '') {\n intoTags = true;\n }\n\n const isEmpty =\n tokens.tag === '' &&\n tokens.name === '' &&\n tokens.type === '' &&\n tokens.description === '';\n\n // dangling '*/'\n if (tokens.end === '*/' && isEmpty) {\n tokens.start = indent + ' ';\n\n return {\n ...line,\n tokens,\n };\n }\n\n switch (tokens.delimiter) {\n case '/**':\n tokens.start = indent;\n break;\n case '*':\n tokens.start = indent + ' ';\n break;\n default:\n tokens.delimiter = '';\n\n // compensate delimiter\n tokens.start = indent + ' ';\n }\n\n if (!intoTags) {\n if (tokens.description === '') {\n tokens.postDelimiter = '';\n } else if (!preserveMainDescriptionPostDelimiter) {\n tokens.postDelimiter = ' ';\n }\n\n return {\n ...line,\n tokens,\n };\n }\n\n const postHyphenSpacing = customSpacings?.postHyphen ?? 1;\n const hyphenSpacing = /^\\s*-\\s+/u;\n tokens.description = tokens.description.replace(\n hyphenSpacing, '-' + ''.padStart(postHyphenSpacing, ' '),\n );\n\n // Not align.\n if (shouldAlign(tags, index, source)) {\n alignTokens(tokens, typelessInfo);\n if (!disableWrapIndent && indentTag) {\n tokens.postDelimiter += wrapIndent;\n }\n }\n\n return {\n ...line,\n tokens,\n };\n };\n\n return ({\n source,\n ...fields\n }) => {\n width = source.reduce(getWidth(tags), {\n ...zeroWidth,\n });\n\n const typelessInfo = getTypelessInfo(fields);\n\n let tagIndentMode = false;\n\n return rewireSource({\n ...fields,\n source: source.map((line, index) => {\n const indentTag = !disableWrapIndent && tagIndentMode && !line.tokens.tag && line.tokens.description;\n const ret = update(line, index, source, typelessInfo, indentTag);\n\n if (!disableWrapIndent && line.tokens.tag) {\n tagIndentMode = true;\n }\n\n return ret;\n }),\n });\n };\n};\n\nexport default alignTransform;\n"],"mappings":";;;;;;AAMA,IAAAA,cAAA,GAAAC,OAAA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AI,EAAEC,KAAK,EAAEC,MAAM,CAAC,EAAE;MACpC+B,WAAW,CAAC9B,MAAM,EAAE+B,YAAY,CAAC;MACjC,IAAI,CAACH,iBAAiB,IAAIgB,SAAS,EAAE;QACnC5C,MAAM,CAACyC,aAAa,IAAId,UAAU;MACpC;IACF;IAEA,OAAO;MACL,GAAGgB,IAAI;MACP3C;IACF,CAAC;EACH,CAAC;EAED,OAAO,CAAC;IACND,MAAM;IACN,GAAGc;EACL,CAAC,KAAK;IACJN,KAAK,GAAGR,MAAM,CAACmD,MAAM,CAAC5C,QAAQ,CAACT,IAAI,CAAC,EAAE;MACpC,GAAGN;IACL,CAAC,CAAC;IAEF,MAAMwC,YAAY,GAAGnB,eAAe,CAACC,MAAM,CAAC;IAE5C,IAAIsC,aAAa,GAAG,KAAK;IAEzB,OAAO9D,YAAY,CAAC;MAClB,GAAGwB,MAAM;MACTd,MAAM,EAAEA,MAAM,CAACkB,GAAG,CAAC,CAAC0B,IAAI,EAAE7C,KAAK,KAAK;QAClC,MAAM8C,SAAS,GAAG,CAAChB,iBAAiB,IAAIuB,aAAa,IAAI,CAACR,IAAI,CAAC3C,MAAM,CAACN,GAAG,IAAIiD,IAAI,CAAC3C,MAAM,CAACkC,WAAW;QACpG,MAAMkB,GAAG,GAAGV,MAAM,CAACC,IAAI,EAAE7C,KAAK,EAAEC,MAAM,EAAEgC,YAAY,EAAEa,SAAS,CAAC;QAEhE,IAAI,CAAChB,iBAAiB,IAAIe,IAAI,CAAC3C,MAAM,CAACN,GAAG,EAAE;UACzCyD,aAAa,GAAG,IAAI;QACtB;QAEA,OAAOC,GAAG;MACZ,CAAC;IACH,CAAC,CAAC;EACJ,CAAC;AACH,CAAC;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEahC,cAAc;AAAAiC,MAAA,CAAAF,OAAA,GAAAA,OAAA,CAAAC,OAAA","ignoreList":[]}
1
+ {"version":3,"file":"alignTransform.cjs","names":["_commentParser","require","rewireSource","util","zeroWidth","name","start","tag","type","shouldAlign","tags","index","source","tokens","replace","includesTag","includes","iterator","previousTag","getWidth","width","Math","max","length","delimiter","getTypelessInfo","fields","hasNoTypes","every","maxNamedTagLength","map","filter","maxUnnamedTagLength","space","len","padStart","alignTransform","customSpacings","disableWrapIndent","indent","preserveMainDescriptionPostDelimiter","wrapIndent","intoTags","alignTokens","typelessInfo","nothingAfter","delim","description","postName","postType","postTag","untypedNameAdjustment","untypedTypeAdjustment","spacings","postDelimiter","update","line","indentTag","isEmpty","end","postHyphenSpacing","postHyphen","hyphenSpacing","reduce","tagIndentMode","ret","_default","exports","default","module"],"sources":["../src/alignTransform.js"],"sourcesContent":["/**\n * Transform based on https://github.com/syavorsky/comment-parser/blob/master/src/transforms/align.ts\n *\n * It contains some customizations to align based on the tags, and some custom options.\n */\n\nimport {\n // `comment-parser/primitives` export\n util,\n} from 'comment-parser';\n\n/**\n * @typedef {{\n * hasNoTypes: boolean,\n * maxNamedTagLength: import('./iterateJsdoc.js').Integer,\n * maxUnnamedTagLength: import('./iterateJsdoc.js').Integer\n * }} TypelessInfo\n */\n\nconst {\n rewireSource,\n} = util;\n\n/**\n * @typedef {{\n * name: import('./iterateJsdoc.js').Integer,\n * start: import('./iterateJsdoc.js').Integer,\n * tag: import('./iterateJsdoc.js').Integer,\n * type: import('./iterateJsdoc.js').Integer\n * }} Width\n */\n\n/** @type {Width} */\nconst zeroWidth = {\n name: 0,\n start: 0,\n tag: 0,\n type: 0,\n};\n\n/**\n * @param {string[]} tags\n * @param {import('./iterateJsdoc.js').Integer} index\n * @param {import('comment-parser').Line[]} source\n * @returns {boolean}\n */\nconst shouldAlign = (tags, index, source) => {\n const tag = source[index].tokens.tag.replace('@', '');\n const includesTag = tags.includes(tag);\n\n if (includesTag) {\n return true;\n }\n\n if (tag !== '') {\n return false;\n }\n\n for (let iterator = index; iterator >= 0; iterator--) {\n const previousTag = source[iterator].tokens.tag.replace('@', '');\n\n if (previousTag !== '') {\n if (tags.includes(previousTag)) {\n return true;\n }\n\n return false;\n }\n }\n\n return true;\n};\n\n/**\n * @param {string[]} tags\n * @returns {(\n * width: Width,\n * line: {\n * tokens: import('comment-parser').Tokens\n * },\n * index: import('./iterateJsdoc.js').Integer,\n * source: import('comment-parser').Line[]\n * ) => Width}\n */\nconst getWidth = (tags) => {\n return (width, {\n tokens,\n }, index, source) => {\n if (!shouldAlign(tags, index, source)) {\n return width;\n }\n\n return {\n name: Math.max(width.name, tokens.name.length),\n start: tokens.delimiter === '/**' ? tokens.start.length : width.start,\n tag: Math.max(width.tag, tokens.tag.length),\n type: Math.max(width.type, tokens.type.length),\n };\n };\n};\n\n/**\n * @param {{\n * description: string;\n * tags: import('comment-parser').Spec[];\n * problems: import('comment-parser').Problem[];\n * }} fields\n * @returns {TypelessInfo}\n */\nconst getTypelessInfo = (fields) => {\n const hasNoTypes = fields.tags.every(({\n type,\n }) => {\n return !type;\n });\n const maxNamedTagLength = Math.max(...fields.tags.map(({\n name,\n tag,\n }) => {\n return name.length === 0 ? -1 : tag.length;\n }).filter((length) => {\n return length !== -1;\n })) + 1;\n const maxUnnamedTagLength = Math.max(...fields.tags.map(({\n name,\n tag,\n }) => {\n return name.length === 0 ? tag.length : -1;\n }).filter((length) => {\n return length !== -1;\n })) + 1;\n return {\n hasNoTypes,\n maxNamedTagLength,\n maxUnnamedTagLength,\n };\n};\n\n/**\n * @param {import('./iterateJsdoc.js').Integer} len\n * @returns {string}\n */\nconst space = (len) => {\n return ''.padStart(len, ' ');\n};\n\n/**\n * @param {{\n * customSpacings: import('../src/rules/checkLineAlignment.js').CustomSpacings,\n * tags: string[],\n * indent: string,\n * preserveMainDescriptionPostDelimiter: boolean,\n * wrapIndent: string,\n * disableWrapIndent: boolean,\n * }} cfg\n * @returns {(\n * block: import('comment-parser').Block\n * ) => import('comment-parser').Block}\n */\nconst alignTransform = ({\n customSpacings,\n disableWrapIndent,\n indent,\n preserveMainDescriptionPostDelimiter,\n tags,\n wrapIndent,\n}) => {\n let intoTags = false;\n /** @type {Width} */\n let width;\n\n /**\n * @param {import('comment-parser').Tokens} tokens\n * @param {TypelessInfo} typelessInfo\n * @returns {import('comment-parser').Tokens}\n */\n const alignTokens = (tokens, typelessInfo) => {\n const nothingAfter = {\n delim: false,\n name: false,\n tag: false,\n type: false,\n };\n\n if (tokens.description === '') {\n nothingAfter.name = true;\n tokens.postName = '';\n\n if (tokens.name === '') {\n nothingAfter.type = true;\n tokens.postType = '';\n\n if (tokens.type === '') {\n nothingAfter.tag = true;\n tokens.postTag = '';\n\n /* c8 ignore next: Never happens because the !intoTags return. But it's here for consistency with the original align transform */\n if (tokens.tag === '') {\n nothingAfter.delim = true;\n }\n }\n }\n }\n\n let untypedNameAdjustment = 0;\n let untypedTypeAdjustment = 0;\n if (typelessInfo.hasNoTypes) {\n nothingAfter.tag = true;\n tokens.postTag = '';\n if (tokens.name === '') {\n untypedNameAdjustment = typelessInfo.maxNamedTagLength - tokens.tag.length;\n } else {\n untypedNameAdjustment = typelessInfo.maxNamedTagLength > typelessInfo.maxUnnamedTagLength ? 0 :\n Math.max(0, typelessInfo.maxUnnamedTagLength - (tokens.tag.length + tokens.name.length + 1));\n untypedTypeAdjustment = typelessInfo.maxNamedTagLength - tokens.tag.length;\n }\n }\n\n // Todo: Avoid fixing alignment of blocks with multiline wrapping of type\n if (tokens.tag === '' && tokens.type) {\n return tokens;\n }\n\n const spacings = {\n postDelimiter: customSpacings?.postDelimiter || 1,\n postName: customSpacings?.postName || 1,\n postTag: customSpacings?.postTag || 1,\n postType: customSpacings?.postType || 1,\n };\n\n tokens.postDelimiter = nothingAfter.delim ? '' : space(spacings.postDelimiter);\n\n if (!nothingAfter.tag) {\n tokens.postTag = space(width.tag - tokens.tag.length + spacings.postTag);\n }\n\n if (!nothingAfter.type) {\n tokens.postType = space(width.type - tokens.type.length + spacings.postType + untypedTypeAdjustment);\n }\n\n if (!nothingAfter.name) {\n // If post name is empty for all lines (name width 0), don't add post name spacing.\n tokens.postName = width.name === 0 ? '' : space(width.name - tokens.name.length + spacings.postName + untypedNameAdjustment);\n }\n\n return tokens;\n };\n\n /**\n * @param {import('comment-parser').Line} line\n * @param {import('./iterateJsdoc.js').Integer} index\n * @param {import('comment-parser').Line[]} source\n * @param {TypelessInfo} typelessInfo\n * @param {string|false} indentTag\n * @returns {import('comment-parser').Line}\n */\n const update = (line, index, source, typelessInfo, indentTag) => {\n /** @type {import('comment-parser').Tokens} */\n const tokens = {\n ...line.tokens,\n };\n\n if (tokens.tag !== '') {\n intoTags = true;\n }\n\n const isEmpty =\n tokens.tag === '' &&\n tokens.name === '' &&\n tokens.type === '' &&\n tokens.description === '';\n\n // dangling '*/'\n if (tokens.end === '*/' && isEmpty) {\n tokens.start = indent + ' ';\n\n return {\n ...line,\n tokens,\n };\n }\n\n switch (tokens.delimiter) {\n case '*':\n tokens.start = indent + ' ';\n break;\n case '/**':\n tokens.start = indent;\n break;\n default:\n tokens.delimiter = '';\n\n // compensate delimiter\n tokens.start = indent + ' ';\n }\n\n if (!intoTags) {\n if (tokens.description === '') {\n tokens.postDelimiter = '';\n } else if (!preserveMainDescriptionPostDelimiter) {\n tokens.postDelimiter = ' ';\n }\n\n return {\n ...line,\n tokens,\n };\n }\n\n const postHyphenSpacing = customSpacings?.postHyphen ?? 1;\n const hyphenSpacing = /^\\s*-\\s+/u;\n tokens.description = tokens.description.replace(\n hyphenSpacing, '-' + ''.padStart(postHyphenSpacing, ' '),\n );\n\n // Not align.\n if (shouldAlign(tags, index, source)) {\n alignTokens(tokens, typelessInfo);\n if (!disableWrapIndent && indentTag) {\n tokens.postDelimiter += wrapIndent;\n }\n }\n\n return {\n ...line,\n tokens,\n };\n };\n\n return ({\n source,\n ...fields\n }) => {\n width = source.reduce(getWidth(tags), {\n ...zeroWidth,\n });\n\n const typelessInfo = getTypelessInfo(fields);\n\n let tagIndentMode = false;\n\n return rewireSource({\n ...fields,\n source: source.map((line, index) => {\n const indentTag = !disableWrapIndent && tagIndentMode && !line.tokens.tag && line.tokens.description;\n const ret = update(line, index, source, typelessInfo, indentTag);\n\n if (!disableWrapIndent && line.tokens.tag) {\n tagIndentMode = true;\n }\n\n return ret;\n }),\n });\n };\n};\n\nexport default alignTransform;\n"],"mappings":";;;;;;AAMA,IAAAA,cAAA,GAAAC,OAAA;AANA;AACA;AACA;AACA;AACA;;AAOA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,MAAM;EACJC;AACF,CAAC,GAAGC,mBAAI;;AAER;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,MAAMC,SAAS,GAAG;EAChBC,IAAI,EAAE,CAAC;EACPC,KAAK,EAAE,CAAC;EACRC,GAAG,EAAE,CAAC;EACNC,IAAI,EAAE;AACR,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,WAAW,GAAGA,CAACC,IAAI,EAAEC,KAAK,EAAEC,MAAM,KAAK;EAC3C,MAAML,GAAG,GAAGK,MAAM,CAACD,KAAK,CAAC,CAACE,MAAM,CAACN,GAAG,CAACO,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC;EACrD,MAAMC,WAAW,GAAGL,IAAI,CAACM,QAAQ,CAACT,GAAG,CAAC;EAEtC,IAAIQ,WAAW,EAAE;IACf,OAAO,IAAI;EACb;EAEA,IAAIR,GAAG,KAAK,EAAE,EAAE;IACd,OAAO,KAAK;EACd;EAEA,KAAK,IAAIU,QAAQ,GAAGN,KAAK,EAAEM,QAAQ,IAAI,CAAC,EAAEA,QAAQ,EAAE,EAAE;IACpD,MAAMC,WAAW,GAAGN,MAAM,CAACK,QAAQ,CAAC,CAACJ,MAAM,CAACN,GAAG,CAACO,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC;IAEhE,IAAII,WAAW,KAAK,EAAE,EAAE;MACtB,IAAIR,IAAI,CAACM,QAAQ,CAACE,WAAW,CAAC,EAAE;QAC9B,OAAO,IAAI;MACb;MAEA,OAAO,KAAK;IACd;EACF;EAEA,OAAO,IAAI;AACb,CAA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,CAAC;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEahC,cAAc;AAAAiC,MAAA,CAAAF,OAAA,GAAAA,OAAA,CAAAC,OAAA","ignoreList":[]}
@@ -52,7 +52,8 @@ const getSymbolValue = function (symbol) {
52
52
  if (symbol.type === 'literal') {
53
53
  return /** @type {ValueObject} */symbol.value.value;
54
54
  }
55
- /* c8 ignore next */
55
+ /* c8 ignore next 2 */
56
+ // eslint-disable-next-line @stylistic/padding-line-between-statements -- c8
56
57
  return null;
57
58
  };
58
59
 
@@ -125,51 +126,16 @@ const getSymbol = function (node, globals, scope, opt) {
125
126
  const opts = opt || {};
126
127
  /* c8 ignore next */
127
128
  switch (node.type) {
128
- case 'Identifier':
129
- {
130
- return getIdentifier(node, globals, scope, opts);
131
- }
132
- case 'MemberExpression':
133
- {
134
- const obj = getSymbol( /** @type {import('eslint').Rule.Node} */
135
- node.object, globals, scope, opts);
136
- const propertySymbol = getSymbol( /** @type {import('eslint').Rule.Node} */
137
- node.property, globals, scope, {
138
- simpleIdentifier: !node.computed
139
- });
140
- const propertyValue = getSymbolValue(propertySymbol);
141
-
142
- /* c8 ignore else */
143
- if (obj && propertyValue && obj.props[propertyValue]) {
144
- const block = obj.props[propertyValue];
145
- return block;
146
- }
147
- /* c8 ignore next 10 */
148
- /*
149
- if (opts.createMissingProps && propertyValue) {
150
- obj.props[propertyValue] = createNode();
151
- return obj.props[propertyValue];
152
- }
153
- */
154
- debug(`MemberExpression: Missing property ${/** @type {import('estree').PrivateIdentifier} */node.property.name}`);
155
- /* c8 ignore next 2 */
156
- return null;
157
- }
158
- case 'ClassExpression':
159
- {
160
- return getSymbol( /** @type {import('eslint').Rule.Node} */
161
- node.body, globals, scope, opts);
162
- }
163
-
164
129
  /* c8 ignore next 4 -- No longer needed? */
165
- case 'TSTypeAliasDeclaration':
130
+ case 'ArrowFunctionExpression':
131
+
166
132
  // Fallthrough
167
- case 'TSEnumDeclaration':
168
- case 'TSInterfaceDeclaration':
169
133
  case 'ClassDeclaration':
170
- case 'FunctionExpression':
171
134
  case 'FunctionDeclaration':
172
- case 'ArrowFunctionExpression':
135
+ case 'FunctionExpression':
136
+ case 'TSEnumDeclaration':
137
+ case 'TSInterfaceDeclaration':
138
+ case 'TSTypeAliasDeclaration':
173
139
  {
174
140
  const val = createNode();
175
141
  val.props.prototype = createNode();
@@ -180,7 +146,7 @@ const getSymbol = function (node, globals, scope, opt) {
180
146
  }
181
147
  case 'AssignmentExpression':
182
148
  {
183
- return createSymbol( /** @type {import('eslint').Rule.Node} */
149
+ return createSymbol(/** @type {import('eslint').Rule.Node} */
184
150
  node.left, globals, /** @type {import('eslint').Rule.Node} */
185
151
  node.right, scope, opts);
186
152
  }
@@ -188,53 +154,90 @@ const getSymbol = function (node, globals, scope, opt) {
188
154
  {
189
155
  const val = createNode();
190
156
  for (const method of node.body) {
157
+ // StaticBlock
191
158
  if (!('key' in method)) {
192
- // StaticBlock
193
159
  continue;
194
160
  }
195
- val.props[/** @type {import('estree').Identifier} */( /** @type {import('estree').MethodDefinition} */method.key).name] = createNode();
161
+ val.props[/** @type {import('estree').Identifier} */(/** @type {import('estree').MethodDefinition} */method.key).name] = createNode();
196
162
  /** @type {{[key: string]: CreatedNode}} */
197
- val.props[/** @type {import('estree').Identifier} */( /** @type {import('estree').MethodDefinition} */method.key).name].type = 'object';
163
+ val.props[/** @type {import('estree').Identifier} */(/** @type {import('estree').MethodDefinition} */method.key).name].type = 'object';
198
164
  /** @type {{[key: string]: CreatedNode}} */
199
- val.props[/** @type {import('estree').Identifier} */( /** @type {import('estree').MethodDefinition} */method.key).name].value = /** @type {import('eslint').Rule.Node} */
165
+ val.props[/** @type {import('estree').Identifier} */(/** @type {import('estree').MethodDefinition} */method.key).name].value = /** @type {import('eslint').Rule.Node} */
200
166
  /** @type {import('estree').MethodDefinition} */method.value;
201
167
  }
202
168
  val.type = 'object';
203
169
  val.value = node.parent;
204
170
  return val;
205
171
  }
172
+ case 'ClassExpression':
173
+ {
174
+ return getSymbol(/** @type {import('eslint').Rule.Node} */
175
+ node.body, globals, scope, opts);
176
+ }
177
+ case 'Identifier':
178
+ {
179
+ return getIdentifier(node, globals, scope, opts);
180
+ }
181
+ case 'Literal':
182
+ {
183
+ const val = createNode();
184
+ val.type = 'literal';
185
+ val.value = node;
186
+ return val;
187
+ }
188
+ case 'MemberExpression':
189
+ {
190
+ const obj = getSymbol(/** @type {import('eslint').Rule.Node} */
191
+ node.object, globals, scope, opts);
192
+ const propertySymbol = getSymbol(/** @type {import('eslint').Rule.Node} */
193
+ node.property, globals, scope, {
194
+ simpleIdentifier: !node.computed
195
+ });
196
+ const propertyValue = getSymbolValue(propertySymbol);
197
+
198
+ /* c8 ignore else */
199
+ if (obj && propertyValue && obj.props[propertyValue]) {
200
+ const block = obj.props[propertyValue];
201
+ return block;
202
+ }
203
+ /* c8 ignore next 11 */
204
+ /*
205
+ if (opts.createMissingProps && propertyValue) {
206
+ obj.props[propertyValue] = createNode();
207
+ return obj.props[propertyValue];
208
+ }
209
+ */
210
+ // eslint-disable-next-line @stylistic/padding-line-between-statements -- c8
211
+ debug(`MemberExpression: Missing property ${/** @type {import('estree').PrivateIdentifier} */node.property.name}`);
212
+ /* c8 ignore next 2 */
213
+ return null;
214
+ }
206
215
  case 'ObjectExpression':
207
216
  {
208
217
  const val = createNode();
209
218
  val.type = 'object';
210
219
  for (const prop of node.properties) {
211
220
  if ([
212
- // typescript-eslint, espree, acorn, etc.
213
- 'SpreadElement',
214
221
  // @babel/eslint-parser
215
- 'ExperimentalSpreadProperty'].includes(prop.type)) {
222
+ 'ExperimentalSpreadProperty',
223
+ // typescript-eslint, espree, acorn, etc.
224
+ 'SpreadElement'].includes(prop.type)) {
216
225
  continue;
217
226
  }
218
- const propVal = getSymbol( /** @type {import('eslint').Rule.Node} */
227
+ const propVal = getSymbol(/** @type {import('eslint').Rule.Node} */
219
228
  /** @type {import('estree').Property} */
220
229
  prop.value, globals, scope, opts);
221
230
  /* c8 ignore next 8 */
222
231
  if (propVal) {
223
232
  val.props[/** @type {import('estree').PrivateIdentifier} */
224
- ( /** @type {import('estree').Property} */prop.key).name] = propVal;
233
+ (/** @type {import('estree').Property} */prop.key).name] = propVal;
225
234
  }
226
235
  }
227
236
  return val;
228
237
  }
229
- case 'Literal':
230
- {
231
- const val = createNode();
232
- val.type = 'literal';
233
- val.value = node;
234
- return val;
235
- }
236
238
  }
237
- /* c8 ignore next */
239
+ /* c8 ignore next 2 */
240
+ // eslint-disable-next-line @stylistic/padding-line-between-statements -- c8
238
241
  return null;
239
242
  };
240
243
 
@@ -261,24 +264,25 @@ createSymbol = function (node, globals, value, scope, isGlobal) {
261
264
  }
262
265
  let symbol;
263
266
  switch (node.type) {
264
- case 'FunctionDeclaration':
267
+ case 'ClassDeclaration':
265
268
  /* c8 ignore next */
266
269
  // @ts-expect-error TS OK
267
270
  // Fall through
271
+ case 'FunctionDeclaration':
268
272
  case 'TSEnumDeclaration':
269
- case 'TSInterfaceDeclaration':
270
273
  /* c8 ignore next */
271
274
  // @ts-expect-error TS OK
272
275
  // Fall through
276
+ case 'TSInterfaceDeclaration':
273
277
  case 'TSTypeAliasDeclaration':
274
- case 'ClassDeclaration':
275
278
  {
276
279
  const nde = /** @type {import('estree').ClassDeclaration} */node;
277
280
  /* c8 ignore else */
278
281
  if (nde.id && nde.id.type === 'Identifier') {
279
- return createSymbol( /** @type {import('eslint').Rule.Node} */nde.id, globals, node, globals);
282
+ return createSymbol(/** @type {import('eslint').Rule.Node} */nde.id, globals, node, globals);
280
283
  }
281
- /* c8 ignore next 2 */
284
+ /* c8 ignore next 3 */
285
+ // eslint-disable-next-line @stylistic/padding-line-between-statements -- c8
282
286
  break;
283
287
  }
284
288
  case 'Identifier':
@@ -291,25 +295,27 @@ createSymbol = function (node, globals, value, scope, isGlobal) {
291
295
  createBlockSymbol(block, nde.name, valueSymbol, globals, isGlobal);
292
296
  return block.props[nde.name];
293
297
  }
294
- /* c8 ignore next */
298
+ /* c8 ignore next 2 */
299
+ // eslint-disable-next-line @stylistic/padding-line-between-statements -- c8
295
300
  debug('Identifier: Missing value symbol for %s', nde.name);
296
301
  } else {
297
302
  createBlockSymbol(block, nde.name, createNode(), globals, isGlobal);
298
303
  return block.props[nde.name];
299
304
  }
300
- /* c8 ignore next 2 */
305
+ /* c8 ignore next 3 */
306
+ // eslint-disable-next-line @stylistic/padding-line-between-statements -- c8
301
307
  break;
302
308
  }
303
309
  case 'MemberExpression':
304
310
  {
305
311
  const nde = /** @type {import('estree').MemberExpression} */node;
306
- symbol = getSymbol( /** @type {import('eslint').Rule.Node} */nde.object, globals, block);
307
- const propertySymbol = getSymbol( /** @type {import('eslint').Rule.Node} */nde.property, globals, block, {
312
+ symbol = getSymbol(/** @type {import('eslint').Rule.Node} */nde.object, globals, block);
313
+ const propertySymbol = getSymbol(/** @type {import('eslint').Rule.Node} */nde.property, globals, block, {
308
314
  simpleIdentifier: !nde.computed
309
315
  });
310
316
  const propertyValue = getSymbolValue(propertySymbol);
311
317
  if (symbol && propertyValue) {
312
- createBlockSymbol(symbol, propertyValue, getSymbol( /** @type {import('eslint').Rule.Node} */
318
+ createBlockSymbol(symbol, propertyValue, getSymbol(/** @type {import('eslint').Rule.Node} */
313
319
  value, globals, block), globals, isGlobal);
314
320
  return symbol.props[propertyValue];
315
321
  }
@@ -329,25 +335,33 @@ createSymbol = function (node, globals, value, scope, isGlobal) {
329
335
  */
330
336
  const initVariables = function (node, globals, opts) {
331
337
  switch (node.type) {
332
- case 'Program':
338
+ case 'ExportNamedDeclaration':
333
339
  {
334
- for (const childNode of node.body) {
335
- initVariables( /** @type {import('eslint').Rule.Node} */
336
- childNode, globals, opts);
340
+ if (node.declaration) {
341
+ initVariables(/** @type {import('eslint').Rule.Node} */
342
+ node.declaration, globals, opts);
337
343
  }
338
344
  break;
339
345
  }
340
346
  case 'ExpressionStatement':
341
347
  {
342
- initVariables( /** @type {import('eslint').Rule.Node} */
348
+ initVariables(/** @type {import('eslint').Rule.Node} */
343
349
  node.expression, globals, opts);
344
350
  break;
345
351
  }
352
+ case 'Program':
353
+ {
354
+ for (const childNode of node.body) {
355
+ initVariables(/** @type {import('eslint').Rule.Node} */
356
+ childNode, globals, opts);
357
+ }
358
+ break;
359
+ }
346
360
  case 'VariableDeclaration':
347
361
  {
348
362
  for (const declaration of node.declarations) {
349
363
  // let and const
350
- const symbol = createSymbol( /** @type {import('eslint').Rule.Node} */
364
+ const symbol = createSymbol(/** @type {import('eslint').Rule.Node} */
351
365
  declaration.id, globals, null, globals);
352
366
  if (opts.initWindow && node.kind === 'var' && globals.props.window) {
353
367
  // If var, also add to window
@@ -357,14 +371,6 @@ const initVariables = function (node, globals, opts) {
357
371
  }
358
372
  break;
359
373
  }
360
- case 'ExportNamedDeclaration':
361
- {
362
- if (node.declaration) {
363
- initVariables( /** @type {import('eslint').Rule.Node} */
364
- node.declaration, globals, opts);
365
- }
366
- break;
367
- }
368
374
  }
369
375
  };
370
376
 
@@ -384,56 +390,21 @@ const mapVariables = function (node, globals, opt, isExport) {
384
390
  const opts = opt || {};
385
391
  /* c8 ignore next */
386
392
  switch (node.type) {
387
- case 'Program':
388
- {
389
- if (opts.ancestorsOnly) {
390
- return false;
391
- }
392
- for (const childNode of node.body) {
393
- mapVariables( /** @type {import('eslint').Rule.Node} */
394
- childNode, globals, opts);
395
- }
396
- break;
397
- }
398
- case 'ExpressionStatement':
399
- {
400
- mapVariables( /** @type {import('eslint').Rule.Node} */
401
- node.expression, globals, opts);
402
- break;
403
- }
404
393
  case 'AssignmentExpression':
405
394
  {
406
- createSymbol( /** @type {import('eslint').Rule.Node} */
395
+ createSymbol(/** @type {import('eslint').Rule.Node} */
407
396
  node.left, globals, /** @type {import('eslint').Rule.Node} */
408
397
  node.right);
409
398
  break;
410
399
  }
411
- case 'VariableDeclaration':
412
- {
413
- for (const declaration of node.declarations) {
414
- const isGlobal = Boolean(opts.initWindow && node.kind === 'var' && globals.props.window);
415
- const symbol = createSymbol( /** @type {import('eslint').Rule.Node} */
416
- declaration.id, globals, /** @type {import('eslint').Rule.Node} */
417
- declaration.init, globals, isGlobal);
418
- if (symbol && isExport) {
419
- symbol.exported = true;
420
- }
421
- }
422
- break;
423
- }
424
- case 'TSTypeAliasDeclaration':
425
- case 'FunctionDeclaration':
400
+ case 'ClassDeclaration':
426
401
  {
427
- /* c8 ignore next 10 */
428
- if ( /** @type {import('estree').Identifier} */node.id.type === 'Identifier') {
429
- createSymbol( /** @type {import('eslint').Rule.Node} */
430
- node.id, globals, node, globals, true);
431
- }
402
+ createSymbol(/** @type {import('eslint').Rule.Node|null} */node.id, globals, /** @type {import('eslint').Rule.Node} */node.body, globals);
432
403
  break;
433
404
  }
434
405
  case 'ExportDefaultDeclaration':
435
406
  {
436
- const symbol = createSymbol( /** @type {import('eslint').Rule.Node} */
407
+ const symbol = createSymbol(/** @type {import('eslint').Rule.Node} */
437
408
  node.declaration, globals, /** @type {import('eslint').Rule.Node} */
438
409
  node.declaration);
439
410
  if (symbol) {
@@ -450,10 +421,10 @@ const mapVariables = function (node, globals, opt, isExport) {
450
421
  {
451
422
  if (node.declaration) {
452
423
  if (node.declaration.type === 'VariableDeclaration') {
453
- mapVariables( /** @type {import('eslint').Rule.Node} */
424
+ mapVariables(/** @type {import('eslint').Rule.Node} */
454
425
  node.declaration, globals, opts, true);
455
426
  } else {
456
- const symbol = createSymbol( /** @type {import('eslint').Rule.Node} */
427
+ const symbol = createSymbol(/** @type {import('eslint').Rule.Node} */
457
428
  node.declaration, globals, /** @type {import('eslint').Rule.Node} */
458
429
  node.declaration);
459
430
  /* c8 ignore next 3 */
@@ -463,14 +434,14 @@ const mapVariables = function (node, globals, opt, isExport) {
463
434
  }
464
435
  }
465
436
  for (const specifier of node.specifiers) {
466
- mapVariables( /** @type {import('eslint').Rule.Node} */
437
+ mapVariables(/** @type {import('eslint').Rule.Node} */
467
438
  specifier, globals, opts);
468
439
  }
469
440
  break;
470
441
  }
471
442
  case 'ExportSpecifier':
472
443
  {
473
- const symbol = getSymbol( /** @type {import('eslint').Rule.Node} */
444
+ const symbol = getSymbol(/** @type {import('eslint').Rule.Node} */
474
445
  node.local, globals, globals);
475
446
  /* c8 ignore next 3 */
476
447
  if (symbol) {
@@ -478,9 +449,44 @@ const mapVariables = function (node, globals, opt, isExport) {
478
449
  }
479
450
  break;
480
451
  }
481
- case 'ClassDeclaration':
452
+ case 'ExpressionStatement':
453
+ {
454
+ mapVariables(/** @type {import('eslint').Rule.Node} */
455
+ node.expression, globals, opts);
456
+ break;
457
+ }
458
+ case 'FunctionDeclaration':
459
+ case 'TSTypeAliasDeclaration':
460
+ {
461
+ /* c8 ignore next 10 */
462
+ if (/** @type {import('estree').Identifier} */node.id.type === 'Identifier') {
463
+ createSymbol(/** @type {import('eslint').Rule.Node} */
464
+ node.id, globals, node, globals, true);
465
+ }
466
+ break;
467
+ }
468
+ case 'Program':
482
469
  {
483
- createSymbol( /** @type {import('eslint').Rule.Node|null} */node.id, globals, /** @type {import('eslint').Rule.Node} */node.body, globals);
470
+ if (opts.ancestorsOnly) {
471
+ return false;
472
+ }
473
+ for (const childNode of node.body) {
474
+ mapVariables(/** @type {import('eslint').Rule.Node} */
475
+ childNode, globals, opts);
476
+ }
477
+ break;
478
+ }
479
+ case 'VariableDeclaration':
480
+ {
481
+ for (const declaration of node.declarations) {
482
+ const isGlobal = Boolean(opts.initWindow && node.kind === 'var' && globals.props.window);
483
+ const symbol = createSymbol(/** @type {import('eslint').Rule.Node} */
484
+ declaration.id, globals, /** @type {import('eslint').Rule.Node} */
485
+ declaration.init, globals, isGlobal);
486
+ if (symbol && isExport) {
487
+ symbol.exported = true;
488
+ }
489
+ }
484
490
  break;
485
491
  }
486
492
  default:
@@ -529,8 +535,8 @@ const findNode = function (node, block, cache) {
529
535
  }
530
536
  return false;
531
537
  };
532
- const exportTypes = new Set(['ExportNamedDeclaration', 'ExportDefaultDeclaration']);
533
- const ignorableNestedTypes = new Set(['FunctionDeclaration', 'ArrowFunctionExpression', 'FunctionExpression']);
538
+ const exportTypes = new Set(['ExportDefaultDeclaration', 'ExportNamedDeclaration']);
539
+ const ignorableNestedTypes = new Set(['ArrowFunctionExpression', 'FunctionDeclaration', 'FunctionExpression']);
534
540
 
535
541
  /**
536
542
  * @param {import('eslint').Rule.Node} nde
@@ -553,8 +559,8 @@ const getExportAncestor = function (nde) {
553
559
  }
554
560
  return false;
555
561
  };
556
- const canBeExportedByAncestorType = new Set(['TSPropertySignature', 'TSMethodSignature', 'ClassProperty', 'PropertyDefinition', 'Method']);
557
- const canExportChildrenType = new Set(['TSInterfaceBody', 'TSInterfaceDeclaration', 'TSTypeLiteral', 'TSTypeAliasDeclaration', 'TSTypeParameterInstantiation', 'TSTypeReference', 'ClassDeclaration', 'ClassBody', 'ClassDefinition', 'ClassExpression', 'Program']);
562
+ const canBeExportedByAncestorType = new Set(['ClassProperty', 'Method', 'PropertyDefinition', 'TSMethodSignature', 'TSPropertySignature']);
563
+ const canExportChildrenType = new Set(['ClassBody', 'ClassDeclaration', 'ClassDefinition', 'ClassExpression', 'Program', 'TSInterfaceBody', 'TSInterfaceDeclaration', 'TSTypeAliasDeclaration', 'TSTypeLiteral', 'TSTypeParameterInstantiation', 'TSTypeReference']);
558
564
 
559
565
  /**
560
566
  * @param {import('eslint').Rule.Node} nde
@@ -679,7 +685,7 @@ const parse = function (ast, node, opt) {
679
685
  props: {}
680
686
  };
681
687
  };
682
- const accessibilityNodes = new Set(['PropertyDefinition', 'MethodDefinition']);
688
+ const accessibilityNodes = new Set(['MethodDefinition', 'PropertyDefinition']);
683
689
 
684
690
  /**
685
691
  *
@@ -720,7 +726,7 @@ const isUncommentedExport = function (node, sourceCode, opt, settings) {
720
726
  }
721
727
  }
722
728
  const ast = /** @type {unknown} */sourceCode.ast;
723
- const parseResult = parse( /** @type {import('eslint').Rule.Node} */
729
+ const parseResult = parse(/** @type {import('eslint').Rule.Node} */
724
730
  ast, node, opt);
725
731
  return isNodeExported(node, /** @type {CreatedNode} */parseResult.globalVars, opt);
726
732
  };