1 line
23 KiB
Text
1 line
23 KiB
Text
|
|
{"version":3,"file":"checkLineAlignment.cjs","names":["_alignTransform","_interopRequireDefault","require","_iterateJsdoc","_commentParser","e","__esModule","default","flow","commentFlow","transforms","startsWithListMarker","text","isFirstLineOfTag","test","shouldAllowExtraIndent","tag","idx","hasSeenListMarker","lineIdx","line","source","isFirstLine","tokens","description","checkNotAlignedPerTag","utils","customSpacings","spacerProps","contentProps","mightHaveNamepath","tagMightHaveNameOrNamepath","followedBySpace","callbck","nextIndex","slice","some","spacerProp","innerIdx","contentProp","spacePropVal","ret","postHyphenSpacing","postHyphen","exactHyphenSpacing","RegExp","hasNoHyphen","hasExactHyphenSpacing","ok","contentPropVal","spacerPropVal","spacing","length","fix","entries","padStart","hasSpace","contentPrp","hyphenSpacing","replace","setTag","reportJSDoc","checkAlignment","disableWrapIndent","indent","jsdoc","jsdocNode","preserveMainDescriptionPostDelimiter","report","tags","wrapIndent","transform","alignTransform","transformedJsdoc","comment","value","formatted","stringify","trimStart","fixer","replaceText","_default","exports","iterateJsdoc","context","applicableTags","options","includes","foundTags","getPresentTags","type","name","actualIndent","postDelimiter","hasCorrectWrapIndent","hasExtraIndent","startsWith","isInListContext","number","charAt","iterateAllJsdocs","meta","docs","url","fixable","schema","enum","additionalProperties","properties","postName","postTag","postType","items","module"],"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
|