Skip to content

Commit

Permalink
fix: consider jsdocIgnoreTags when calculating lengths
Browse files Browse the repository at this point in the history
BREAKING CHANGE: For those extending the plugin, getLengthsData now requires
the plugin options to be sent as a second parameter.
  • Loading branch information
homer0 committed Apr 9, 2024
1 parent 1c91ac1 commit 515e3a5
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/fns/render.js
Original file line number Diff line number Diff line change
Expand Up @@ -181,12 +181,17 @@ const tryToRenderTagsInColums = (tagsData, width, options, tags) => {
* Given a list of tags, it calculates the longest tag, type and name in the context of
* the block and for each tag.
*
* @param {CommentTag[]} tags The list of tags.
* @param {CommentTag[]} tags The list of tags.
* @param {PrettierOptions} options The options sent to the plugin.
* @returns {BlockLengthData}
*/
const getLengthsData = (tags) =>
const getLengthsData = (tags, options) =>
tags.reduce(
(acc, tag) => {
if (options.jsdocIgnoreTags.includes(tag.tag)) {
return acc;
}

const tagLength = tag.tag.length;
const typeLength = tag.type.length;
const hasMultilineType = tag.type.includes('\n');
Expand Down Expand Up @@ -349,7 +354,7 @@ const render = R.curry((options, column, block) => {
}

if (options.jsdocUseColumns) {
const data = get(getLengthsData)(block.tags);
const data = get(getLengthsData)(block.tags, options);
if (options.jsdocGroupColumnsByTag) {
const tagsData = get(getTagsData)(data.byTag, width, options);
let atLeastOneCannot;
Expand Down

0 comments on commit 515e3a5

Please sign in to comment.