eslint-plugin-jsdoc 61.1.12 → 61.2.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.
- package/dist/rules/sortTags.cjs +13 -1
- package/dist/rules/sortTags.cjs.map +1 -1
- package/dist/rules.d.ts +10 -0
- package/package.json +1 -1
- package/src/rules/sortTags.js +13 -1
- package/src/rules.d.ts +10 -0
package/dist/rules/sortTags.cjs
CHANGED
|
@@ -11,11 +11,13 @@ var _default = exports.default = (0, _iterateJsdoc.default)(({
|
|
|
11
11
|
context,
|
|
12
12
|
jsdoc,
|
|
13
13
|
utils
|
|
14
|
+
// eslint-disable-next-line complexity -- Temporary
|
|
14
15
|
}) => {
|
|
15
16
|
const
|
|
16
17
|
/**
|
|
17
18
|
* @type {{
|
|
18
19
|
* linesBetween: import('../iterateJsdoc.js').Integer,
|
|
20
|
+
* tagExceptions: Record<string, number>,
|
|
19
21
|
* tagSequence: {
|
|
20
22
|
* tags: string[]
|
|
21
23
|
* }[],
|
|
@@ -29,6 +31,7 @@ var _default = exports.default = (0, _iterateJsdoc.default)(({
|
|
|
29
31
|
linesBetween = 1,
|
|
30
32
|
reportIntraTagGroupSpacing = true,
|
|
31
33
|
reportTagGroupSpacing = true,
|
|
34
|
+
tagExceptions = {},
|
|
32
35
|
tagSequence = _defaultTagOrder.default
|
|
33
36
|
} = context.options[0] || {};
|
|
34
37
|
const tagList = tagSequence.flatMap(obj => {
|
|
@@ -274,7 +277,7 @@ var _default = exports.default = (0, _iterateJsdoc.default)(({
|
|
|
274
277
|
continue;
|
|
275
278
|
}
|
|
276
279
|
const ct = countTagEmptyLines(tag);
|
|
277
|
-
if (ct) {
|
|
280
|
+
if (ct && (!tagExceptions[tag.tag] || tagExceptions[tag.tag] < ct)) {
|
|
278
281
|
const fixer = () => {
|
|
279
282
|
let foundFirstTag = false;
|
|
280
283
|
|
|
@@ -437,6 +440,15 @@ will not have spacing applied regardless. For adding line breaks there, you
|
|
|
437
440
|
may wish to use the \`endLines\` option of the \`tag-lines\` rule.`,
|
|
438
441
|
type: 'boolean'
|
|
439
442
|
},
|
|
443
|
+
tagExceptions: {
|
|
444
|
+
description: 'Allows specification by tag of a specific higher maximum number of lines. Keys are tags and values are the maximum number of lines allowed for such tags. Overrides `linesBetween`. Defaults to no special exceptions per tag.',
|
|
445
|
+
patternProperties: {
|
|
446
|
+
'.*': {
|
|
447
|
+
type: 'number'
|
|
448
|
+
}
|
|
449
|
+
},
|
|
450
|
+
type: 'object'
|
|
451
|
+
},
|
|
440
452
|
tagSequence: {
|
|
441
453
|
description: `An array of tag group objects indicating the preferred sequence for sorting tags.
|
|
442
454
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sortTags.cjs","names":["_defaultTagOrder","_interopRequireDefault","require","_iterateJsdoc","e","__esModule","default","_default","exports","iterateJsdoc","context","jsdoc","utils","alphabetizeExtras","linesBetween","reportIntraTagGroupSpacing","reportTagGroupSpacing","tagSequence","defaultTagOrder","options","tagList","flatMap","obj","tags","otherPos","indexOf","endPos","length","ongoingCount","idx","tag","entries","originalIndex","source","originalLine","firstChangedTagLine","firstChangedTagIndex","sortedTags","JSON","parse","stringify","sort","tagNew","tagOld","checkOrSetFirstChanged","newPos","oldPos","preferredNewPos","preferredOldPos","undefined","lastTagsOfGroup","badLastTagsOfGroup","countTagEmptyLines","reduce","acc","tokens","description","end","name","tg","type","empty","Number","innerIdx","currentTag","lastTag","includes","some","tgs","push","ct","fixer","currIdx","newIdx","emptyLine","number","seedTokens","delimiter","start","existingEmptyLines","nextTokens","lineDiff","lines","Array","from","splice","srcIdx","src","reportJSDoc","tagIdx","foundFirstTag","nextIdx","ignore","lastTagOfGroup","firstLine","getFirstLine","fix","itemsToMoveRange","keys","unchangedPriorTagDescriptions","slice","initialOffset","removeTag","changedTags","extraTagCount","changedTag","addTag","addLine","join","iterateAllJsdocs","meta","docs","url","fixable","schema","additionalProperties","properties","items","module"],"sources":["../../src/rules/sortTags.js"],"sourcesContent":["import defaultTagOrder from '../defaultTagOrder.js';\nimport iterateJsdoc from '../iterateJsdoc.js';\n\nexport default iterateJsdoc(({\n context,\n jsdoc,\n utils,\n}) => {\n const\n /**\n * @type {{\n * linesBetween: import('../iterateJsdoc.js').Integer,\n * tagSequence: {\n * tags: string[]\n * }[],\n * alphabetizeExtras: boolean,\n * reportTagGroupSpacing: boolean,\n * reportIntraTagGroupSpacing: boolean,\n * }}\n */ {\n alphabetizeExtras = false,\n linesBetween = 1,\n reportIntraTagGroupSpacing = true,\n reportTagGroupSpacing = true,\n tagSequence = defaultTagOrder,\n } = context.options[0] || {};\n\n const tagList = tagSequence.flatMap((obj) => {\n /* typeof obj === 'string' ? obj : */\n return obj.tags;\n });\n\n const otherPos = tagList.indexOf('-other');\n const endPos = otherPos > -1 ? otherPos : tagList.length;\n\n let ongoingCount = 0;\n for (const [\n idx,\n tag,\n ] of\n /**\n * @type {(\n * import('@es-joy/jsdoccomment').JsdocTagWithInline & {\n * originalIndex: import('../iterateJsdoc.js').Integer,\n * originalLine: import('../iterateJsdoc.js').Integer,\n * }\n * )[]}\n */ (jsdoc.tags).entries()) {\n tag.originalIndex = idx;\n ongoingCount += tag.source.length;\n tag.originalLine = ongoingCount;\n }\n\n /** @type {import('../iterateJsdoc.js').Integer|undefined} */\n let firstChangedTagLine;\n /** @type {import('../iterateJsdoc.js').Integer|undefined} */\n let firstChangedTagIndex;\n\n /**\n * @type {(import('comment-parser').Spec & {\n * originalIndex: import('../iterateJsdoc.js').Integer,\n * originalLine: import('../iterateJsdoc.js').Integer,\n * })[]}\n */\n const sortedTags = JSON.parse(JSON.stringify(jsdoc.tags));\n sortedTags.sort(({\n tag: tagNew,\n }, {\n originalIndex,\n originalLine,\n tag: tagOld,\n }) => {\n // Optimize: Just keep relative positions if the same tag name\n if (tagNew === tagOld) {\n return 0;\n }\n\n const checkOrSetFirstChanged = () => {\n if (!firstChangedTagLine || originalLine < firstChangedTagLine) {\n firstChangedTagLine = originalLine;\n firstChangedTagIndex = originalIndex;\n }\n };\n\n const newPos = tagList.indexOf(tagNew);\n const oldPos = tagList.indexOf(tagOld);\n\n const preferredNewPos = newPos === -1 ? endPos : newPos;\n const preferredOldPos = oldPos === -1 ? endPos : oldPos;\n\n if (preferredNewPos < preferredOldPos) {\n checkOrSetFirstChanged();\n return -1;\n }\n\n if (preferredNewPos > preferredOldPos) {\n return 1;\n }\n\n // preferredNewPos === preferredOldPos\n if (\n !alphabetizeExtras ||\n\n // Optimize: If tagNew (or tagOld which is the same) was found in the\n // priority array, it can maintain its relative position—without need\n // of alphabetizing (secondary sorting)\n newPos >= 0\n ) {\n return 0;\n }\n\n if (tagNew < tagOld) {\n checkOrSetFirstChanged();\n return -1;\n }\n\n // tagNew > tagOld\n return 1;\n });\n\n if (firstChangedTagLine === undefined) {\n // Should be ordered by now\n\n /**\n * @type {import('comment-parser').Spec[]}\n */\n const lastTagsOfGroup = [];\n\n /**\n * @type {[\n * import('comment-parser').Spec,\n * import('../iterateJsdoc.js').Integer\n * ][]}\n */\n const badLastTagsOfGroup = [];\n\n /**\n * @param {import('comment-parser').Spec} tag\n */\n const countTagEmptyLines = (tag) => {\n return tag.source.reduce((acc, {\n tokens: {\n description,\n end,\n name,\n tag: tg,\n type,\n },\n }) => {\n const empty = !tg && !type && !name && !description;\n // Reset the count so long as there is content\n return empty ? acc + Number(empty && !end) : 0;\n }, 0);\n };\n\n let idx = 0;\n for (const {\n tags,\n } of tagSequence) {\n let innerIdx;\n /** @type {import('comment-parser').Spec} */\n let currentTag;\n /** @type {import('comment-parser').Spec|undefined} */\n let lastTag;\n do {\n currentTag = jsdoc.tags[idx];\n if (!currentTag) {\n idx++;\n break;\n }\n\n innerIdx = tags.indexOf(currentTag.tag);\n\n if (\n innerIdx === -1 &&\n // eslint-disable-next-line no-loop-func -- Safe\n (!tags.includes('-other') || tagSequence.some(({\n tags: tgs,\n }) => {\n return tgs.includes(currentTag.tag);\n }))\n ) {\n idx++;\n break;\n }\n\n lastTag = currentTag;\n\n idx++;\n } while (true);\n\n idx--;\n\n if (lastTag) {\n lastTagsOfGroup.push(lastTag);\n const ct = countTagEmptyLines(lastTag);\n if (\n ct !== linesBetween &&\n // Use another rule for adding to end (should be of interest outside this rule)\n jsdoc.tags[idx]\n ) {\n badLastTagsOfGroup.push([\n lastTag, ct,\n ]);\n }\n }\n }\n\n if (reportTagGroupSpacing && badLastTagsOfGroup.length) {\n /**\n * @param {import('comment-parser').Spec} tg\n * @returns {() => void}\n */\n const fixer = (tg) => {\n return () => {\n // Due to https://github.com/syavorsky/comment-parser/issues/110 ,\n // we have to modify `jsdoc.source` rather than just modify tags\n // directly\n for (const [\n currIdx,\n {\n tokens,\n },\n ] of jsdoc.source.entries()) {\n if (tokens.tag !== '@' + tg.tag) {\n continue;\n }\n\n // Cannot be `tokens.end`, as dropped off last tag, so safe to\n // go on\n let newIdx = currIdx;\n\n const emptyLine = () => {\n return {\n number: 0,\n source: '',\n tokens: utils.seedTokens({\n delimiter: '*',\n start: jsdoc.source[newIdx - 1].tokens.start,\n }),\n };\n };\n\n let existingEmptyLines = 0;\n while (true) {\n const nextTokens = jsdoc.source[++newIdx]?.tokens;\n\n /* c8 ignore next 3 -- Guard */\n if (!nextTokens) {\n return;\n }\n\n // Should be no `nextTokens.end` to worry about since ignored\n // if not followed by tag\n\n if (nextTokens.tag) {\n // Haven't made it to last tag instance yet, so keep looking\n if (nextTokens.tag === tokens.tag) {\n existingEmptyLines = 0;\n continue;\n }\n\n const lineDiff = linesBetween - existingEmptyLines;\n if (lineDiff > 0) {\n const lines = Array.from({\n length: lineDiff,\n }, () => {\n return emptyLine();\n });\n jsdoc.source.splice(newIdx, 0, ...lines);\n } else {\n // lineDiff < 0\n jsdoc.source.splice(\n newIdx + lineDiff,\n -lineDiff,\n );\n }\n\n break;\n }\n\n const empty = !nextTokens.type && !nextTokens.name &&\n !nextTokens.description;\n\n if (empty) {\n existingEmptyLines++;\n } else {\n // Has content again, so reset empty line count\n existingEmptyLines = 0;\n }\n }\n\n break;\n }\n\n for (const [\n srcIdx,\n src,\n ] of jsdoc.source.entries()) {\n src.number = srcIdx;\n }\n };\n };\n\n for (const [\n tg,\n ] of badLastTagsOfGroup) {\n utils.reportJSDoc(\n 'Tag groups do not have the expected whitespace',\n tg,\n fixer(tg),\n );\n }\n\n return;\n }\n\n if (!reportIntraTagGroupSpacing) {\n return;\n }\n\n for (const [\n tagIdx,\n tag,\n ] of jsdoc.tags.entries()) {\n if (!jsdoc.tags[tagIdx + 1] || lastTagsOfGroup.includes(tag)) {\n continue;\n }\n\n const ct = countTagEmptyLines(tag);\n if (ct) {\n const fixer = () => {\n let foundFirstTag = false;\n\n /** @type {string|undefined} */\n let currentTag;\n\n for (const [\n currIdx,\n {\n tokens: {\n description,\n end,\n name,\n tag: tg,\n type,\n },\n },\n ] of jsdoc.source.entries()) {\n if (tg) {\n foundFirstTag = true;\n currentTag = tg;\n }\n\n if (!foundFirstTag) {\n continue;\n }\n\n if (currentTag && !tg && !type && !name && !description && !end) {\n let nextIdx = currIdx;\n\n let ignore = true;\n // Even if a tag of the same name as the last tags in a group,\n // could still be an earlier tag in that group\n\n // eslint-disable-next-line no-loop-func -- Safe\n if (lastTagsOfGroup.some((lastTagOfGroup) => {\n return currentTag === '@' + lastTagOfGroup.tag;\n })) {\n while (true) {\n const nextTokens = jsdoc.source[++nextIdx]?.tokens;\n if (!nextTokens) {\n break;\n }\n\n if (!nextTokens.tag) {\n continue;\n }\n\n // Followed by the same tag name, so not actually last in group,\n // and of interest\n if (nextTokens.tag === currentTag) {\n ignore = false;\n }\n }\n } else {\n while (true) {\n const nextTokens = jsdoc.source[++nextIdx]?.tokens;\n if (!nextTokens || nextTokens.end) {\n break;\n }\n\n // Not the very last tag, so don't ignore\n if (nextTokens.tag) {\n ignore = false;\n break;\n }\n }\n }\n\n if (!ignore) {\n jsdoc.source.splice(currIdx, 1);\n for (const [\n srcIdx,\n src,\n ] of jsdoc.source.entries()) {\n src.number = srcIdx;\n }\n }\n }\n }\n };\n\n utils.reportJSDoc(\n 'Intra-group tags have unexpected whitespace',\n tag,\n fixer,\n );\n }\n }\n\n return;\n }\n\n const firstLine = utils.getFirstLine();\n\n const fix = () => {\n const itemsToMoveRange = [\n ...Array.from({\n length: jsdoc.tags.length -\n /** @type {import('../iterateJsdoc.js').Integer} */ (\n firstChangedTagIndex\n ),\n }).keys(),\n ];\n\n const unchangedPriorTagDescriptions = jsdoc.tags.slice(\n 0,\n firstChangedTagIndex,\n ).reduce((ct, {\n source,\n }) => {\n return ct + source.length - 1;\n }, 0);\n\n // This offset includes not only the offset from where the first tag\n // must begin, and the additional offset of where the first changed\n // tag begins, but it must also account for prior descriptions\n const initialOffset = /** @type {import('../iterateJsdoc.js').Integer} */ (\n firstLine\n ) + /** @type {import('../iterateJsdoc.js').Integer} */ (firstChangedTagIndex) +\n\n // May be the first tag, so don't try finding a prior one if so\n unchangedPriorTagDescriptions;\n\n // Use `firstChangedTagLine` for line number to begin reporting/splicing\n for (const idx of itemsToMoveRange) {\n utils.removeTag(\n idx +\n /** @type {import('../iterateJsdoc.js').Integer} */ (\n firstChangedTagIndex\n ),\n );\n }\n\n const changedTags = sortedTags.slice(firstChangedTagIndex);\n let extraTagCount = 0;\n\n for (const idx of itemsToMoveRange) {\n const changedTag = changedTags[idx];\n\n utils.addTag(\n changedTag.tag,\n extraTagCount + initialOffset + idx,\n {\n ...changedTag.source[0].tokens,\n\n // `comment-parser` puts the `end` within the `tags` section, so\n // avoid adding another to jsdoc.source\n end: '',\n },\n );\n\n for (const {\n tokens,\n } of changedTag.source.slice(1)) {\n if (!tokens.end) {\n utils.addLine(\n extraTagCount + initialOffset + idx + 1,\n {\n ...tokens,\n end: '',\n },\n );\n extraTagCount++;\n }\n }\n }\n };\n\n utils.reportJSDoc(\n `Tags are not in the prescribed order: ${\n tagList.join(', ') || '(alphabetical)'\n }`,\n jsdoc.tags[/** @type {import('../iterateJsdoc.js').Integer} */ (\n firstChangedTagIndex\n )],\n fix,\n true,\n );\n}, {\n iterateAllJsdocs: true,\n meta: {\n docs: {\n description: 'Sorts tags by a specified sequence according to tag name, optionally adding line breaks between tag groups.',\n url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/sort-tags.md#repos-sticky-header',\n },\n fixable: 'code',\n schema: [\n {\n additionalProperties: false,\n properties: {\n alphabetizeExtras: {\n description: `Defaults to \\`false\\`. Alphabetizes any items not within \\`tagSequence\\` after any\nitems within \\`tagSequence\\` (or in place of the special \\`-other\\` pseudo-tag)\nare sorted.\n\nIf you want all your tags alphabetized, you can supply an empty array for\n\\`tagSequence\\` along with setting this option to \\`true\\`.`,\n type: 'boolean',\n },\n linesBetween: {\n description: `Indicates the number of lines to be added between tag groups. Defaults to 1.\nDo not set to 0 or 2+ if you are using \\`tag-lines\\` and \\`\"always\"\\` and do not\nset to 1+ if you are using \\`tag-lines\\` and \\`\"never\"\\`.`,\n type: 'integer',\n },\n reportIntraTagGroupSpacing: {\n description: `Whether to enable reporting and fixing of line breaks within tags of a given\ntag group. Defaults to \\`true\\` which will remove any line breaks at the end of\nsuch tags. Do not use with \\`true\\` if you are using \\`tag-lines\\` and \\`always\\`.`,\n type: 'boolean',\n },\n reportTagGroupSpacing: {\n description: `Whether to enable reporting and fixing of line breaks between tag groups\nas set by \\`linesBetween\\`. Defaults to \\`true\\`. Note that the very last tag\nwill not have spacing applied regardless. For adding line breaks there, you\nmay wish to use the \\`endLines\\` option of the \\`tag-lines\\` rule.`,\n type: 'boolean',\n },\n tagSequence: {\n description: `An array of tag group objects indicating the preferred sequence for sorting tags.\n\nEach item in the array should be an object with a \\`tags\\` property set to an array\nof tag names.\n\nTag names earlier in the list will be arranged first. The relative position of\ntags of the same name will not be changed.\n\nEarlier groups will also be arranged before later groups, but with the added\nfeature that additional line breaks may be added between (or before or after)\nsuch groups (depending on the setting of \\`linesBetween\\`).\n\nTag names not in the list will be grouped together at the end. The pseudo-tag\n\\`-other\\` can be used to place them anywhere else if desired. The tags will be\nplaced in their order of appearance, or alphabetized if \\`alphabetizeExtras\\`\nis enabled, see more below about that option.\n\nDefaults to the array below (noting that it is just a single tag group with\nno lines between groups by default).\n\nPlease note that this order is still experimental, so if you want to retain\na fixed order that doesn't change into the future, supply your own\n\\`tagSequence\\`.\n\n\\`\\`\\`js\n[{tags: [\n // Brief descriptions\n 'summary',\n 'typeSummary',\n\n // Module/file-level\n 'module',\n 'exports',\n 'file',\n 'fileoverview',\n 'overview',\n 'import',\n\n // Identifying (name, type)\n 'typedef',\n 'interface',\n 'record',\n 'template',\n 'name',\n 'kind',\n 'type',\n 'alias',\n 'external',\n 'host',\n 'callback',\n 'func',\n 'function',\n 'method',\n 'class',\n 'constructor',\n\n // Relationships\n 'modifies',\n 'mixes',\n 'mixin',\n 'mixinClass',\n 'mixinFunction',\n 'namespace',\n 'borrows',\n 'constructs',\n 'lends',\n 'implements',\n 'requires',\n\n // Long descriptions\n 'desc',\n 'description',\n 'classdesc',\n 'tutorial',\n 'copyright',\n 'license',\n\n // Simple annotations\n 'const',\n 'constant',\n 'final',\n 'global',\n 'readonly',\n 'abstract',\n 'virtual',\n 'var',\n 'member',\n 'memberof',\n 'memberof!',\n 'inner',\n 'instance',\n 'inheritdoc',\n 'inheritDoc',\n 'override',\n 'hideconstructor',\n\n // Core function/object info\n 'param',\n 'arg',\n 'argument',\n 'prop',\n 'property',\n 'return',\n 'returns',\n\n // Important behavior details\n 'async',\n 'generator',\n 'default',\n 'defaultvalue',\n 'enum',\n 'augments',\n 'extends',\n 'throws',\n 'exception',\n 'yield',\n 'yields',\n 'event',\n 'fires',\n 'emits',\n 'listens',\n 'this',\n\n // Access\n 'static',\n 'private',\n 'protected',\n 'public',\n 'access',\n 'package',\n\n '-other',\n\n // Supplementary descriptions\n 'see',\n 'example',\n\n // METADATA\n\n // Other Closure (undocumented) metadata\n 'closurePrimitive',\n 'customElement',\n 'expose',\n 'hidden',\n 'idGenerator',\n 'meaning',\n 'ngInject',\n 'owner',\n 'wizaction',\n\n // Other Closure (documented) metadata\n 'define',\n 'dict',\n 'export',\n 'externs',\n 'implicitCast',\n 'noalias',\n 'nocollapse',\n 'nocompile',\n 'noinline',\n 'nosideeffects',\n 'polymer',\n 'polymerBehavior',\n 'preserve',\n 'struct',\n 'suppress',\n 'unrestricted',\n\n // @homer0/prettier-plugin-jsdoc metadata\n 'category',\n\n // Non-Closure metadata\n 'ignore',\n 'author',\n 'version',\n 'variation',\n 'since',\n 'deprecated',\n 'todo',\n]}];\n\\`\\`\\``,\n items: {\n additionalProperties: false,\n properties: {\n tags: {\n description: 'See description on `tagSequence`.',\n items: {\n type: 'string',\n },\n type: 'array',\n },\n },\n type: 'object',\n },\n type: 'array',\n },\n },\n type: 'object',\n },\n ],\n type: 'suggestion',\n },\n});\n"],"mappings":";;;;;;AAAA,IAAAA,gBAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,aAAA,GAAAF,sBAAA,CAAAC,OAAA;AAA8C,SAAAD,uBAAAG,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,IAAAG,QAAA,GAAAC,OAAA,CAAAF,OAAA,GAE/B,IAAAG,qBAAY,EAAC,CAAC;EAC3BC,OAAO;EACPC,KAAK;EACLC;AACF,CAAC,KAAK;EACJ;EACE;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EAAQ;IACFC,iBAAiB,GAAG,KAAK;IACzBC,YAAY,GAAG,CAAC;IAChBC,0BAA0B,GAAG,IAAI;IACjCC,qBAAqB,GAAG,IAAI;IAC5BC,WAAW,GAAGC;EAChB,CAAC,GAAGR,OAAO,CAACS,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;EAE9B,MAAMC,OAAO,GAAGH,WAAW,CAACI,OAAO,CAAEC,GAAG,IAAK;IAC3C;IACA,OAAOA,GAAG,CAACC,IAAI;EACjB,CAAC,CAAC;EAEF,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zB;AACA,mFAAmF;UACvEI,IAAI,EAAE;QACR,CAAC;QACD5C,qBAAqB,EAAE;UACrBwC,WAAW,EAAE;AACzB;AACA;AACA,mEAAmE;UACvDI,IAAI,EAAE;QACR,CAAC;QACD3C,WAAW,EAAE;UACXuC,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;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;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;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;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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;UACK6D,KAAK,EAAE;YACLF,oBAAoB,EAAE,KAAK;YAC3BC,UAAU,EAAE;cACV7F,IAAI,EAAE;gBACJiC,WAAW,EAAE,mCAAmC;gBAChD6D,KAAK,EAAE;kBACLzD,IAAI,EAAE;gBACR,CAAC;gBACDA,IAAI,EAAE;cACR;YACF,CAAC;YACDA,IAAI,EAAE;UACR,CAAC;UACDA,IAAI,EAAE;QACR;MACF,CAAC;MACDA,IAAI,EAAE;IACR,CAAC,CACF;IACDA,IAAI,EAAE;EACR;AACF,CAAC,CAAC;AAAA0D,MAAA,CAAA9G,OAAA,GAAAA,OAAA,CAAAF,OAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"sortTags.cjs","names":["_defaultTagOrder","_interopRequireDefault","require","_iterateJsdoc","e","__esModule","default","_default","exports","iterateJsdoc","context","jsdoc","utils","alphabetizeExtras","linesBetween","reportIntraTagGroupSpacing","reportTagGroupSpacing","tagExceptions","tagSequence","defaultTagOrder","options","tagList","flatMap","obj","tags","otherPos","indexOf","endPos","length","ongoingCount","idx","tag","entries","originalIndex","source","originalLine","firstChangedTagLine","firstChangedTagIndex","sortedTags","JSON","parse","stringify","sort","tagNew","tagOld","checkOrSetFirstChanged","newPos","oldPos","preferredNewPos","preferredOldPos","undefined","lastTagsOfGroup","badLastTagsOfGroup","countTagEmptyLines","reduce","acc","tokens","description","end","name","tg","type","empty","Number","innerIdx","currentTag","lastTag","includes","some","tgs","push","ct","fixer","currIdx","newIdx","emptyLine","number","seedTokens","delimiter","start","existingEmptyLines","nextTokens","lineDiff","lines","Array","from","splice","srcIdx","src","reportJSDoc","tagIdx","foundFirstTag","nextIdx","ignore","lastTagOfGroup","firstLine","getFirstLine","fix","itemsToMoveRange","keys","unchangedPriorTagDescriptions","slice","initialOffset","removeTag","changedTags","extraTagCount","changedTag","addTag","addLine","join","iterateAllJsdocs","meta","docs","url","fixable","schema","additionalProperties","properties","patternProperties","items","module"],"sources":["../../src/rules/sortTags.js"],"sourcesContent":["import defaultTagOrder from '../defaultTagOrder.js';\nimport iterateJsdoc from '../iterateJsdoc.js';\n\nexport default iterateJsdoc(({\n context,\n jsdoc,\n utils,\n// eslint-disable-next-line complexity -- Temporary\n}) => {\n const\n /**\n * @type {{\n * linesBetween: import('../iterateJsdoc.js').Integer,\n * tagExceptions: Record<string, number>,\n * tagSequence: {\n * tags: string[]\n * }[],\n * alphabetizeExtras: boolean,\n * reportTagGroupSpacing: boolean,\n * reportIntraTagGroupSpacing: boolean,\n * }}\n */ {\n alphabetizeExtras = false,\n linesBetween = 1,\n reportIntraTagGroupSpacing = true,\n reportTagGroupSpacing = true,\n tagExceptions = {},\n tagSequence = defaultTagOrder,\n } = context.options[0] || {};\n\n const tagList = tagSequence.flatMap((obj) => {\n /* typeof obj === 'string' ? obj : */\n return obj.tags;\n });\n\n const otherPos = tagList.indexOf('-other');\n const endPos = otherPos > -1 ? otherPos : tagList.length;\n\n let ongoingCount = 0;\n for (const [\n idx,\n tag,\n ] of\n /**\n * @type {(\n * import('@es-joy/jsdoccomment').JsdocTagWithInline & {\n * originalIndex: import('../iterateJsdoc.js').Integer,\n * originalLine: import('../iterateJsdoc.js').Integer,\n * }\n * )[]}\n */ (jsdoc.tags).entries()) {\n tag.originalIndex = idx;\n ongoingCount += tag.source.length;\n tag.originalLine = ongoingCount;\n }\n\n /** @type {import('../iterateJsdoc.js').Integer|undefined} */\n let firstChangedTagLine;\n /** @type {import('../iterateJsdoc.js').Integer|undefined} */\n let firstChangedTagIndex;\n\n /**\n * @type {(import('comment-parser').Spec & {\n * originalIndex: import('../iterateJsdoc.js').Integer,\n * originalLine: import('../iterateJsdoc.js').Integer,\n * })[]}\n */\n const sortedTags = JSON.parse(JSON.stringify(jsdoc.tags));\n sortedTags.sort(({\n tag: tagNew,\n }, {\n originalIndex,\n originalLine,\n tag: tagOld,\n }) => {\n // Optimize: Just keep relative positions if the same tag name\n if (tagNew === tagOld) {\n return 0;\n }\n\n const checkOrSetFirstChanged = () => {\n if (!firstChangedTagLine || originalLine < firstChangedTagLine) {\n firstChangedTagLine = originalLine;\n firstChangedTagIndex = originalIndex;\n }\n };\n\n const newPos = tagList.indexOf(tagNew);\n const oldPos = tagList.indexOf(tagOld);\n\n const preferredNewPos = newPos === -1 ? endPos : newPos;\n const preferredOldPos = oldPos === -1 ? endPos : oldPos;\n\n if (preferredNewPos < preferredOldPos) {\n checkOrSetFirstChanged();\n return -1;\n }\n\n if (preferredNewPos > preferredOldPos) {\n return 1;\n }\n\n // preferredNewPos === preferredOldPos\n if (\n !alphabetizeExtras ||\n\n // Optimize: If tagNew (or tagOld which is the same) was found in the\n // priority array, it can maintain its relative position—without need\n // of alphabetizing (secondary sorting)\n newPos >= 0\n ) {\n return 0;\n }\n\n if (tagNew < tagOld) {\n checkOrSetFirstChanged();\n return -1;\n }\n\n // tagNew > tagOld\n return 1;\n });\n\n if (firstChangedTagLine === undefined) {\n // Should be ordered by now\n\n /**\n * @type {import('comment-parser').Spec[]}\n */\n const lastTagsOfGroup = [];\n\n /**\n * @type {[\n * import('comment-parser').Spec,\n * import('../iterateJsdoc.js').Integer\n * ][]}\n */\n const badLastTagsOfGroup = [];\n\n /**\n * @param {import('comment-parser').Spec} tag\n */\n const countTagEmptyLines = (tag) => {\n return tag.source.reduce((acc, {\n tokens: {\n description,\n end,\n name,\n tag: tg,\n type,\n },\n }) => {\n const empty = !tg && !type && !name && !description;\n // Reset the count so long as there is content\n return empty ? acc + Number(empty && !end) : 0;\n }, 0);\n };\n\n let idx = 0;\n for (const {\n tags,\n } of tagSequence) {\n let innerIdx;\n /** @type {import('comment-parser').Spec} */\n let currentTag;\n /** @type {import('comment-parser').Spec|undefined} */\n let lastTag;\n do {\n currentTag = jsdoc.tags[idx];\n if (!currentTag) {\n idx++;\n break;\n }\n\n innerIdx = tags.indexOf(currentTag.tag);\n\n if (\n innerIdx === -1 &&\n // eslint-disable-next-line no-loop-func -- Safe\n (!tags.includes('-other') || tagSequence.some(({\n tags: tgs,\n }) => {\n return tgs.includes(currentTag.tag);\n }))\n ) {\n idx++;\n break;\n }\n\n lastTag = currentTag;\n\n idx++;\n } while (true);\n\n idx--;\n\n if (lastTag) {\n lastTagsOfGroup.push(lastTag);\n const ct = countTagEmptyLines(lastTag);\n if (\n ct !== linesBetween &&\n // Use another rule for adding to end (should be of interest outside this rule)\n jsdoc.tags[idx]\n ) {\n badLastTagsOfGroup.push([\n lastTag, ct,\n ]);\n }\n }\n }\n\n if (reportTagGroupSpacing && badLastTagsOfGroup.length) {\n /**\n * @param {import('comment-parser').Spec} tg\n * @returns {() => void}\n */\n const fixer = (tg) => {\n return () => {\n // Due to https://github.com/syavorsky/comment-parser/issues/110 ,\n // we have to modify `jsdoc.source` rather than just modify tags\n // directly\n for (const [\n currIdx,\n {\n tokens,\n },\n ] of jsdoc.source.entries()) {\n if (tokens.tag !== '@' + tg.tag) {\n continue;\n }\n\n // Cannot be `tokens.end`, as dropped off last tag, so safe to\n // go on\n let newIdx = currIdx;\n\n const emptyLine = () => {\n return {\n number: 0,\n source: '',\n tokens: utils.seedTokens({\n delimiter: '*',\n start: jsdoc.source[newIdx - 1].tokens.start,\n }),\n };\n };\n\n let existingEmptyLines = 0;\n while (true) {\n const nextTokens = jsdoc.source[++newIdx]?.tokens;\n\n /* c8 ignore next 3 -- Guard */\n if (!nextTokens) {\n return;\n }\n\n // Should be no `nextTokens.end` to worry about since ignored\n // if not followed by tag\n\n if (nextTokens.tag) {\n // Haven't made it to last tag instance yet, so keep looking\n if (nextTokens.tag === tokens.tag) {\n existingEmptyLines = 0;\n continue;\n }\n\n const lineDiff = linesBetween - existingEmptyLines;\n if (lineDiff > 0) {\n const lines = Array.from({\n length: lineDiff,\n }, () => {\n return emptyLine();\n });\n jsdoc.source.splice(newIdx, 0, ...lines);\n } else {\n // lineDiff < 0\n jsdoc.source.splice(\n newIdx + lineDiff,\n -lineDiff,\n );\n }\n\n break;\n }\n\n const empty = !nextTokens.type && !nextTokens.name &&\n !nextTokens.description;\n\n if (empty) {\n existingEmptyLines++;\n } else {\n // Has content again, so reset empty line count\n existingEmptyLines = 0;\n }\n }\n\n break;\n }\n\n for (const [\n srcIdx,\n src,\n ] of jsdoc.source.entries()) {\n src.number = srcIdx;\n }\n };\n };\n\n for (const [\n tg,\n ] of badLastTagsOfGroup) {\n utils.reportJSDoc(\n 'Tag groups do not have the expected whitespace',\n tg,\n fixer(tg),\n );\n }\n\n return;\n }\n\n if (!reportIntraTagGroupSpacing) {\n return;\n }\n\n for (const [\n tagIdx,\n tag,\n ] of jsdoc.tags.entries()) {\n if (!jsdoc.tags[tagIdx + 1] || lastTagsOfGroup.includes(tag)) {\n continue;\n }\n\n const ct = countTagEmptyLines(tag);\n if (ct && (!tagExceptions[tag.tag] || tagExceptions[tag.tag] < ct)) {\n const fixer = () => {\n let foundFirstTag = false;\n\n /** @type {string|undefined} */\n let currentTag;\n\n for (const [\n currIdx,\n {\n tokens: {\n description,\n end,\n name,\n tag: tg,\n type,\n },\n },\n ] of jsdoc.source.entries()) {\n if (tg) {\n foundFirstTag = true;\n currentTag = tg;\n }\n\n if (!foundFirstTag) {\n continue;\n }\n\n if (currentTag && !tg && !type && !name && !description && !end) {\n let nextIdx = currIdx;\n\n let ignore = true;\n // Even if a tag of the same name as the last tags in a group,\n // could still be an earlier tag in that group\n\n // eslint-disable-next-line no-loop-func -- Safe\n if (lastTagsOfGroup.some((lastTagOfGroup) => {\n return currentTag === '@' + lastTagOfGroup.tag;\n })) {\n while (true) {\n const nextTokens = jsdoc.source[++nextIdx]?.tokens;\n if (!nextTokens) {\n break;\n }\n\n if (!nextTokens.tag) {\n continue;\n }\n\n // Followed by the same tag name, so not actually last in group,\n // and of interest\n if (nextTokens.tag === currentTag) {\n ignore = false;\n }\n }\n } else {\n while (true) {\n const nextTokens = jsdoc.source[++nextIdx]?.tokens;\n if (!nextTokens || nextTokens.end) {\n break;\n }\n\n // Not the very last tag, so don't ignore\n if (nextTokens.tag) {\n ignore = false;\n break;\n }\n }\n }\n\n if (!ignore) {\n jsdoc.source.splice(currIdx, 1);\n for (const [\n srcIdx,\n src,\n ] of jsdoc.source.entries()) {\n src.number = srcIdx;\n }\n }\n }\n }\n };\n\n utils.reportJSDoc(\n 'Intra-group tags have unexpected whitespace',\n tag,\n fixer,\n );\n }\n }\n\n return;\n }\n\n const firstLine = utils.getFirstLine();\n\n const fix = () => {\n const itemsToMoveRange = [\n ...Array.from({\n length: jsdoc.tags.length -\n /** @type {import('../iterateJsdoc.js').Integer} */ (\n firstChangedTagIndex\n ),\n }).keys(),\n ];\n\n const unchangedPriorTagDescriptions = jsdoc.tags.slice(\n 0,\n firstChangedTagIndex,\n ).reduce((ct, {\n source,\n }) => {\n return ct + source.length - 1;\n }, 0);\n\n // This offset includes not only the offset from where the first tag\n // must begin, and the additional offset of where the first changed\n // tag begins, but it must also account for prior descriptions\n const initialOffset = /** @type {import('../iterateJsdoc.js').Integer} */ (\n firstLine\n ) + /** @type {import('../iterateJsdoc.js').Integer} */ (firstChangedTagIndex) +\n\n // May be the first tag, so don't try finding a prior one if so\n unchangedPriorTagDescriptions;\n\n // Use `firstChangedTagLine` for line number to begin reporting/splicing\n for (const idx of itemsToMoveRange) {\n utils.removeTag(\n idx +\n /** @type {import('../iterateJsdoc.js').Integer} */ (\n firstChangedTagIndex\n ),\n );\n }\n\n const changedTags = sortedTags.slice(firstChangedTagIndex);\n let extraTagCount = 0;\n\n for (const idx of itemsToMoveRange) {\n const changedTag = changedTags[idx];\n\n utils.addTag(\n changedTag.tag,\n extraTagCount + initialOffset + idx,\n {\n ...changedTag.source[0].tokens,\n\n // `comment-parser` puts the `end` within the `tags` section, so\n // avoid adding another to jsdoc.source\n end: '',\n },\n );\n\n for (const {\n tokens,\n } of changedTag.source.slice(1)) {\n if (!tokens.end) {\n utils.addLine(\n extraTagCount + initialOffset + idx + 1,\n {\n ...tokens,\n end: '',\n },\n );\n extraTagCount++;\n }\n }\n }\n };\n\n utils.reportJSDoc(\n `Tags are not in the prescribed order: ${\n tagList.join(', ') || '(alphabetical)'\n }`,\n jsdoc.tags[/** @type {import('../iterateJsdoc.js').Integer} */ (\n firstChangedTagIndex\n )],\n fix,\n true,\n );\n}, {\n iterateAllJsdocs: true,\n meta: {\n docs: {\n description: 'Sorts tags by a specified sequence according to tag name, optionally adding line breaks between tag groups.',\n url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/sort-tags.md#repos-sticky-header',\n },\n fixable: 'code',\n schema: [\n {\n additionalProperties: false,\n properties: {\n alphabetizeExtras: {\n description: `Defaults to \\`false\\`. Alphabetizes any items not within \\`tagSequence\\` after any\nitems within \\`tagSequence\\` (or in place of the special \\`-other\\` pseudo-tag)\nare sorted.\n\nIf you want all your tags alphabetized, you can supply an empty array for\n\\`tagSequence\\` along with setting this option to \\`true\\`.`,\n type: 'boolean',\n },\n linesBetween: {\n description: `Indicates the number of lines to be added between tag groups. Defaults to 1.\nDo not set to 0 or 2+ if you are using \\`tag-lines\\` and \\`\"always\"\\` and do not\nset to 1+ if you are using \\`tag-lines\\` and \\`\"never\"\\`.`,\n type: 'integer',\n },\n reportIntraTagGroupSpacing: {\n description: `Whether to enable reporting and fixing of line breaks within tags of a given\ntag group. Defaults to \\`true\\` which will remove any line breaks at the end of\nsuch tags. Do not use with \\`true\\` if you are using \\`tag-lines\\` and \\`always\\`.`,\n type: 'boolean',\n },\n reportTagGroupSpacing: {\n description: `Whether to enable reporting and fixing of line breaks between tag groups\nas set by \\`linesBetween\\`. Defaults to \\`true\\`. Note that the very last tag\nwill not have spacing applied regardless. For adding line breaks there, you\nmay wish to use the \\`endLines\\` option of the \\`tag-lines\\` rule.`,\n type: 'boolean',\n },\n tagExceptions: {\n description: 'Allows specification by tag of a specific higher maximum number of lines. Keys are tags and values are the maximum number of lines allowed for such tags. Overrides `linesBetween`. Defaults to no special exceptions per tag.',\n patternProperties: {\n '.*': {\n type: 'number',\n },\n },\n type: 'object',\n },\n tagSequence: {\n description: `An array of tag group objects indicating the preferred sequence for sorting tags.\n\nEach item in the array should be an object with a \\`tags\\` property set to an array\nof tag names.\n\nTag names earlier in the list will be arranged first. The relative position of\ntags of the same name will not be changed.\n\nEarlier groups will also be arranged before later groups, but with the added\nfeature that additional line breaks may be added between (or before or after)\nsuch groups (depending on the setting of \\`linesBetween\\`).\n\nTag names not in the list will be grouped together at the end. The pseudo-tag\n\\`-other\\` can be used to place them anywhere else if desired. The tags will be\nplaced in their order of appearance, or alphabetized if \\`alphabetizeExtras\\`\nis enabled, see more below about that option.\n\nDefaults to the array below (noting that it is just a single tag group with\nno lines between groups by default).\n\nPlease note that this order is still experimental, so if you want to retain\na fixed order that doesn't change into the future, supply your own\n\\`tagSequence\\`.\n\n\\`\\`\\`js\n[{tags: [\n // Brief descriptions\n 'summary',\n 'typeSummary',\n\n // Module/file-level\n 'module',\n 'exports',\n 'file',\n 'fileoverview',\n 'overview',\n 'import',\n\n // Identifying (name, type)\n 'typedef',\n 'interface',\n 'record',\n 'template',\n 'name',\n 'kind',\n 'type',\n 'alias',\n 'external',\n 'host',\n 'callback',\n 'func',\n 'function',\n 'method',\n 'class',\n 'constructor',\n\n // Relationships\n 'modifies',\n 'mixes',\n 'mixin',\n 'mixinClass',\n 'mixinFunction',\n 'namespace',\n 'borrows',\n 'constructs',\n 'lends',\n 'implements',\n 'requires',\n\n // Long descriptions\n 'desc',\n 'description',\n 'classdesc',\n 'tutorial',\n 'copyright',\n 'license',\n\n // Simple annotations\n 'const',\n 'constant',\n 'final',\n 'global',\n 'readonly',\n 'abstract',\n 'virtual',\n 'var',\n 'member',\n 'memberof',\n 'memberof!',\n 'inner',\n 'instance',\n 'inheritdoc',\n 'inheritDoc',\n 'override',\n 'hideconstructor',\n\n // Core function/object info\n 'param',\n 'arg',\n 'argument',\n 'prop',\n 'property',\n 'return',\n 'returns',\n\n // Important behavior details\n 'async',\n 'generator',\n 'default',\n 'defaultvalue',\n 'enum',\n 'augments',\n 'extends',\n 'throws',\n 'exception',\n 'yield',\n 'yields',\n 'event',\n 'fires',\n 'emits',\n 'listens',\n 'this',\n\n // Access\n 'static',\n 'private',\n 'protected',\n 'public',\n 'access',\n 'package',\n\n '-other',\n\n // Supplementary descriptions\n 'see',\n 'example',\n\n // METADATA\n\n // Other Closure (undocumented) metadata\n 'closurePrimitive',\n 'customElement',\n 'expose',\n 'hidden',\n 'idGenerator',\n 'meaning',\n 'ngInject',\n 'owner',\n 'wizaction',\n\n // Other Closure (documented) metadata\n 'define',\n 'dict',\n 'export',\n 'externs',\n 'implicitCast',\n 'noalias',\n 'nocollapse',\n 'nocompile',\n 'noinline',\n 'nosideeffects',\n 'polymer',\n 'polymerBehavior',\n 'preserve',\n 'struct',\n 'suppress',\n 'unrestricted',\n\n // @homer0/prettier-plugin-jsdoc metadata\n 'category',\n\n // Non-Closure metadata\n 'ignore',\n 'author',\n 'version',\n 'variation',\n 'since',\n 'deprecated',\n 'todo',\n]}];\n\\`\\`\\``,\n items: {\n additionalProperties: false,\n properties: {\n tags: {\n description: 'See description on `tagSequence`.',\n items: {\n type: 'string',\n },\n type: 'array',\n },\n },\n type: 'object',\n },\n type: 'array',\n },\n },\n type: 'object',\n },\n ],\n type: 'suggestion',\n },\n});\n"],"mappings":";;;;;;AAAA,IAAAA,gBAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,aAAA,GAAAF,sBAAA,CAAAC,OAAA;AAA8C,SAAAD,uBAAAG,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,IAAAG,QAAA,GAAAC,OAAA,CAAAF,OAAA,GAE/B,IAAAG,qBAAY,EAAC,CAAC;EAC3BC,OAAO;EACPC,KAAK;EACLC;EACF;AACA,CAAC,KAAK;EACJ;EACE;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EAAQ;IACFC,iBAAiB,GAAG,KAAK;IACzBC,YAAY,GAAG,CAAC;IAChBC,0BAA0B,GAAG,IAAI;IACjCC,qBAAqB,GAAG,IAAI;IAC5BC,aAAa,GAAG,CAAC,CAAC;IAClBC,WAAW,GAAGC;EAChB,CAAC,GAAGT,OAAO,CAACU,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;EAE9B,MAAMC,OAA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E;UACjB4C,WAAW,EAAE;AACzB;AACA;AACA;AACA;AACA,4DAA4D;UAChDI,IAAI,EAAE;QACR,CAAC;QACD/C,YAAY,EAAE;UACZ2C,WAAW,EAAE;AACzB;AACA,0DAA0D;UAC9CI,IAAI,EAAE;QACR,CAAC;QACD9C,0BAA0B,EAAE;UAC1B0C,WAAW,EAAE;AACzB;AACA,mFAAmF;UACvEI,IAAI,EAAE;QACR,CAAC;QACD7C,qBAAqB,EAAE;UACrByC,WAAW,EAAE;AACzB;AACA;AACA,mEAAmE;UACvDI,IAAI,EAAE;QACR,CAAC;QACD5C,aAAa,EAAE;UACbwC,WAAW,EAAE,gOAAgO;UAC7O6D,iBAAiB,EAAE;YACjB,IAAI,EAAE;cACJzD,IAAI,EAAE;YACR;UACF,CAAC;UACDA,IAAI,EAAE;QACR,CAAC;QACD3C,WAAW,EAAE;UACXuC,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;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;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;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;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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;UACK8D,KAAK,EAAE;YACLH,oBAAoB,EAAE,KAAK;YAC3BC,UAAU,EAAE;cACV7F,IAAI,EAAE;gBACJiC,WAAW,EAAE,mCAAmC;gBAChD8D,KAAK,EAAE;kBACL1D,IAAI,EAAE;gBACR,CAAC;gBACDA,IAAI,EAAE;cACR;YACF,CAAC;YACDA,IAAI,EAAE;UACR,CAAC;UACDA,IAAI,EAAE;QACR;MACF,CAAC;MACDA,IAAI,EAAE;IACR,CAAC,CACF;IACDA,IAAI,EAAE;EACR;AACF,CAAC,CAAC;AAAA2D,MAAA,CAAAhH,OAAA,GAAAA,OAAA,CAAAF,OAAA","ignoreList":[]}
|
package/dist/rules.d.ts
CHANGED
|
@@ -2660,6 +2660,16 @@ export interface Rules {
|
|
|
2660
2660
|
* may wish to use the `endLines` option of the `tag-lines` rule.
|
|
2661
2661
|
*/
|
|
2662
2662
|
reportTagGroupSpacing?: boolean;
|
|
2663
|
+
/**
|
|
2664
|
+
* Allows specification by tag of a specific higher maximum number of lines. Keys are tags and values are the maximum number of lines allowed for such tags. Overrides `linesBetween`. Defaults to no special exceptions per tag.
|
|
2665
|
+
*/
|
|
2666
|
+
tagExceptions?: {
|
|
2667
|
+
/**
|
|
2668
|
+
* This interface was referenced by `undefined`'s JSON-Schema definition
|
|
2669
|
+
* via the `patternProperty` ".*".
|
|
2670
|
+
*/
|
|
2671
|
+
[k: string]: number;
|
|
2672
|
+
};
|
|
2663
2673
|
/**
|
|
2664
2674
|
* An array of tag group objects indicating the preferred sequence for sorting tags.
|
|
2665
2675
|
*
|
package/package.json
CHANGED
package/src/rules/sortTags.js
CHANGED
|
@@ -5,11 +5,13 @@ export default iterateJsdoc(({
|
|
|
5
5
|
context,
|
|
6
6
|
jsdoc,
|
|
7
7
|
utils,
|
|
8
|
+
// eslint-disable-next-line complexity -- Temporary
|
|
8
9
|
}) => {
|
|
9
10
|
const
|
|
10
11
|
/**
|
|
11
12
|
* @type {{
|
|
12
13
|
* linesBetween: import('../iterateJsdoc.js').Integer,
|
|
14
|
+
* tagExceptions: Record<string, number>,
|
|
13
15
|
* tagSequence: {
|
|
14
16
|
* tags: string[]
|
|
15
17
|
* }[],
|
|
@@ -22,6 +24,7 @@ export default iterateJsdoc(({
|
|
|
22
24
|
linesBetween = 1,
|
|
23
25
|
reportIntraTagGroupSpacing = true,
|
|
24
26
|
reportTagGroupSpacing = true,
|
|
27
|
+
tagExceptions = {},
|
|
25
28
|
tagSequence = defaultTagOrder,
|
|
26
29
|
} = context.options[0] || {};
|
|
27
30
|
|
|
@@ -328,7 +331,7 @@ export default iterateJsdoc(({
|
|
|
328
331
|
}
|
|
329
332
|
|
|
330
333
|
const ct = countTagEmptyLines(tag);
|
|
331
|
-
if (ct) {
|
|
334
|
+
if (ct && (!tagExceptions[tag.tag] || tagExceptions[tag.tag] < ct)) {
|
|
332
335
|
const fixer = () => {
|
|
333
336
|
let foundFirstTag = false;
|
|
334
337
|
|
|
@@ -548,6 +551,15 @@ will not have spacing applied regardless. For adding line breaks there, you
|
|
|
548
551
|
may wish to use the \`endLines\` option of the \`tag-lines\` rule.`,
|
|
549
552
|
type: 'boolean',
|
|
550
553
|
},
|
|
554
|
+
tagExceptions: {
|
|
555
|
+
description: 'Allows specification by tag of a specific higher maximum number of lines. Keys are tags and values are the maximum number of lines allowed for such tags. Overrides `linesBetween`. Defaults to no special exceptions per tag.',
|
|
556
|
+
patternProperties: {
|
|
557
|
+
'.*': {
|
|
558
|
+
type: 'number',
|
|
559
|
+
},
|
|
560
|
+
},
|
|
561
|
+
type: 'object',
|
|
562
|
+
},
|
|
551
563
|
tagSequence: {
|
|
552
564
|
description: `An array of tag group objects indicating the preferred sequence for sorting tags.
|
|
553
565
|
|
package/src/rules.d.ts
CHANGED
|
@@ -2660,6 +2660,16 @@ export interface Rules {
|
|
|
2660
2660
|
* may wish to use the `endLines` option of the `tag-lines` rule.
|
|
2661
2661
|
*/
|
|
2662
2662
|
reportTagGroupSpacing?: boolean;
|
|
2663
|
+
/**
|
|
2664
|
+
* Allows specification by tag of a specific higher maximum number of lines. Keys are tags and values are the maximum number of lines allowed for such tags. Overrides `linesBetween`. Defaults to no special exceptions per tag.
|
|
2665
|
+
*/
|
|
2666
|
+
tagExceptions?: {
|
|
2667
|
+
/**
|
|
2668
|
+
* This interface was referenced by `undefined`'s JSON-Schema definition
|
|
2669
|
+
* via the `patternProperty` ".*".
|
|
2670
|
+
*/
|
|
2671
|
+
[k: string]: number;
|
|
2672
|
+
};
|
|
2663
2673
|
/**
|
|
2664
2674
|
* An array of tag group objects indicating the preferred sequence for sorting tags.
|
|
2665
2675
|
*
|