eslint-plugin-jsdoc 60.4.1 → 60.6.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/README.md +4 -0
- package/dist/cjs/iterateJsdoc.d.ts +5 -0
- package/dist/cjs/jsdocUtils.d.ts +19 -2
- package/dist/cjs/rules/escapeInlineTags.d.ts +2 -0
- package/dist/generateDocs.cjs +5 -6
- package/dist/generateDocs.cjs.map +1 -1
- package/dist/index-cjs.cjs +14 -1
- package/dist/index-cjs.cjs.map +1 -1
- package/dist/index-esm.cjs +0 -2
- package/dist/index-esm.cjs.map +1 -1
- package/dist/index.cjs +14 -3
- package/dist/index.cjs.map +1 -1
- package/dist/iterateJsdoc.cjs +12 -0
- package/dist/iterateJsdoc.cjs.map +1 -1
- package/dist/iterateJsdoc.d.ts +5 -0
- package/dist/jsdocUtils.cjs +21 -17
- package/dist/jsdocUtils.cjs.map +1 -1
- package/dist/jsdocUtils.d.ts +19 -2
- package/dist/rules/checkLineAlignment.cjs +1 -2
- package/dist/rules/checkLineAlignment.cjs.map +1 -1
- package/dist/rules/checkTagNames.cjs +16 -0
- package/dist/rules/checkTagNames.cjs.map +1 -1
- package/dist/rules/convertToJsdocComments.cjs +2 -4
- package/dist/rules/convertToJsdocComments.cjs.map +1 -1
- package/dist/rules/emptyTags.cjs +1 -2
- package/dist/rules/emptyTags.cjs.map +1 -1
- package/dist/rules/escapeInlineTags.cjs +149 -0
- package/dist/rules/escapeInlineTags.cjs.map +1 -0
- package/dist/rules/escapeInlineTags.d.ts +3 -0
- package/dist/rules/informativeDocs.cjs +3 -6
- package/dist/rules/informativeDocs.cjs.map +1 -1
- package/dist/rules/linesBeforeBlock.cjs +4 -8
- package/dist/rules/linesBeforeBlock.cjs.map +1 -1
- package/dist/rules/matchDescription.cjs +2 -4
- package/dist/rules/matchDescription.cjs.map +1 -1
- package/dist/rules/matchName.cjs +1 -2
- package/dist/rules/matchName.cjs.map +1 -1
- package/dist/rules/multilineBlocks.cjs +3 -6
- package/dist/rules/multilineBlocks.cjs.map +1 -1
- package/dist/rules/noBadBlocks.cjs +1 -2
- package/dist/rules/noBadBlocks.cjs.map +1 -1
- package/dist/rules/noTypes.cjs +1 -2
- package/dist/rules/noTypes.cjs.map +1 -1
- package/dist/rules/noUndefinedTypes.cjs +1 -1
- package/dist/rules/noUndefinedTypes.cjs.map +1 -1
- package/dist/rules/requireAsteriskPrefix.cjs +1 -2
- package/dist/rules/requireAsteriskPrefix.cjs.map +1 -1
- package/dist/rules/requireDescriptionCompleteSentence.cjs +1 -2
- package/dist/rules/requireDescriptionCompleteSentence.cjs.map +1 -1
- package/dist/rules/requireFileOverview.cjs +1 -3
- package/dist/rules/requireFileOverview.cjs.map +1 -1
- package/dist/rules/requireHyphenBeforeParamDescription.cjs +1 -2
- package/dist/rules/requireHyphenBeforeParamDescription.cjs.map +1 -1
- package/dist/rules/requireJsdoc.cjs +3 -6
- package/dist/rules/requireJsdoc.cjs.map +1 -1
- package/dist/rules/requireParam.cjs +6 -12
- package/dist/rules/requireParam.cjs.map +1 -1
- package/dist/rules/requireParamName.cjs +1 -2
- package/dist/rules/requireParamName.cjs.map +1 -1
- package/dist/rules/requireReturns.cjs +1 -2
- package/dist/rules/requireReturns.cjs.map +1 -1
- package/dist/rules/requireTemplate.cjs +1 -2
- package/dist/rules/requireTemplate.cjs.map +1 -1
- package/dist/rules/sortTags.cjs +1 -2
- package/dist/rules/sortTags.cjs.map +1 -1
- package/dist/rules.d.ts +34 -37
- package/package.json +11 -11
- package/src/index-cjs.js +16 -0
- package/src/index-esm.js +0 -2
- package/src/index.js +16 -2
- package/src/iterateJsdoc.js +13 -0
- package/src/jsdocUtils.js +22 -17
- package/src/rules/checkLineAlignment.js +1 -2
- package/src/rules/checkTagNames.js +19 -0
- package/src/rules/convertToJsdocComments.js +2 -4
- package/src/rules/emptyTags.js +1 -2
- package/src/rules/escapeInlineTags.js +189 -0
- package/src/rules/informativeDocs.js +3 -6
- package/src/rules/linesBeforeBlock.js +4 -8
- package/src/rules/matchDescription.js +2 -4
- package/src/rules/matchName.js +1 -2
- package/src/rules/multilineBlocks.js +3 -6
- package/src/rules/noBadBlocks.js +1 -2
- package/src/rules/noTypes.js +1 -2
- package/src/rules/noUndefinedTypes.js +7 -1
- package/src/rules/requireAsteriskPrefix.js +1 -2
- package/src/rules/requireDescriptionCompleteSentence.js +1 -2
- package/src/rules/requireFileOverview.js +1 -3
- package/src/rules/requireHyphenBeforeParamDescription.js +1 -2
- package/src/rules/requireJsdoc.js +3 -6
- package/src/rules/requireParam.js +6 -12
- package/src/rules/requireParamName.js +1 -2
- package/src/rules/requireReturns.js +1 -2
- package/src/rules/requireTemplate.js +1 -2
- package/src/rules/sortTags.js +1 -2
- package/src/rules.d.ts +34 -37
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"requireReturns.cjs","names":["_exportParser","_interopRequireDefault","require","_iterateJsdoc","e","__esModule","default","canSkip","utils","hasATag","avoidDocs","_default","exports","iterateJsdoc","context","info","comment","node","report","settings","contexts","enableFixer","forceRequireReturn","forceReturnsWithAsync","publicOnly","options","forceRequireReturnContext","foundContext","findContext","tagName","getPreferredTagName","tags","getTags","length","iteratingFunction","isIteratingFunction","tag","missingReturnTag","shouldReport","opt","ancestorsOnly","Boolean","esm","initModuleExports","cjs","initWindow","window","sourceCode","getSourceCode","exported","exportParser","isUncommentedExport","isVirtualFunction","isAsync","hasTag","hasValueOrExecutorHasNonEmptyResolveValue","reportJSDoc","addTag","contextDefaults","meta","docs","description","url","fixable","schema","additionalProperties","properties","checkConstructors","type","checkGetters","items","anyOf","exemptedBy","oneOf","module"],"sources":["../../src/rules/requireReturns.js"],"sourcesContent":["import exportParser from '../exportParser.js';\nimport iterateJsdoc from '../iterateJsdoc.js';\n\n/**\n * We can skip checking for a return value, in case the documentation is inherited\n * or the method is either a constructor or an abstract method.\n *\n * In either of these cases the return value is optional or not defined.\n * @param {import('../iterateJsdoc.js').Utils} utils\n * a reference to the utils which are used to probe if a tag is present or not.\n * @returns {boolean}\n * true in case deep checking can be skipped; otherwise false.\n */\nconst canSkip = (utils) => {\n return utils.hasATag([\n // inheritdoc implies that all documentation is inherited\n // see https://jsdoc.app/tags-inheritdoc.html\n //\n // Abstract methods are by definition incomplete,\n // so it is not an error if it declares a return value but does not implement it.\n 'abstract',\n 'virtual',\n\n // Constructors do not have a return value by definition (https://jsdoc.app/tags-class.html)\n // So we can bail out here, too.\n 'class',\n 'constructor',\n\n // Return type is specified by type in @type\n 'type',\n\n // This seems to imply a class as well\n 'interface',\n ]) ||\n utils.avoidDocs();\n};\n\nexport default iterateJsdoc(({\n context,\n info: {\n comment,\n },\n node,\n report,\n settings,\n utils,\n}) => {\n const {\n contexts,\n enableFixer = false,\n forceRequireReturn = false,\n forceReturnsWithAsync = false,\n publicOnly = false,\n } = context.options[0] || {};\n\n // A preflight check. We do not need to run a deep check\n // in case the @returns comment is optional or undefined.\n if (canSkip(utils)) {\n return;\n }\n\n /** @type {boolean|undefined} */\n let forceRequireReturnContext;\n if (contexts) {\n const {\n foundContext,\n } = utils.findContext(contexts, comment);\n if (typeof foundContext === 'object') {\n forceRequireReturnContext = foundContext.forceRequireReturn;\n }\n }\n\n const tagName = /** @type {string} */ (utils.getPreferredTagName({\n tagName: 'returns',\n }));\n if (!tagName) {\n return;\n }\n\n const tags = utils.getTags(tagName);\n\n if (tags.length > 1) {\n report(`Found more than one @${tagName} declaration.`);\n }\n\n const iteratingFunction = utils.isIteratingFunction();\n\n // In case the code returns something, we expect a return value in JSDoc.\n const [\n tag,\n ] = tags;\n const missingReturnTag = typeof tag === 'undefined' || tag === null;\n\n const shouldReport = () => {\n if (!missingReturnTag) {\n return false;\n }\n\n if (publicOnly) {\n /** @type {import('./requireJsdoc.js').RequireJsdocOpts} */\n const opt = {\n ancestorsOnly: Boolean(publicOnly?.ancestorsOnly ?? false),\n esm: Boolean(publicOnly?.esm ?? true),\n initModuleExports: Boolean(publicOnly?.cjs ?? true),\n initWindow: Boolean(publicOnly?.window ?? false),\n };\n /* c8 ignore next -- Fallback to deprecated method */\n const {\n sourceCode = context.getSourceCode(),\n } = context;\n const exported = exportParser.isUncommentedExport(\n /** @type {import('eslint').Rule.Node} */ (node), sourceCode, opt, settings,\n );\n\n if (!exported) {\n return false;\n }\n }\n\n if ((forceRequireReturn || forceRequireReturnContext) && (\n iteratingFunction || utils.isVirtualFunction()\n )) {\n return true;\n }\n\n const isAsync = !iteratingFunction && utils.hasTag('async') ||\n iteratingFunction && utils.isAsync();\n\n if (forceReturnsWithAsync && isAsync) {\n return true;\n }\n\n return iteratingFunction && utils.hasValueOrExecutorHasNonEmptyResolveValue(\n forceReturnsWithAsync,\n );\n };\n\n if (shouldReport()) {\n utils.reportJSDoc(`Missing JSDoc @${tagName} declaration.`, null, enableFixer ? () => {\n utils.addTag(tagName);\n } : null);\n }\n}, {\n contextDefaults: true,\n meta: {\n docs: {\n description: 'Requires that returns are documented with `@returns`.',\n url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/require-returns.md#repos-sticky-header',\n },\n fixable: 'code',\n schema: [\n {\n additionalProperties: false,\n properties: {\n checkConstructors: {\n default: false,\n description: `A value indicating whether \\`constructor\\`s should\nbe checked for \\`@returns\\` tags. Defaults to \\`false\\`.`,\n type: 'boolean',\n },\n checkGetters: {\n default: true,\n description: `Boolean to determine whether getter methods should\nbe checked for \\`@returns\\` tags. Defaults to \\`true\\`.`,\n type: 'boolean',\n },\n contexts: {\n description: `Set this to an array of strings representing the AST context\n(or objects with optional \\`context\\` and \\`comment\\` properties) where you wish\nthe rule to be applied.\n\n\\`context\\` defaults to \\`any\\` and \\`comment\\` defaults to no specific comment context.\n\nOverrides the default contexts (\\`ArrowFunctionExpression\\`, \\`FunctionDeclaration\\`,\n\\`FunctionExpression\\`). Set to \\`\"any\"\\` if you want\nthe rule to apply to any JSDoc block throughout your files (as is necessary\nfor finding function blocks not attached to a function declaration or\nexpression, i.e., \\`@callback\\` or \\`@function\\` (or its aliases \\`@func\\` or\n\\`@method\\`) (including those associated with an \\`@interface\\`). This\nrule will only apply on non-default contexts when there is such a tag\npresent and the \\`forceRequireReturn\\` option is set or if the\n\\`forceReturnsWithAsync\\` option is set with a present \\`@async\\` tag\n(since we are not checking against the actual \\`return\\` values in these\ncases).`,\n items: {\n anyOf: [\n {\n type: 'string',\n },\n {\n additionalProperties: false,\n properties: {\n comment: {\n type: 'string',\n },\n context: {\n type: 'string',\n },\n forceRequireReturn: {\n type: 'boolean',\n },\n },\n type: 'object',\n },\n ],\n },\n type: 'array',\n },\n enableFixer: {\n description: `Whether to enable the fixer to add a blank \\`@returns\\`.\nDefaults to \\`false\\`.`,\n type: 'boolean',\n },\n exemptedBy: {\n description: `Array of tags (e.g., \\`['type']\\`) whose presence on the\ndocument block avoids the need for a \\`@returns\\`. Defaults to an array\nwith \\`inheritdoc\\`. If you set this array, it will overwrite the default,\nso be sure to add back \\`inheritdoc\\` if you wish its presence to cause\nexemption of the rule.`,\n items: {\n type: 'string',\n },\n type: 'array',\n },\n forceRequireReturn: {\n default: false,\n description: `Set to \\`true\\` to always insist on\n\\`@returns\\` documentation regardless of implicit or explicit \\`return\\`'s\nin the function. May be desired to flag that a project is aware of an\n\\`undefined\\`/\\`void\\` return. Defaults to \\`false\\`.`,\n type: 'boolean',\n },\n forceReturnsWithAsync: {\n default: false,\n description: `By default \\`async\\` functions that do not explicitly\nreturn a value pass this rule as an \\`async\\` function will always return a\n\\`Promise\\`, even if the \\`Promise\\` resolves to void. You can force all\n\\`async\\` functions (including ones with an explicit \\`Promise\\` but no\ndetected non-\\`undefined\\` \\`resolve\\` value) to require \\`@return\\`\ndocumentation by setting \\`forceReturnsWithAsync\\` to \\`true\\` on the options\nobject. This may be useful for flagging that there has been consideration\nof return type. Defaults to \\`false\\`.`,\n type: 'boolean',\n },\n publicOnly: {\n description: `This option will insist that missing \\`@returns\\` are only reported for\nfunction bodies / class declarations that are exported from the module.\nMay be a boolean or object. If set to \\`true\\`, the defaults below will be\nused. If unset, \\`@returns\\` reporting will not be limited to exports.\n\nThis object supports the following optional boolean keys (\\`false\\` unless\notherwise noted):\n\n- \\`ancestorsOnly\\` - Optimization to only check node ancestors to check if node is exported\n- \\`esm\\` - ESM exports are checked for \\`@returns\\` JSDoc comments (Defaults to \\`true\\`)\n- \\`cjs\\` - CommonJS exports are checked for \\`@returns\\` JSDoc comments (Defaults to \\`true\\`)\n- \\`window\\` - Window global exports are checked for \\`@returns\\` JSDoc comments\n`,\n oneOf: [\n {\n default: false,\n type: 'boolean',\n },\n {\n additionalProperties: false,\n default: {},\n properties: {\n ancestorsOnly: {\n type: 'boolean',\n },\n cjs: {\n type: 'boolean',\n },\n esm: {\n type: 'boolean',\n },\n window: {\n type: 'boolean',\n },\n },\n type: 'object',\n },\n ],\n },\n },\n type: 'object',\n },\n ],\n type: 'suggestion',\n },\n});\n"],"mappings":";;;;;;AAAA,IAAAA,aAAA,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;AAE9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMG,OAAO,GAAIC,KAAK,IAAK;EACzB,OAAOA,KAAK,CAACC,OAAO,CAAC;EACnB;EACA;EACA;EACA;EACA;EACA,UAAU,EACV,SAAS;EAET;EACA;EACA,OAAO,EACP,aAAa;EAEb;EACA,MAAM;EAEN;EACA,WAAW,CACZ,CAAC,IACAD,KAAK,CAACE,SAAS,CAAC,CAAC;AACrB,CAAC;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAN,OAAA,GAEa,IAAAO,qBAAY,EAAC,CAAC;EAC3BC,OAAO;EACPC,IAAI,EAAE;IACJC;EACF,CAAC;EACDC,IAAI;EACJC,MAAM;EACNC,QAAQ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UACrBjB,OAAO,EAAE,KAAK;UACduD,WAAW,EAAE;AACzB;AACA;AACA;AACA;AACA;AACA;AACA,uCAAuC;UAC3BO,IAAI,EAAE;QACR,CAAC;QACD5C,UAAU,EAAE;UACVqC,WAAW,EAAE;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;UACWY,KAAK,EAAE,CACL;YACEnE,OAAO,EAAE,KAAK;YACd8D,IAAI,EAAE;UACR,CAAC,EACD;YACEH,oBAAoB,EAAE,KAAK;YAC3B3D,OAAO,EAAE,CAAC,CAAC;YACX4D,UAAU,EAAE;cACV1B,aAAa,EAAE;gBACb4B,IAAI,EAAE;cACR,CAAC;cACDxB,GAAG,EAAE;gBACHwB,IAAI,EAAE;cACR,CAAC;cACD1B,GAAG,EAAE;gBACH0B,IAAI,EAAE;cACR,CAAC;cACDtB,MAAM,EAAE;gBACNsB,IAAI,EAAE;cACR;YACF,CAAC;YACDA,IAAI,EAAE;UACR,CAAC;QAEL;MACF,CAAC;MACDA,IAAI,EAAE;IACR,CAAC,CACF;IACDA,IAAI,EAAE;EACR;AACF,CAAC,CAAC;AAAAM,MAAA,CAAA9D,OAAA,GAAAA,OAAA,CAAAN,OAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"requireReturns.cjs","names":["_exportParser","_interopRequireDefault","require","_iterateJsdoc","e","__esModule","default","canSkip","utils","hasATag","avoidDocs","_default","exports","iterateJsdoc","context","info","comment","node","report","settings","contexts","enableFixer","forceRequireReturn","forceReturnsWithAsync","publicOnly","options","forceRequireReturnContext","foundContext","findContext","tagName","getPreferredTagName","tags","getTags","length","iteratingFunction","isIteratingFunction","tag","missingReturnTag","shouldReport","opt","ancestorsOnly","Boolean","esm","initModuleExports","cjs","initWindow","window","sourceCode","getSourceCode","exported","exportParser","isUncommentedExport","isVirtualFunction","isAsync","hasTag","hasValueOrExecutorHasNonEmptyResolveValue","reportJSDoc","addTag","contextDefaults","meta","docs","description","url","fixable","schema","additionalProperties","properties","checkConstructors","type","checkGetters","items","anyOf","exemptedBy","oneOf","module"],"sources":["../../src/rules/requireReturns.js"],"sourcesContent":["import exportParser from '../exportParser.js';\nimport iterateJsdoc from '../iterateJsdoc.js';\n\n/**\n * We can skip checking for a return value, in case the documentation is inherited\n * or the method is either a constructor or an abstract method.\n *\n * In either of these cases the return value is optional or not defined.\n * @param {import('../iterateJsdoc.js').Utils} utils\n * a reference to the utils which are used to probe if a tag is present or not.\n * @returns {boolean}\n * true in case deep checking can be skipped; otherwise false.\n */\nconst canSkip = (utils) => {\n return utils.hasATag([\n // inheritdoc implies that all documentation is inherited\n // see https://jsdoc.app/tags-inheritdoc.html\n //\n // Abstract methods are by definition incomplete,\n // so it is not an error if it declares a return value but does not implement it.\n 'abstract',\n 'virtual',\n\n // Constructors do not have a return value by definition (https://jsdoc.app/tags-class.html)\n // So we can bail out here, too.\n 'class',\n 'constructor',\n\n // Return type is specified by type in @type\n 'type',\n\n // This seems to imply a class as well\n 'interface',\n ]) ||\n utils.avoidDocs();\n};\n\nexport default iterateJsdoc(({\n context,\n info: {\n comment,\n },\n node,\n report,\n settings,\n utils,\n}) => {\n const {\n contexts,\n enableFixer = false,\n forceRequireReturn = false,\n forceReturnsWithAsync = false,\n publicOnly = false,\n } = context.options[0] || {};\n\n // A preflight check. We do not need to run a deep check\n // in case the @returns comment is optional or undefined.\n if (canSkip(utils)) {\n return;\n }\n\n /** @type {boolean|undefined} */\n let forceRequireReturnContext;\n if (contexts) {\n const {\n foundContext,\n } = utils.findContext(contexts, comment);\n if (typeof foundContext === 'object') {\n forceRequireReturnContext = foundContext.forceRequireReturn;\n }\n }\n\n const tagName = /** @type {string} */ (utils.getPreferredTagName({\n tagName: 'returns',\n }));\n if (!tagName) {\n return;\n }\n\n const tags = utils.getTags(tagName);\n\n if (tags.length > 1) {\n report(`Found more than one @${tagName} declaration.`);\n }\n\n const iteratingFunction = utils.isIteratingFunction();\n\n // In case the code returns something, we expect a return value in JSDoc.\n const [\n tag,\n ] = tags;\n const missingReturnTag = typeof tag === 'undefined' || tag === null;\n\n const shouldReport = () => {\n if (!missingReturnTag) {\n return false;\n }\n\n if (publicOnly) {\n /** @type {import('./requireJsdoc.js').RequireJsdocOpts} */\n const opt = {\n ancestorsOnly: Boolean(publicOnly?.ancestorsOnly ?? false),\n esm: Boolean(publicOnly?.esm ?? true),\n initModuleExports: Boolean(publicOnly?.cjs ?? true),\n initWindow: Boolean(publicOnly?.window ?? false),\n };\n /* c8 ignore next -- Fallback to deprecated method */\n const {\n sourceCode = context.getSourceCode(),\n } = context;\n const exported = exportParser.isUncommentedExport(\n /** @type {import('eslint').Rule.Node} */ (node), sourceCode, opt, settings,\n );\n\n if (!exported) {\n return false;\n }\n }\n\n if ((forceRequireReturn || forceRequireReturnContext) && (\n iteratingFunction || utils.isVirtualFunction()\n )) {\n return true;\n }\n\n const isAsync = !iteratingFunction && utils.hasTag('async') ||\n iteratingFunction && utils.isAsync();\n\n if (forceReturnsWithAsync && isAsync) {\n return true;\n }\n\n return iteratingFunction && utils.hasValueOrExecutorHasNonEmptyResolveValue(\n forceReturnsWithAsync,\n );\n };\n\n if (shouldReport()) {\n utils.reportJSDoc(`Missing JSDoc @${tagName} declaration.`, null, enableFixer ? () => {\n utils.addTag(tagName);\n } : null);\n }\n}, {\n contextDefaults: true,\n meta: {\n docs: {\n description: 'Requires that returns are documented with `@returns`.',\n url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/require-returns.md#repos-sticky-header',\n },\n fixable: 'code',\n schema: [\n {\n additionalProperties: false,\n properties: {\n checkConstructors: {\n default: false,\n description: `A value indicating whether \\`constructor\\`s should\nbe checked for \\`@returns\\` tags. Defaults to \\`false\\`.`,\n type: 'boolean',\n },\n checkGetters: {\n default: true,\n description: `Boolean to determine whether getter methods should\nbe checked for \\`@returns\\` tags. Defaults to \\`true\\`.`,\n type: 'boolean',\n },\n contexts: {\n description: `Set this to an array of strings representing the AST context\n(or objects with optional \\`context\\` and \\`comment\\` properties) where you wish\nthe rule to be applied.\n\n\\`context\\` defaults to \\`any\\` and \\`comment\\` defaults to no specific comment context.\n\nOverrides the default contexts (\\`ArrowFunctionExpression\\`, \\`FunctionDeclaration\\`,\n\\`FunctionExpression\\`). Set to \\`\"any\"\\` if you want\nthe rule to apply to any JSDoc block throughout your files (as is necessary\nfor finding function blocks not attached to a function declaration or\nexpression, i.e., \\`@callback\\` or \\`@function\\` (or its aliases \\`@func\\` or\n\\`@method\\`) (including those associated with an \\`@interface\\`). This\nrule will only apply on non-default contexts when there is such a tag\npresent and the \\`forceRequireReturn\\` option is set or if the\n\\`forceReturnsWithAsync\\` option is set with a present \\`@async\\` tag\n(since we are not checking against the actual \\`return\\` values in these\ncases).`,\n items: {\n anyOf: [\n {\n type: 'string',\n },\n {\n additionalProperties: false,\n properties: {\n comment: {\n type: 'string',\n },\n context: {\n type: 'string',\n },\n forceRequireReturn: {\n type: 'boolean',\n },\n },\n type: 'object',\n },\n ],\n },\n type: 'array',\n },\n enableFixer: {\n description: `Whether to enable the fixer to add a blank \\`@returns\\`.\nDefaults to \\`false\\`.`,\n type: 'boolean',\n },\n exemptedBy: {\n description: `Array of tags (e.g., \\`['type']\\`) whose presence on the\ndocument block avoids the need for a \\`@returns\\`. Defaults to an array\nwith \\`inheritdoc\\`. If you set this array, it will overwrite the default,\nso be sure to add back \\`inheritdoc\\` if you wish its presence to cause\nexemption of the rule.`,\n items: {\n type: 'string',\n },\n type: 'array',\n },\n forceRequireReturn: {\n default: false,\n description: `Set to \\`true\\` to always insist on\n\\`@returns\\` documentation regardless of implicit or explicit \\`return\\`'s\nin the function. May be desired to flag that a project is aware of an\n\\`undefined\\`/\\`void\\` return. Defaults to \\`false\\`.`,\n type: 'boolean',\n },\n forceReturnsWithAsync: {\n default: false,\n description: `By default \\`async\\` functions that do not explicitly\nreturn a value pass this rule as an \\`async\\` function will always return a\n\\`Promise\\`, even if the \\`Promise\\` resolves to void. You can force all\n\\`async\\` functions (including ones with an explicit \\`Promise\\` but no\ndetected non-\\`undefined\\` \\`resolve\\` value) to require \\`@return\\`\ndocumentation by setting \\`forceReturnsWithAsync\\` to \\`true\\` on the options\nobject. This may be useful for flagging that there has been consideration\nof return type. Defaults to \\`false\\`.`,\n type: 'boolean',\n },\n publicOnly: {\n description: `This option will insist that missing \\`@returns\\` are only reported for\nfunction bodies / class declarations that are exported from the module.\nMay be a boolean or object. If set to \\`true\\`, the defaults below will be\nused. If unset, \\`@returns\\` reporting will not be limited to exports.\n\nThis object supports the following optional boolean keys (\\`false\\` unless\notherwise noted):\n\n- \\`ancestorsOnly\\` - Optimization to only check node ancestors to check if node is exported\n- \\`esm\\` - ESM exports are checked for \\`@returns\\` JSDoc comments (Defaults to \\`true\\`)\n- \\`cjs\\` - CommonJS exports are checked for \\`@returns\\` JSDoc comments (Defaults to \\`true\\`)\n- \\`window\\` - Window global exports are checked for \\`@returns\\` JSDoc comments`,\n oneOf: [\n {\n default: false,\n type: 'boolean',\n },\n {\n additionalProperties: false,\n default: {},\n properties: {\n ancestorsOnly: {\n type: 'boolean',\n },\n cjs: {\n type: 'boolean',\n },\n esm: {\n type: 'boolean',\n },\n window: {\n type: 'boolean',\n },\n },\n type: 'object',\n },\n ],\n },\n },\n type: 'object',\n },\n ],\n type: 'suggestion',\n },\n});\n"],"mappings":";;;;;;AAAA,IAAAA,aAAA,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;AAE9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMG,OAAO,GAAIC,KAAK,IAAK;EACzB,OAAOA,KAAK,CAACC,OAAO,CAAC;EACnB;EACA;EACA;EACA;EACA;EACA,UAAU,EACV,SAAS;EAET;EACA;EACA,OAAO,EACP,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X,WAAW,EAAE;AACzB;AACA;AACA;AACA,uBAAuB;UACXS,KAAK,EAAE;YACLF,IAAI,EAAE;UACR,CAAC;UACDA,IAAI,EAAE;QACR,CAAC;QACD9C,kBAAkB,EAAE;UAClBhB,OAAO,EAAE,KAAK;UACduD,WAAW,EAAE;AACzB;AACA;AACA,sDAAsD;UAC1CO,IAAI,EAAE;QACR,CAAC;QACD7C,qBAAqB,EAAE;UACrBjB,OAAO,EAAE,KAAK;UACduD,WAAW,EAAE;AACzB;AACA;AACA;AACA;AACA;AACA;AACA,uCAAuC;UAC3BO,IAAI,EAAE;QACR,CAAC;QACD5C,UAAU,EAAE;UACVqC,WAAW,EAAE;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iFAAiF;UACrEY,KAAK,EAAE,CACL;YACEnE,OAAO,EAAE,KAAK;YACd8D,IAAI,EAAE;UACR,CAAC,EACD;YACEH,oBAAoB,EAAE,KAAK;YAC3B3D,OAAO,EAAE,CAAC,CAAC;YACX4D,UAAU,EAAE;cACV1B,aAAa,EAAE;gBACb4B,IAAI,EAAE;cACR,CAAC;cACDxB,GAAG,EAAE;gBACHwB,IAAI,EAAE;cACR,CAAC;cACD1B,GAAG,EAAE;gBACH0B,IAAI,EAAE;cACR,CAAC;cACDtB,MAAM,EAAE;gBACNsB,IAAI,EAAE;cACR;YACF,CAAC;YACDA,IAAI,EAAE;UACR,CAAC;QAEL;MACF,CAAC;MACDA,IAAI,EAAE;IACR,CAAC,CACF;IACDA,IAAI,EAAE;EACR;AACF,CAAC,CAAC;AAAAM,MAAA,CAAA9D,OAAA,GAAAA,OAAA,CAAAN,OAAA","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"requireTemplate.cjs","names":["_iterateJsdoc","_interopRequireDefault","require","_jsdoccomment","e","__esModule","default","_default","exports","iterateJsdoc","context","node","report","settings","utils","avoidDocs","requireSeparateTemplates","options","mode","usedNames","Set","templateTags","getTags","templateNames","flatMap","tag","parseClosureTemplateTag","names","length","checkTypeParams","aliasDeclaration","params","typeParameters","name","add","usedName","includes","handleTypes","nde","type","declaration","usedNameToTag","Map","checkForUsedTypes","potentialTag","parsedType","tryParseType","parseType","traverse","value","test","has","set","checkTagsAndTemplates","tagNames","tagName","preferredTagName","getPreferredTagName","matchingTags","matchingTag","get","callbackTags","functionTags","typedefTags","potentialTypedef","iterateAllJsdocs","meta","docs","description","url","schema","additionalProperties","properties","exemptedBy","items","module"],"sources":["../../src/rules/requireTemplate.js"],"sourcesContent":["import iterateJsdoc from '../iterateJsdoc.js';\nimport {\n parse as parseType,\n traverse,\n tryParse as tryParseType,\n} from '@es-joy/jsdoccomment';\n\nexport default iterateJsdoc(({\n context,\n node,\n report,\n settings,\n utils,\n}) => {\n if (utils.avoidDocs()) {\n return;\n }\n\n const {\n requireSeparateTemplates = false,\n } = context.options[0] || {};\n\n const {\n mode,\n } = settings;\n\n const usedNames = new Set();\n const templateTags = utils.getTags('template');\n const templateNames = templateTags.flatMap((tag) => {\n return utils.parseClosureTemplateTag(tag);\n });\n\n if (requireSeparateTemplates) {\n for (const tag of templateTags) {\n const names = utils.parseClosureTemplateTag(tag);\n if (names.length > 1) {\n report(`Missing separate @template for ${names[1]}`, null, tag);\n }\n }\n }\n\n /**\n * @param {import('@typescript-eslint/types').TSESTree.FunctionDeclaration|\n * import('@typescript-eslint/types').TSESTree.ClassDeclaration|\n * import('@typescript-eslint/types').TSESTree.TSDeclareFunction|\n * import('@typescript-eslint/types').TSESTree.TSInterfaceDeclaration|\n * import('@typescript-eslint/types').TSESTree.TSTypeAliasDeclaration} aliasDeclaration\n */\n const checkTypeParams = (aliasDeclaration) => {\n const {\n params,\n /* c8 ignore next -- Guard */\n } = aliasDeclaration.typeParameters ?? {\n /* c8 ignore next -- Guard */\n params: [],\n };\n for (const {\n name: {\n name,\n },\n } of params) {\n usedNames.add(name);\n }\n\n for (const usedName of usedNames) {\n if (!templateNames.includes(usedName)) {\n report(`Missing @template ${usedName}`);\n }\n }\n };\n\n const handleTypes = () => {\n const nde = /** @type {import('@typescript-eslint/types').TSESTree.Node} */ (\n node\n );\n if (!nde) {\n return;\n }\n\n switch (nde.type) {\n case 'ClassDeclaration':\n case 'FunctionDeclaration':\n case 'TSDeclareFunction':\n case 'TSInterfaceDeclaration':\n case 'TSTypeAliasDeclaration':\n checkTypeParams(nde);\n break;\n case 'ExportDefaultDeclaration':\n switch (nde.declaration?.type) {\n case 'ClassDeclaration':\n case 'FunctionDeclaration':\n case 'TSInterfaceDeclaration':\n checkTypeParams(nde.declaration);\n break;\n }\n\n break;\n case 'ExportNamedDeclaration':\n switch (nde.declaration?.type) {\n case 'ClassDeclaration':\n case 'FunctionDeclaration':\n case 'TSDeclareFunction':\n case 'TSInterfaceDeclaration':\n case 'TSTypeAliasDeclaration':\n checkTypeParams(nde.declaration);\n break;\n }\n\n break;\n }\n };\n\n const usedNameToTag = new Map();\n\n /**\n * @param {import('comment-parser').Spec} potentialTag\n */\n const checkForUsedTypes = (potentialTag) => {\n let parsedType;\n try {\n parsedType = mode === 'permissive' ?\n tryParseType(/** @type {string} */ (potentialTag.type)) :\n parseType(/** @type {string} */ (potentialTag.type), mode);\n } catch {\n return;\n }\n\n traverse(parsedType, (nde) => {\n const {\n type,\n value,\n } = /** @type {import('jsdoc-type-pratt-parser').NameResult} */ (nde);\n if (type === 'JsdocTypeName' && (/^[A-Z]$/v).test(value)) {\n usedNames.add(value);\n if (!usedNameToTag.has(value)) {\n usedNameToTag.set(value, potentialTag);\n }\n }\n });\n };\n\n /**\n * @param {string[]} tagNames\n */\n const checkTagsAndTemplates = (tagNames) => {\n for (const tagName of tagNames) {\n const preferredTagName = /** @type {string} */ (utils.getPreferredTagName({\n tagName,\n }));\n const matchingTags = utils.getTags(preferredTagName);\n for (const matchingTag of matchingTags) {\n checkForUsedTypes(matchingTag);\n }\n }\n\n // Could check against whitelist/blacklist\n for (const usedName of usedNames) {\n if (!templateNames.includes(usedName)) {\n report(`Missing @template ${usedName}`, null, usedNameToTag.get(usedName));\n }\n }\n };\n\n const callbackTags = utils.getTags('callback');\n const functionTags = utils.getTags('function');\n if (callbackTags.length || functionTags.length) {\n checkTagsAndTemplates([\n 'param', 'returns',\n ]);\n return;\n }\n\n const typedefTags = utils.getTags('typedef');\n if (!typedefTags.length || typedefTags.length >= 2) {\n handleTypes();\n return;\n }\n\n const potentialTypedef = typedefTags[0];\n checkForUsedTypes(potentialTypedef);\n\n checkTagsAndTemplates([\n 'property',\n ]);\n}, {\n iterateAllJsdocs: true,\n meta: {\n docs: {\n description: 'Requires `@template` tags be present when type parameters are used.',\n url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/require-template.md#repos-sticky-header',\n },\n schema: [\n {\n additionalProperties: false,\n properties: {\n exemptedBy: {\n description: `Array of tags (e.g., \\`['type']\\`) whose presence on the document\nblock avoids the need for a \\`@template\\`. Defaults to an array with\n\\`inheritdoc\\`. If you set this array, it will overwrite the default,\nso be sure to add back \\`inheritdoc\\` if you wish its presence to cause\nexemption of the rule.`,\n items: {\n type: 'string',\n },\n type: 'array',\n },\n requireSeparateTemplates: {\n description: `Requires that each template have its own separate line, i.e., preventing\ntemplates of this format:\n\n\\`\\`\\`js\n/**\n * @template T, U, V\n */\n\\`\\`\\`\n\nDefaults to \\`false\\`.\n`,\n type: 'boolean',\n },\n },\n type: 'object',\n },\n ],\n type: 'suggestion',\n },\n});\n"],"mappings":";;;;;;AAAA,IAAAA,aAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,aAAA,GAAAD,OAAA;AAI8B,SAAAD,uBAAAG,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,IAAAG,QAAA,GAAAC,OAAA,CAAAF,OAAA,GAEf,IAAAG,qBAAY,EAAC,CAAC;EAC3BC,OAAO;EACPC,IAAI;EACJC,MAAM;EACNC,QAAQ;EACRC;AAC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W,CAACnC,MAAM,IAAImC,WAAW,CAACnC,MAAM,IAAI,CAAC,EAAE;IAClDS,WAAW,CAAC,CAAC;IACb;EACF;EAEA,MAAM2B,gBAAgB,GAAGD,WAAW,CAAC,CAAC,CAAC;EACvCpB,iBAAiB,CAACqB,gBAAgB,CAAC;EAEnCX,qBAAqB,CAAC,CACpB,UAAU,CACX,CAAC;AACJ,CAAC,EAAE;EACDY,gBAAgB,EAAE,IAAI;EACtBC,IAAI,EAAE;IACJC,IAAI,EAAE;MACJC,WAAW,EAAE,qEAAqE;MAClFC,GAAG,EAAE;IACP,CAAC;IACDC,MAAM,EAAE,CACN;MACEC,oBAAoB,EAAE,KAAK;MAC3BC,UAAU,EAAE;QACVC,UAAU,EAAE;UACVL,WAAW,EAAE;AACzB;AACA;AACA;AACA,uBAAuB;UACXM,KAAK,EAAE;YACLnC,IAAI,EAAE;UACR,CAAC;UACDA,IAAI,EAAE;QACR,CAAC;QACDvB,wBAAwB,EAAE;UACxBoD,WAAW,EAAE;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;UACW7B,IAAI,EAAE;QACR;MACF,CAAC;MACDA,IAAI,EAAE;IACR,CAAC,CACF;IACDA,IAAI,EAAE;EACR;AACF,CAAC,CAAC;AAAAoC,MAAA,CAAAnE,OAAA,GAAAA,OAAA,CAAAF,OAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"requireTemplate.cjs","names":["_iterateJsdoc","_interopRequireDefault","require","_jsdoccomment","e","__esModule","default","_default","exports","iterateJsdoc","context","node","report","settings","utils","avoidDocs","requireSeparateTemplates","options","mode","usedNames","Set","templateTags","getTags","templateNames","flatMap","tag","parseClosureTemplateTag","names","length","checkTypeParams","aliasDeclaration","params","typeParameters","name","add","usedName","includes","handleTypes","nde","type","declaration","usedNameToTag","Map","checkForUsedTypes","potentialTag","parsedType","tryParseType","parseType","traverse","value","test","has","set","checkTagsAndTemplates","tagNames","tagName","preferredTagName","getPreferredTagName","matchingTags","matchingTag","get","callbackTags","functionTags","typedefTags","potentialTypedef","iterateAllJsdocs","meta","docs","description","url","schema","additionalProperties","properties","exemptedBy","items","module"],"sources":["../../src/rules/requireTemplate.js"],"sourcesContent":["import iterateJsdoc from '../iterateJsdoc.js';\nimport {\n parse as parseType,\n traverse,\n tryParse as tryParseType,\n} from '@es-joy/jsdoccomment';\n\nexport default iterateJsdoc(({\n context,\n node,\n report,\n settings,\n utils,\n}) => {\n if (utils.avoidDocs()) {\n return;\n }\n\n const {\n requireSeparateTemplates = false,\n } = context.options[0] || {};\n\n const {\n mode,\n } = settings;\n\n const usedNames = new Set();\n const templateTags = utils.getTags('template');\n const templateNames = templateTags.flatMap((tag) => {\n return utils.parseClosureTemplateTag(tag);\n });\n\n if (requireSeparateTemplates) {\n for (const tag of templateTags) {\n const names = utils.parseClosureTemplateTag(tag);\n if (names.length > 1) {\n report(`Missing separate @template for ${names[1]}`, null, tag);\n }\n }\n }\n\n /**\n * @param {import('@typescript-eslint/types').TSESTree.FunctionDeclaration|\n * import('@typescript-eslint/types').TSESTree.ClassDeclaration|\n * import('@typescript-eslint/types').TSESTree.TSDeclareFunction|\n * import('@typescript-eslint/types').TSESTree.TSInterfaceDeclaration|\n * import('@typescript-eslint/types').TSESTree.TSTypeAliasDeclaration} aliasDeclaration\n */\n const checkTypeParams = (aliasDeclaration) => {\n const {\n params,\n /* c8 ignore next -- Guard */\n } = aliasDeclaration.typeParameters ?? {\n /* c8 ignore next -- Guard */\n params: [],\n };\n for (const {\n name: {\n name,\n },\n } of params) {\n usedNames.add(name);\n }\n\n for (const usedName of usedNames) {\n if (!templateNames.includes(usedName)) {\n report(`Missing @template ${usedName}`);\n }\n }\n };\n\n const handleTypes = () => {\n const nde = /** @type {import('@typescript-eslint/types').TSESTree.Node} */ (\n node\n );\n if (!nde) {\n return;\n }\n\n switch (nde.type) {\n case 'ClassDeclaration':\n case 'FunctionDeclaration':\n case 'TSDeclareFunction':\n case 'TSInterfaceDeclaration':\n case 'TSTypeAliasDeclaration':\n checkTypeParams(nde);\n break;\n case 'ExportDefaultDeclaration':\n switch (nde.declaration?.type) {\n case 'ClassDeclaration':\n case 'FunctionDeclaration':\n case 'TSInterfaceDeclaration':\n checkTypeParams(nde.declaration);\n break;\n }\n\n break;\n case 'ExportNamedDeclaration':\n switch (nde.declaration?.type) {\n case 'ClassDeclaration':\n case 'FunctionDeclaration':\n case 'TSDeclareFunction':\n case 'TSInterfaceDeclaration':\n case 'TSTypeAliasDeclaration':\n checkTypeParams(nde.declaration);\n break;\n }\n\n break;\n }\n };\n\n const usedNameToTag = new Map();\n\n /**\n * @param {import('comment-parser').Spec} potentialTag\n */\n const checkForUsedTypes = (potentialTag) => {\n let parsedType;\n try {\n parsedType = mode === 'permissive' ?\n tryParseType(/** @type {string} */ (potentialTag.type)) :\n parseType(/** @type {string} */ (potentialTag.type), mode);\n } catch {\n return;\n }\n\n traverse(parsedType, (nde) => {\n const {\n type,\n value,\n } = /** @type {import('jsdoc-type-pratt-parser').NameResult} */ (nde);\n if (type === 'JsdocTypeName' && (/^[A-Z]$/v).test(value)) {\n usedNames.add(value);\n if (!usedNameToTag.has(value)) {\n usedNameToTag.set(value, potentialTag);\n }\n }\n });\n };\n\n /**\n * @param {string[]} tagNames\n */\n const checkTagsAndTemplates = (tagNames) => {\n for (const tagName of tagNames) {\n const preferredTagName = /** @type {string} */ (utils.getPreferredTagName({\n tagName,\n }));\n const matchingTags = utils.getTags(preferredTagName);\n for (const matchingTag of matchingTags) {\n checkForUsedTypes(matchingTag);\n }\n }\n\n // Could check against whitelist/blacklist\n for (const usedName of usedNames) {\n if (!templateNames.includes(usedName)) {\n report(`Missing @template ${usedName}`, null, usedNameToTag.get(usedName));\n }\n }\n };\n\n const callbackTags = utils.getTags('callback');\n const functionTags = utils.getTags('function');\n if (callbackTags.length || functionTags.length) {\n checkTagsAndTemplates([\n 'param', 'returns',\n ]);\n return;\n }\n\n const typedefTags = utils.getTags('typedef');\n if (!typedefTags.length || typedefTags.length >= 2) {\n handleTypes();\n return;\n }\n\n const potentialTypedef = typedefTags[0];\n checkForUsedTypes(potentialTypedef);\n\n checkTagsAndTemplates([\n 'property',\n ]);\n}, {\n iterateAllJsdocs: true,\n meta: {\n docs: {\n description: 'Requires `@template` tags be present when type parameters are used.',\n url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/require-template.md#repos-sticky-header',\n },\n schema: [\n {\n additionalProperties: false,\n properties: {\n exemptedBy: {\n description: `Array of tags (e.g., \\`['type']\\`) whose presence on the document\nblock avoids the need for a \\`@template\\`. Defaults to an array with\n\\`inheritdoc\\`. If you set this array, it will overwrite the default,\nso be sure to add back \\`inheritdoc\\` if you wish its presence to cause\nexemption of the rule.`,\n items: {\n type: 'string',\n },\n type: 'array',\n },\n requireSeparateTemplates: {\n description: `Requires that each template have its own separate line, i.e., preventing\ntemplates of this format:\n\n\\`\\`\\`js\n/**\n * @template T, U, V\n */\n\\`\\`\\`\n\nDefaults to \\`false\\`.`,\n type: 'boolean',\n },\n },\n type: 'object',\n },\n ],\n type: 'suggestion',\n },\n});\n"],"mappings":";;;;;;AAAA,IAAAA,aAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,aAAA,GAAAD,OAAA;AAI8B,SAAAD,uBAAAG,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,IAAAG,QAAA,GAAAC,OAAA,CAAAF,OAAA,GAEf,IAAAG,qBAAY,EAAC,CAAC;EAC3BC,OAAO;EACPC,IAAI;EACJC,MAAM;EACNC,QAAQ;EACRC;AACF,CAAC,KAAK;EACJ,IAAIA,KAAK,CAACC,SAAS,CAAC,CAAC,EAAE;IACrB;EACF;EAEA,MAAM;IACJC,wBAAwB,GAAG;EAC7B,CAAC,GAAGN,OAAO,CAACO,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;EAE5B,MAAM;IACJC;EACF,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AAC,CACpB,UAAU,CACX,CAAC;AACJ,CAAC,EAAE;EACDY,gBAAgB,EAAE,IAAI;EACtBC,IAAI,EAAE;IACJC,IAAI,EAAE;MACJC,WAAW,EAAE,qEAAqE;MAClFC,GAAG,EAAE;IACP,CAAC;IACDC,MAAM,EAAE,CACN;MACEC,oBAAoB,EAAE,KAAK;MAC3BC,UAAU,EAAE;QACVC,UAAU,EAAE;UACVL,WAAW,EAAE;AACzB;AACA;AACA;AACA,uBAAuB;UACXM,KAAK,EAAE;YACLnC,IAAI,EAAE;UACR,CAAC;UACDA,IAAI,EAAE;QACR,CAAC;QACDvB,wBAAwB,EAAE;UACxBoD,WAAW,EAAE;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB;UACX7B,IAAI,EAAE;QACR;MACF,CAAC;MACDA,IAAI,EAAE;IACR,CAAC,CACF;IACDA,IAAI,EAAE;EACR;AACF,CAAC,CAAC;AAAAoC,MAAA,CAAAnE,OAAA,GAAAA,OAAA,CAAAF,OAAA","ignoreList":[]}
|
package/dist/rules/sortTags.cjs
CHANGED
|
@@ -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`,\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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MAC3BC,UAAU,EAAE;QACVvG,iBAAiB,EAAE;UACjB2C,WAAW,EAAE;AACzB;AACA;AACA;AACA;AACA,4DAA4D;UAChDI,IAAI,EAAE;QACR,CAAC;QACD9C,YAAY,EAAE;UACZ0C,WAAW,EAAE;AACzB;AACA,0DAA0D;UAC9CI,IAAI,EAAE;QACR,CAAC;QACD7C,0BAA0B,EAAE;UAC1ByC,WAAW,EAAE;AACzB;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;AACA,CAAC;UACW6D,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","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;IAC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;QACR,CAAC;QACD7C,0BAA0B,EAAE;UAC1ByC,WAAW,EAAE;AACzB;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":[]}
|