eslint-plugin-jsdoc 63.0.11 → 63.0.13
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/WarnSettings.cjs +8 -1
- package/dist/WarnSettings.cjs.map +1 -1
- package/dist/alignTransform.cjs +10 -6
- package/dist/alignTransform.cjs.map +1 -1
- package/dist/buildForbidRuleDefinition.cjs +10 -3
- package/dist/buildForbidRuleDefinition.cjs.map +1 -1
- package/dist/buildRejectOrPreferRuleDefinition.cjs +14 -7
- package/dist/buildRejectOrPreferRuleDefinition.cjs.map +1 -1
- package/dist/defaultTagOrder.cjs +8 -1
- package/dist/defaultTagOrder.cjs.map +1 -1
- package/dist/exportParser.cjs +14 -6
- package/dist/exportParser.cjs.map +1 -1
- package/dist/generateDocs.cjs +44 -36
- package/dist/generateDocs.cjs.map +1 -1
- package/dist/generateOptions.cjs +18 -15
- package/dist/generateOptions.cjs.map +1 -1
- package/dist/generateRule.cjs +24 -24
- package/dist/generateRule.cjs.map +1 -1
- package/dist/generateRuleTypes.cjs +9 -6
- package/dist/generateRuleTypes.cjs.map +1 -1
- package/dist/getDefaultTagStructureForMode.cjs +8 -1
- package/dist/getDefaultTagStructureForMode.cjs.map +1 -1
- package/dist/getJsdocProcessorPlugin.cjs +28 -20
- package/dist/getJsdocProcessorPlugin.cjs.map +1 -1
- package/dist/index-cjs.cjs +159 -152
- package/dist/index-cjs.cjs.map +1 -1
- package/dist/index-esm.cjs +27 -16
- package/dist/index-esm.cjs.map +1 -1
- package/dist/index.cjs +172 -159
- package/dist/index.cjs.map +1 -1
- package/dist/iterateJsdoc.cjs +32 -22
- package/dist/iterateJsdoc.cjs.map +1 -1
- package/dist/jsdocUtils.cjs +86 -18
- package/dist/jsdocUtils.cjs.map +1 -1
- package/dist/rules/checkAccess.cjs +10 -2
- package/dist/rules/checkAccess.cjs.map +1 -1
- package/dist/rules/checkAlignment.cjs +10 -2
- package/dist/rules/checkAlignment.cjs.map +1 -1
- package/dist/rules/checkExamples.cjs +15 -6
- package/dist/rules/checkExamples.cjs.map +1 -1
- package/dist/rules/checkIndentation.cjs +9 -2
- package/dist/rules/checkIndentation.cjs.map +1 -1
- package/dist/rules/checkLineAlignment.cjs +14 -6
- package/dist/rules/checkLineAlignment.cjs.map +1 -1
- package/dist/rules/checkParamNames.cjs +9 -2
- package/dist/rules/checkParamNames.cjs.map +1 -1
- package/dist/rules/checkPropertyNames.cjs +9 -2
- package/dist/rules/checkPropertyNames.cjs.map +1 -1
- package/dist/rules/checkSyntax.cjs +10 -2
- package/dist/rules/checkSyntax.cjs.map +1 -1
- package/dist/rules/checkTagNames.cjs +11 -4
- package/dist/rules/checkTagNames.cjs.map +1 -1
- package/dist/rules/checkTemplateNames.cjs +20 -12
- package/dist/rules/checkTemplateNames.cjs.map +1 -1
- package/dist/rules/checkTypes.cjs +10 -4
- package/dist/rules/checkTypes.cjs.map +1 -1
- package/dist/rules/checkValues.cjs +17 -9
- package/dist/rules/checkValues.cjs.map +1 -1
- package/dist/rules/convertToJsdocComments.cjs +19 -13
- package/dist/rules/convertToJsdocComments.cjs.map +1 -1
- package/dist/rules/emptyTags.cjs +10 -2
- package/dist/rules/emptyTags.cjs.map +1 -1
- package/dist/rules/escapeInlineTags.cjs +10 -2
- package/dist/rules/escapeInlineTags.cjs.map +1 -1
- package/dist/rules/implementsOnClasses.cjs +10 -2
- package/dist/rules/implementsOnClasses.cjs.map +1 -1
- package/dist/rules/importsAsDependencies.cjs +20 -12
- package/dist/rules/importsAsDependencies.cjs.map +1 -1
- package/dist/rules/informativeDocs.cjs +12 -4
- package/dist/rules/informativeDocs.cjs.map +1 -1
- package/dist/rules/linesBeforeBlock.cjs +9 -2
- package/dist/rules/linesBeforeBlock.cjs.map +1 -1
- package/dist/rules/matchDescription.cjs +9 -2
- package/dist/rules/matchDescription.cjs.map +1 -1
- package/dist/rules/matchName.cjs +10 -2
- package/dist/rules/matchName.cjs.map +1 -1
- package/dist/rules/multilineBlocks.cjs +9 -2
- package/dist/rules/multilineBlocks.cjs.map +1 -1
- package/dist/rules/noBadBlocks.cjs +11 -4
- package/dist/rules/noBadBlocks.cjs.map +1 -1
- package/dist/rules/noBlankBlockDescriptions.cjs +10 -2
- package/dist/rules/noBlankBlockDescriptions.cjs.map +1 -1
- package/dist/rules/noBlankBlocks.cjs +10 -2
- package/dist/rules/noBlankBlocks.cjs.map +1 -1
- package/dist/rules/noDefaults.cjs +10 -2
- package/dist/rules/noDefaults.cjs.map +1 -1
- package/dist/rules/noMissingSyntax.cjs +9 -2
- package/dist/rules/noMissingSyntax.cjs.map +1 -1
- package/dist/rules/noMultiAsterisks.cjs +10 -2
- package/dist/rules/noMultiAsterisks.cjs.map +1 -1
- package/dist/rules/noRestrictedSyntax.cjs +9 -2
- package/dist/rules/noRestrictedSyntax.cjs.map +1 -1
- package/dist/rules/noTypes.cjs +9 -2
- package/dist/rules/noTypes.cjs.map +1 -1
- package/dist/rules/noUndefinedTypes.cjs +21 -13
- package/dist/rules/noUndefinedTypes.cjs.map +1 -1
- package/dist/rules/preferImportTag.cjs +28 -21
- package/dist/rules/preferImportTag.cjs.map +1 -1
- package/dist/rules/requireAsteriskPrefix.cjs +10 -2
- package/dist/rules/requireAsteriskPrefix.cjs.map +1 -1
- package/dist/rules/requireDescription.cjs +9 -2
- package/dist/rules/requireDescription.cjs.map +1 -1
- package/dist/rules/requireDescriptionCompleteSentence.cjs +15 -7
- package/dist/rules/requireDescriptionCompleteSentence.cjs.map +1 -1
- package/dist/rules/requireExample.cjs +10 -2
- package/dist/rules/requireExample.cjs.map +1 -1
- package/dist/rules/requireFileOverview.cjs +10 -2
- package/dist/rules/requireFileOverview.cjs.map +1 -1
- package/dist/rules/requireHyphenBeforeParamDescription.cjs +10 -2
- package/dist/rules/requireHyphenBeforeParamDescription.cjs.map +1 -1
- package/dist/rules/requireJsdoc.cjs +24 -17
- package/dist/rules/requireJsdoc.cjs.map +1 -1
- package/dist/rules/requireParam.cjs +9 -2
- package/dist/rules/requireParam.cjs.map +1 -1
- package/dist/rules/requireParamDescription.cjs +10 -2
- package/dist/rules/requireParamDescription.cjs.map +1 -1
- package/dist/rules/requireParamName.cjs +10 -2
- package/dist/rules/requireParamName.cjs.map +1 -1
- package/dist/rules/requireParamType.cjs +10 -2
- package/dist/rules/requireParamType.cjs.map +1 -1
- package/dist/rules/requireProperty.cjs +10 -2
- package/dist/rules/requireProperty.cjs.map +1 -1
- package/dist/rules/requirePropertyDescription.cjs +10 -2
- package/dist/rules/requirePropertyDescription.cjs.map +1 -1
- package/dist/rules/requirePropertyName.cjs +10 -2
- package/dist/rules/requirePropertyName.cjs.map +1 -1
- package/dist/rules/requirePropertyType.cjs +10 -2
- package/dist/rules/requirePropertyType.cjs.map +1 -1
- package/dist/rules/requireRejects.cjs +9 -2
- package/dist/rules/requireRejects.cjs.map +1 -1
- package/dist/rules/requireReturns.cjs +11 -4
- package/dist/rules/requireReturns.cjs.map +1 -1
- package/dist/rules/requireReturnsCheck.cjs +15 -8
- package/dist/rules/requireReturnsCheck.cjs.map +1 -1
- package/dist/rules/requireReturnsDescription.cjs +10 -2
- package/dist/rules/requireReturnsDescription.cjs.map +1 -1
- package/dist/rules/requireReturnsType.cjs +10 -2
- package/dist/rules/requireReturnsType.cjs.map +1 -1
- package/dist/rules/requireTags.cjs +9 -2
- package/dist/rules/requireTags.cjs.map +1 -1
- package/dist/rules/requireTemplate.cjs +13 -5
- package/dist/rules/requireTemplate.cjs.map +1 -1
- package/dist/rules/requireThrows.cjs +9 -2
- package/dist/rules/requireThrows.cjs.map +1 -1
- package/dist/rules/requireYields.cjs +9 -2
- package/dist/rules/requireYields.cjs.map +1 -1
- package/dist/rules/requireYieldsCheck.cjs +9 -2
- package/dist/rules/requireYieldsCheck.cjs.map +1 -1
- package/dist/rules/sortTags.cjs +12 -4
- package/dist/rules/sortTags.cjs.map +1 -1
- package/dist/rules/tagLines.cjs +9 -2
- package/dist/rules/tagLines.cjs.map +1 -1
- package/dist/rules/textEscaping.cjs +9 -2
- package/dist/rules/textEscaping.cjs.map +1 -1
- package/dist/rules/tsMethodSignatureStyle.cjs +18 -10
- package/dist/rules/tsMethodSignatureStyle.cjs.map +1 -1
- package/dist/rules/tsNoEmptyObjectType.cjs +13 -5
- package/dist/rules/tsNoEmptyObjectType.cjs.map +1 -1
- package/dist/rules/tsNoUnnecessaryTemplateExpression.cjs +16 -8
- package/dist/rules/tsNoUnnecessaryTemplateExpression.cjs.map +1 -1
- package/dist/rules/tsPreferFunctionType.cjs +16 -8
- package/dist/rules/tsPreferFunctionType.cjs.map +1 -1
- package/dist/rules/typeFormatting.cjs +17 -9
- package/dist/rules/typeFormatting.cjs.map +1 -1
- package/dist/rules/validTypes.cjs +18 -10
- package/dist/rules/validTypes.cjs.map +1 -1
- package/dist/tagNames.cjs +9 -4
- package/dist/tagNames.cjs.map +1 -1
- package/dist/utils/hasReturnValue.cjs +8 -1
- package/dist/utils/hasReturnValue.cjs.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"noMultiAsterisks.cjs","names":[],"sources":["../../src/rules/noMultiAsterisks.js"],"sourcesContent":["import iterateJsdoc from '../iterateJsdoc.js';\n\nconst middleAsterisksBlockWS = /^([\\t ]|\\*(?!\\*))+/v;\nconst middleAsterisksNoBlockWS = /^\\*+/v;\n\nconst endAsterisksSingleLineBlockWS = /\\*((?:\\*|(?: |\\t))*)\\*$/v;\nconst endAsterisksMultipleLineBlockWS = /((?:\\*|(?: |\\t))*)\\*$/v;\n\nconst endAsterisksSingleLineNoBlockWS = /\\*(\\**)\\*$/v;\nconst endAsterisksMultipleLineNoBlockWS = /(\\**)\\*$/v;\n\nexport default iterateJsdoc(({\n context,\n jsdoc,\n utils,\n}) => {\n const {\n allowWhitespace = false,\n preventAtEnd = true,\n preventAtMiddleLines = true,\n } = context.options[0] || {};\n\n const middleAsterisks = allowWhitespace ? middleAsterisksNoBlockWS : middleAsterisksBlockWS;\n\n jsdoc.source.some(({\n number,\n tokens,\n }) => {\n const {\n delimiter,\n description,\n end,\n name,\n postDelimiter,\n tag,\n type,\n } = tokens;\n\n if (\n preventAtMiddleLines &&\n !end && !tag && !type && !name &&\n (\n !allowWhitespace && middleAsterisks.test(description) ||\n allowWhitespace && middleAsterisks.test(postDelimiter + description)\n )\n ) {\n // console.log('description', JSON.stringify(description));\n const fix = () => {\n tokens.description = description.replace(middleAsterisks, '');\n };\n\n utils.reportJSDoc(\n 'Should be no multiple asterisks on middle lines.',\n {\n line: number,\n },\n fix,\n true,\n );\n\n return true;\n }\n\n if (!preventAtEnd || !end) {\n return false;\n }\n\n const isSingleLineBlock = delimiter === '/**';\n const delim = isSingleLineBlock ? '*' : delimiter;\n const endAsterisks = allowWhitespace ?\n (isSingleLineBlock ? endAsterisksSingleLineNoBlockWS : endAsterisksMultipleLineNoBlockWS) :\n (isSingleLineBlock ? endAsterisksSingleLineBlockWS : endAsterisksMultipleLineBlockWS);\n\n const endingAsterisksAndSpaces = (\n allowWhitespace ? postDelimiter + description + delim : description + delim\n ).match(\n endAsterisks,\n );\n\n if (\n !endingAsterisksAndSpaces ||\n !isSingleLineBlock && endingAsterisksAndSpaces[1] && !endingAsterisksAndSpaces[1].trim()\n ) {\n return false;\n }\n\n const endFix = () => {\n if (!isSingleLineBlock) {\n tokens.delimiter = '';\n }\n\n tokens.description = (description + delim).replace(endAsterisks, '');\n };\n\n utils.reportJSDoc(\n 'Should be no multiple asterisks on end lines.',\n {\n line: number,\n },\n endFix,\n true,\n );\n\n return true;\n });\n}, {\n iterateAllJsdocs: true,\n meta: {\n docs: {\n description: 'Prevents use of multiple asterisks at the beginning of lines.',\n url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/no-multi-asterisks.md#repos-sticky-header',\n },\n fixable: 'code',\n schema: [\n {\n additionalProperties: false,\n properties: {\n allowWhitespace: {\n description: `Set to \\`true\\` if you wish to allow asterisks after a space (as with Markdown):\n\n\\`\\`\\`js\n/**\n * *bold* text\n */\n\\`\\`\\`\n\nDefaults to \\`false\\`.`,\n type: 'boolean',\n },\n preventAtEnd: {\n description: `Prevent the likes of this:\n\n\\`\\`\\`js\n/**\n *\n *\n **/\n\\`\\`\\`\n\nDefaults to \\`true\\`.`,\n type: 'boolean',\n },\n preventAtMiddleLines: {\n description: `Prevent the likes of this:\n\n\\`\\`\\`js\n/**\n *\n **\n */\n\\`\\`\\`\n\nDefaults to \\`true\\`.`,\n type: 'boolean',\n },\n },\n type: 'object',\n },\n ],\n type: 'suggestion',\n },\n});\n"],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"noMultiAsterisks.cjs","names":["iterateJsdoc"],"sources":["../../src/rules/noMultiAsterisks.js"],"sourcesContent":["import iterateJsdoc from '../iterateJsdoc.js';\n\nconst middleAsterisksBlockWS = /^([\\t ]|\\*(?!\\*))+/v;\nconst middleAsterisksNoBlockWS = /^\\*+/v;\n\nconst endAsterisksSingleLineBlockWS = /\\*((?:\\*|(?: |\\t))*)\\*$/v;\nconst endAsterisksMultipleLineBlockWS = /((?:\\*|(?: |\\t))*)\\*$/v;\n\nconst endAsterisksSingleLineNoBlockWS = /\\*(\\**)\\*$/v;\nconst endAsterisksMultipleLineNoBlockWS = /(\\**)\\*$/v;\n\nexport default iterateJsdoc(({\n context,\n jsdoc,\n utils,\n}) => {\n const {\n allowWhitespace = false,\n preventAtEnd = true,\n preventAtMiddleLines = true,\n } = context.options[0] || {};\n\n const middleAsterisks = allowWhitespace ? middleAsterisksNoBlockWS : middleAsterisksBlockWS;\n\n jsdoc.source.some(({\n number,\n tokens,\n }) => {\n const {\n delimiter,\n description,\n end,\n name,\n postDelimiter,\n tag,\n type,\n } = tokens;\n\n if (\n preventAtMiddleLines &&\n !end && !tag && !type && !name &&\n (\n !allowWhitespace && middleAsterisks.test(description) ||\n allowWhitespace && middleAsterisks.test(postDelimiter + description)\n )\n ) {\n // console.log('description', JSON.stringify(description));\n const fix = () => {\n tokens.description = description.replace(middleAsterisks, '');\n };\n\n utils.reportJSDoc(\n 'Should be no multiple asterisks on middle lines.',\n {\n line: number,\n },\n fix,\n true,\n );\n\n return true;\n }\n\n if (!preventAtEnd || !end) {\n return false;\n }\n\n const isSingleLineBlock = delimiter === '/**';\n const delim = isSingleLineBlock ? '*' : delimiter;\n const endAsterisks = allowWhitespace ?\n (isSingleLineBlock ? endAsterisksSingleLineNoBlockWS : endAsterisksMultipleLineNoBlockWS) :\n (isSingleLineBlock ? endAsterisksSingleLineBlockWS : endAsterisksMultipleLineBlockWS);\n\n const endingAsterisksAndSpaces = (\n allowWhitespace ? postDelimiter + description + delim : description + delim\n ).match(\n endAsterisks,\n );\n\n if (\n !endingAsterisksAndSpaces ||\n !isSingleLineBlock && endingAsterisksAndSpaces[1] && !endingAsterisksAndSpaces[1].trim()\n ) {\n return false;\n }\n\n const endFix = () => {\n if (!isSingleLineBlock) {\n tokens.delimiter = '';\n }\n\n tokens.description = (description + delim).replace(endAsterisks, '');\n };\n\n utils.reportJSDoc(\n 'Should be no multiple asterisks on end lines.',\n {\n line: number,\n },\n endFix,\n true,\n );\n\n return true;\n });\n}, {\n iterateAllJsdocs: true,\n meta: {\n docs: {\n description: 'Prevents use of multiple asterisks at the beginning of lines.',\n url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/no-multi-asterisks.md#repos-sticky-header',\n },\n fixable: 'code',\n schema: [\n {\n additionalProperties: false,\n properties: {\n allowWhitespace: {\n description: `Set to \\`true\\` if you wish to allow asterisks after a space (as with Markdown):\n\n\\`\\`\\`js\n/**\n * *bold* text\n */\n\\`\\`\\`\n\nDefaults to \\`false\\`.`,\n type: 'boolean',\n },\n preventAtEnd: {\n description: `Prevent the likes of this:\n\n\\`\\`\\`js\n/**\n *\n *\n **/\n\\`\\`\\`\n\nDefaults to \\`true\\`.`,\n type: 'boolean',\n },\n preventAtMiddleLines: {\n description: `Prevent the likes of this:\n\n\\`\\`\\`js\n/**\n *\n **\n */\n\\`\\`\\`\n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E;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB;UACX,IAAI,EAAE;QACR,CAAC;QACD,YAAY,EAAE;UACZ,WAAW,EAAE;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB;UACV,IAAI,EAAE;QACR,CAAC;QACD,oBAAoB,EAAE;UACpB,WAAW,EAAE;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB;UACV,IAAI,EAAE;QACR;MACF,CAAC;MACD,IAAI,EAAE;IACR,CAAC,CACF;IACD,IAAI,EAAE;EACR;AACF,CAAC,CAAC;AAAA","ignoreList":[]}
|
|
@@ -1,5 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _buildForbidRuleDefinition = require("../buildForbidRuleDefinition.cjs");
|
|
8
|
+
var _default = exports.default = (0, _buildForbidRuleDefinition.buildForbidRuleDefinition)({
|
|
3
9
|
getContexts(context, report) {
|
|
4
10
|
if (!context.options.length) {
|
|
5
11
|
report('Rule `no-restricted-syntax` is missing a `contexts` option.');
|
|
@@ -58,4 +64,5 @@ section of our Advanced docs for more on the expected format.`,
|
|
|
58
64
|
}],
|
|
59
65
|
url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/no-restricted-syntax.md#repos-sticky-header'
|
|
60
66
|
});
|
|
67
|
+
module.exports = exports.default;
|
|
61
68
|
//# sourceMappingURL=noRestrictedSyntax.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"noRestrictedSyntax.cjs","names":[],"sources":["../../src/rules/noRestrictedSyntax.js"],"sourcesContent":["import {\n buildForbidRuleDefinition,\n} from '../buildForbidRuleDefinition.js';\n\nexport default buildForbidRuleDefinition({\n getContexts (context, report) {\n if (!context.options.length) {\n report('Rule `no-restricted-syntax` is missing a `contexts` option.');\n return false;\n }\n\n const {\n contexts,\n } = context.options[0];\n\n return contexts;\n },\n schema: [\n {\n additionalProperties: false,\n properties: {\n contexts: {\n description: `Set this to an array of strings representing the AST context (or an object with\n\\`context\\` and \\`comment\\` properties) where you wish the rule to be applied.\n\n\\`context\\` defaults to \\`any\\` and \\`comment\\` defaults to no specific comment context.\n\nUse the \\`message\\` property to indicate the specific error to be shown when an\nerror is reported for that context being found. Defaults to\n\\`\"Syntax is restricted: {{context}}\"\\`, or with a comment, to\n\\`\"Syntax is restricted: {{context}} with {{comment}}\"\\`.\n\nSet to \\`\"any\"\\` if you want the rule to apply to any JSDoc block throughout\nyour files (as is necessary for finding function blocks not attached to a\nfunction declaration or expression, i.e., \\`@callback\\` or \\`@function\\` (or its\naliases \\`@func\\` or \\`@method\\`) (including those associated with an \\`@interface\\`).\n\nSee the [\"AST and Selectors\"](../advanced.md#ast-and-selectors)\nsection of our Advanced docs for more on the expected format.`,\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 message: {\n type: 'string',\n },\n },\n type: 'object',\n },\n ],\n },\n type: 'array',\n },\n },\n required: [\n 'contexts',\n ],\n type: 'object',\n },\n ],\n url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/no-restricted-syntax.md#repos-sticky-header',\n});\n"],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"noRestrictedSyntax.cjs","names":["buildForbidRuleDefinition"],"sources":["../../src/rules/noRestrictedSyntax.js"],"sourcesContent":["import {\n buildForbidRuleDefinition,\n} from '../buildForbidRuleDefinition.js';\n\nexport default buildForbidRuleDefinition({\n getContexts (context, report) {\n if (!context.options.length) {\n report('Rule `no-restricted-syntax` is missing a `contexts` option.');\n return false;\n }\n\n const {\n contexts,\n } = context.options[0];\n\n return contexts;\n },\n schema: [\n {\n additionalProperties: false,\n properties: {\n contexts: {\n description: `Set this to an array of strings representing the AST context (or an object with\n\\`context\\` and \\`comment\\` properties) where you wish the rule to be applied.\n\n\\`context\\` defaults to \\`any\\` and \\`comment\\` defaults to no specific comment context.\n\nUse the \\`message\\` property to indicate the specific error to be shown when an\nerror is reported for that context being found. Defaults to\n\\`\"Syntax is restricted: {{context}}\"\\`, or with a comment, to\n\\`\"Syntax is restricted: {{context}} with {{comment}}\"\\`.\n\nSet to \\`\"any\"\\` if you want the rule to apply to any JSDoc block throughout\nyour files (as is necessary for finding function blocks not attached to a\nfunction declaration or expression, i.e., \\`@callback\\` or \\`@function\\` (or its\naliases \\`@func\\` or \\`@method\\`) (including those associated with an \\`@interface\\`).\n\nSee the [\"AST and Selectors\"](../advanced.md#ast-and-selectors)\nsection of our Advanced docs for more on the expected format.`,\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 message: {\n type: 'string',\n },\n },\n type: 'object',\n },\n ],\n },\n type: 'array',\n },\n },\n required: [\n 'contexts',\n ],\n type: 'object',\n },\n ],\n url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/no-restricted-syntax.md#repos-sticky-header',\n});\n"],"mappings":";;;;;;AAAA;AAEyC,iCAE1B,IAAAA,2BAAA,yBAAyB,EAAC;EACvC,WAAW,CAAE,OAAO,EAAE,MAAM,EAAE;IAC5B,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,EAAE;MAC3B,MAAM,CAAC,6DAA6D,CAAC;MACrE,OAAO,KAAK;IACd;IAEA,MAAM;MACJ;IACF,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC;IAEtB,OAAO,QAAQ;EACjB,CAAC;EACD,MAAM,EAAE,CACN;IACE,oBAAoB,EAAE,KAAK;IAC3B,UAAU,EAAE;MACV,QAAQ,EAAE;QACR,WAAW,EAAE;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8DAA8D;QACpD,KAAK,EAAE;UACL,KAAK,EAAE,CACL;YACE,IAAI,EAAE;UACR,CAAC,EACD;YACE,oBAAoB,EAAE,KAAK;YAC3B,UAAU,EAAE;cACV,OAAO,EAAE;gBACP,IAAI,EAAE;cACR,CAAC;cACD,OAAO,EAAE;gBACP,IAAI,EAAE;cACR,CAAC;cACD,OAAO,EAAE;gBACP,IAAI,EAAE;cACR;YACF,CAAC;YACD,IAAI,EAAE;UACR,CAAC;QAEL,CAAC;QACD,IAAI,EAAE;MACR;IACF,CAAC;IACD,QAAQ,EAAE,CACR,UAAU,CACX;IACD,IAAI,EAAE;EACR,CAAC,CACF;EACD,GAAG,EAAE;AACP,CAAC,CAAC;AAAA","ignoreList":[]}
|
package/dist/rules/noTypes.cjs
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
2
|
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _iterateJsdoc = _interopRequireDefault(require("../iterateJsdoc.cjs"));
|
|
8
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
3
9
|
/**
|
|
4
10
|
* @param {import('comment-parser').Line} line
|
|
5
11
|
*/
|
|
@@ -9,7 +15,7 @@ const removeType = ({
|
|
|
9
15
|
tokens.postTag = '';
|
|
10
16
|
tokens.type = '';
|
|
11
17
|
};
|
|
12
|
-
|
|
18
|
+
var _default = exports.default = (0, _iterateJsdoc.default)(({
|
|
13
19
|
node,
|
|
14
20
|
utils
|
|
15
21
|
}) => {
|
|
@@ -91,4 +97,5 @@ section of our Advanced docs for more on the expected format.`,
|
|
|
91
97
|
type: 'suggestion'
|
|
92
98
|
}
|
|
93
99
|
});
|
|
100
|
+
module.exports = exports.default;
|
|
94
101
|
//# sourceMappingURL=noTypes.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"noTypes.cjs","names":[],"sources":["../../src/rules/noTypes.js"],"sourcesContent":["import iterateJsdoc from '../iterateJsdoc.js';\n\n/**\n * @param {import('comment-parser').Line} line\n */\nconst removeType = ({\n tokens,\n}) => {\n tokens.postTag = '';\n tokens.type = '';\n};\n\nexport default iterateJsdoc(({\n node,\n utils,\n}) => {\n if (!utils.isIteratingFunctionOrVariable() && !utils.isVirtualFunction()) {\n return;\n }\n\n const tags = utils.getPresentTags([\n 'param', 'arg', 'argument', 'returns', 'return',\n ]);\n\n for (const tag of tags) {\n if (tag.type) {\n utils.reportJSDoc(`Types are not permitted on @${tag.tag}.`, tag, () => {\n for (const source of tag.source) {\n removeType(source);\n }\n });\n }\n }\n\n if (node?.type === 'ClassDeclaration') {\n const propertyTags = utils.getPresentTags([\n 'prop', 'property',\n ]);\n for (const tag of propertyTags) {\n if (tag.type) {\n utils.reportJSDoc(`Types are not permitted on @${tag.tag} in the supplied context.`, tag, () => {\n for (const source of tag.source) {\n removeType(source);\n }\n });\n }\n }\n }\n}, {\n contextDefaults: [\n 'ArrowFunctionExpression', 'FunctionDeclaration', 'FunctionExpression', 'TSDeclareFunction',\n // Add this to above defaults\n 'TSMethodSignature', 'ClassDeclaration',\n ],\n meta: {\n docs: {\n description: 'This rule reports types being used on `@param` or `@returns` (redundant with TypeScript).',\n url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/no-types.md#repos-sticky-header',\n },\n fixable: 'code',\n schema: [\n {\n additionalProperties: false,\n properties: {\n contexts: {\n description: `Set this to an array of strings representing the AST context (or an object with\noptional \\`context\\` and \\`comment\\` properties) where you wish the 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\\`, \\`TSDeclareFunction\\`, \\`TSMethodSignature\\`,\n\\`ClassDeclaration\\`). 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\\`).\n\nSee the [\"AST and Selectors\"](../advanced.md#ast-and-selectors)\nsection of our Advanced docs for more on the expected format.`,\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 },\n type: 'object',\n },\n ],\n },\n type: 'array',\n },\n },\n type: 'object',\n },\n ],\n type: 'suggestion',\n },\n});\n"],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"noTypes.cjs","names":["iterateJsdoc"],"sources":["../../src/rules/noTypes.js"],"sourcesContent":["import iterateJsdoc from '../iterateJsdoc.js';\n\n/**\n * @param {import('comment-parser').Line} line\n */\nconst removeType = ({\n tokens,\n}) => {\n tokens.postTag = '';\n tokens.type = '';\n};\n\nexport default iterateJsdoc(({\n node,\n utils,\n}) => {\n if (!utils.isIteratingFunctionOrVariable() && !utils.isVirtualFunction()) {\n return;\n }\n\n const tags = utils.getPresentTags([\n 'param', 'arg', 'argument', 'returns', 'return',\n ]);\n\n for (const tag of tags) {\n if (tag.type) {\n utils.reportJSDoc(`Types are not permitted on @${tag.tag}.`, tag, () => {\n for (const source of tag.source) {\n removeType(source);\n }\n });\n }\n }\n\n if (node?.type === 'ClassDeclaration') {\n const propertyTags = utils.getPresentTags([\n 'prop', 'property',\n ]);\n for (const tag of propertyTags) {\n if (tag.type) {\n utils.reportJSDoc(`Types are not permitted on @${tag.tag} in the supplied context.`, tag, () => {\n for (const source of tag.source) {\n removeType(source);\n }\n });\n }\n }\n }\n}, {\n contextDefaults: [\n 'ArrowFunctionExpression', 'FunctionDeclaration', 'FunctionExpression', 'TSDeclareFunction',\n // Add this to above defaults\n 'TSMethodSignature', 'ClassDeclaration',\n ],\n meta: {\n docs: {\n description: 'This rule reports types being used on `@param` or `@returns` (redundant with TypeScript).',\n url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/no-types.md#repos-sticky-header',\n },\n fixable: 'code',\n schema: [\n {\n additionalProperties: false,\n properties: {\n contexts: {\n description: `Set this to an array of strings representing the AST context (or an object with\noptional \\`context\\` and \\`comment\\` properties) where you wish the 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\\`, \\`TSDeclareFunction\\`, \\`TSMethodSignature\\`,\n\\`ClassDeclaration\\`). 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\\`).\n\nSee the [\"AST and Selectors\"](../advanced.md#ast-and-selectors)\nsection of our Advanced docs for more on the expected format.`,\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 },\n type: 'object',\n },\n ],\n },\n type: 'array',\n },\n },\n type: 'object',\n },\n ],\n type: 'suggestion',\n },\n});\n"],"mappings":";;;;;;AAAA;AAA8C;AAE9C;AACA;AACA;AACA,MAAM,UAAU,GAAG,CAAC;EAClB;AACF,CAAC,KAAK;EACJ,MAAM,CAAC,OAAO,GAAG,EAAE;EACnB,MAAM,CAAC,IAAI,GAAG,EAAE;AAClB,CAAC;AAAC,iCAEa,IAAAA,qBAAY,EAAC,CAAC;EAC3B,IAAI;EACJ;AACF,CAAC,KAAK;EACJ,IAAI,CAAC,KAAK,CAAC,6BAA6B,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC,EAAE;IAC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ACA;AACA;AACA;AACA;AACA,8DAA8D;UAClD,KAAK,EAAE;YACL,KAAK,EAAE,CACL;cACE,IAAI,EAAE;YACR,CAAC,EACD;cACE,oBAAoB,EAAE,KAAK;cAC3B,UAAU,EAAE;gBACV,OAAO,EAAE;kBACP,IAAI,EAAE;gBACR,CAAC;gBACD,OAAO,EAAE;kBACP,IAAI,EAAE;gBACR;cACF,CAAC;cACD,IAAI,EAAE;YACR,CAAC;UAEL,CAAC;UACD,IAAI,EAAE;QACR;MACF,CAAC;MACD,IAAI,EAAE;IACR,CAAC,CACF;IACD,IAAI,EAAE;EACR;AACF,CAAC,CAAC;AAAA","ignoreList":[]}
|
|
@@ -1,7 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _iterateJsdoc = _interopRequireWildcard(require("../iterateJsdoc.cjs"));
|
|
8
|
+
var _jsdocUtils = require("../jsdocUtils.cjs");
|
|
9
|
+
var _jsdoccomment = require("@es-joy/jsdoccomment");
|
|
10
|
+
var _parseImportsExports = require("parse-imports-exports");
|
|
11
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
5
12
|
const extraTypes = ['null', 'undefined', 'void', 'string', 'boolean', 'object', 'function', 'symbol', 'number', 'bigint', 'NaN', 'Infinity', 'any', '*', 'never', 'unknown', 'const', 'this', 'true', 'false', 'Array', 'Object', 'RegExp', 'Date', 'Function', 'Intl'];
|
|
6
13
|
const globalTypes = ['globalThis', 'global', 'window', 'self'];
|
|
7
14
|
const iterableIterator = ['Iterable', 'Iterator', 'IteratorObject'];
|
|
@@ -16,7 +23,7 @@ const typescriptGlobals = [...iterableIterator,
|
|
|
16
23
|
const stripPseudoTypes = str => {
|
|
17
24
|
return str && str.replace(/(?:\.|<>|\.<>|\[\])$/v, '');
|
|
18
25
|
};
|
|
19
|
-
|
|
26
|
+
var _default = exports.default = (0, _iterateJsdoc.default)(({
|
|
20
27
|
context,
|
|
21
28
|
node,
|
|
22
29
|
report,
|
|
@@ -73,13 +80,13 @@ export default iterateJsdoc(({
|
|
|
73
80
|
}).filter(Boolean);
|
|
74
81
|
}
|
|
75
82
|
const allComments = sourceCode.getAllComments();
|
|
76
|
-
const comments = getJSDocCommentBlocks(sourceCode);
|
|
83
|
+
const comments = (0, _jsdocUtils.getJSDocCommentBlocks)(sourceCode);
|
|
77
84
|
const globals = allComments.filter(comment => {
|
|
78
85
|
return /^\s*globals/v.test(comment.value);
|
|
79
86
|
}).flatMap(commentNode => {
|
|
80
87
|
return commentNode.value.replace(/^\s*globals/v, '').trim().split(/,\s*/v);
|
|
81
88
|
}).concat(Object.keys(context.languageOptions.globals ?? []));
|
|
82
|
-
const typedefs = getDocumentNamepathDefiningTags(sourceCode);
|
|
89
|
+
const typedefs = (0, _jsdocUtils.getDocumentNamepathDefiningTags)(sourceCode);
|
|
83
90
|
const typedefDeclarations = typedefs.map(tag => {
|
|
84
91
|
return tag.name;
|
|
85
92
|
});
|
|
@@ -97,7 +104,7 @@ export default iterateJsdoc(({
|
|
|
97
104
|
} = tag;
|
|
98
105
|
const typePart = type ? `{${type}} ` : '';
|
|
99
106
|
const imprt = 'import ' + (description ? `${typePart}${name} ${description}` : `${typePart}${name}`);
|
|
100
|
-
const importsExports = parseImportsExports(imprt.trim());
|
|
107
|
+
const importsExports = (0, _parseImportsExports.parseImportsExports)(imprt.trim());
|
|
101
108
|
const types = [];
|
|
102
109
|
const namedImports = Object.values(importsExports.namedImports || {})[0]?.[0];
|
|
103
110
|
if (namedImports) {
|
|
@@ -132,11 +139,11 @@ export default iterateJsdoc(({
|
|
|
132
139
|
* @returns {import('comment-parser').Spec[]}
|
|
133
140
|
*/
|
|
134
141
|
const getTemplateTags = function (ancestorNode) {
|
|
135
|
-
const commentNode = getJSDocComment(sourceCode, ancestorNode, settings);
|
|
142
|
+
const commentNode = (0, _jsdoccomment.getJSDocComment)(sourceCode, ancestorNode, settings);
|
|
136
143
|
if (!commentNode) {
|
|
137
144
|
return [];
|
|
138
145
|
}
|
|
139
|
-
const jsdc = parseComment(commentNode, '');
|
|
146
|
+
const jsdc = (0, _iterateJsdoc.parseComment)(commentNode, '');
|
|
140
147
|
return jsdc.tags.filter(tag => {
|
|
141
148
|
return tag.tag === 'template';
|
|
142
149
|
});
|
|
@@ -399,7 +406,7 @@ export default iterateJsdoc(({
|
|
|
399
406
|
try {
|
|
400
407
|
const potentialType = tag[(/** @type {"type"|"name"|"namepathOrURL"} */propertyName)];
|
|
401
408
|
return {
|
|
402
|
-
parsedType: mode === 'permissive' ?
|
|
409
|
+
parsedType: mode === 'permissive' ? (0, _jsdoccomment.tryParse)(/** @type {string} */potentialType) : (0, _jsdoccomment.parse)(/** @type {string} */potentialType, mode),
|
|
403
410
|
tag
|
|
404
411
|
};
|
|
405
412
|
} catch {
|
|
@@ -439,7 +446,7 @@ export default iterateJsdoc(({
|
|
|
439
446
|
tag
|
|
440
447
|
} of tagsWithTypes) {
|
|
441
448
|
// eslint-disable-next-line complexity -- Refactor
|
|
442
|
-
traverse(parsedType, (nde, parentNode) => {
|
|
449
|
+
(0, _jsdoccomment.traverse)(parsedType, (nde, parentNode) => {
|
|
443
450
|
/**
|
|
444
451
|
* @type {import('jsdoc-type-pratt-parser').NameResult & {
|
|
445
452
|
* _parent?: import('jsdoc-type-pratt-parser').NonRootResult
|
|
@@ -534,7 +541,7 @@ export default iterateJsdoc(({
|
|
|
534
541
|
return /^\*(?!\*)/v.test(comment.value);
|
|
535
542
|
}).map(commentNode => {
|
|
536
543
|
return {
|
|
537
|
-
doc: parseComment(commentNode, ''),
|
|
544
|
+
doc: (0, _iterateJsdoc.parseComment)(commentNode, ''),
|
|
538
545
|
loc: commentNode.loc
|
|
539
546
|
};
|
|
540
547
|
});
|
|
@@ -605,4 +612,5 @@ importing types unless used in code.`,
|
|
|
605
612
|
type: 'suggestion'
|
|
606
613
|
}
|
|
607
614
|
});
|
|
615
|
+
module.exports = exports.default;
|
|
608
616
|
//# sourceMappingURL=noUndefinedTypes.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"noUndefinedTypes.cjs","names":[],"sources":["../../src/rules/noUndefinedTypes.js"],"sourcesContent":["import iterateJsdoc, {\n parseComment,\n} from '../iterateJsdoc.js';\nimport {\n getDocumentNamepathDefiningTags,\n getJSDocCommentBlocks,\n} from '../jsdocUtils.js';\nimport {\n getJSDocComment,\n parse as parseType,\n traverse,\n tryParse as tryParseType,\n} from '@es-joy/jsdoccomment';\nimport {\n parseImportsExports,\n} from 'parse-imports-exports';\n\nconst extraTypes = [\n 'null', 'undefined', 'void', 'string', 'boolean', 'object',\n 'function', 'symbol',\n 'number', 'bigint', 'NaN', 'Infinity',\n 'any', '*', 'never', 'unknown', 'const',\n 'this', 'true', 'false',\n 'Array', 'Object', 'RegExp', 'Date', 'Function', 'Intl',\n];\n\nconst globalTypes = [\n 'globalThis', 'global', 'window', 'self',\n];\n\nconst iterableIterator = [\n 'Iterable',\n 'Iterator',\n 'IteratorObject',\n];\n\nconst typescriptGlobals = [\n ...iterableIterator,\n\n // https://www.typescriptlang.org/docs/handbook/utility-types.html\n 'Awaited',\n 'Partial',\n 'Required',\n 'Readonly',\n 'Record',\n 'Pick',\n 'Omit',\n 'Exclude',\n 'Extract',\n 'NonNullable',\n 'Parameters',\n 'ConstructorParameters',\n 'ReturnType',\n 'InstanceType',\n 'ThisParameterType',\n 'OmitThisParameter',\n 'ThisType',\n 'Uppercase',\n 'Lowercase',\n 'Capitalize',\n 'Uncapitalize',\n];\n\n/**\n * @param {string|false|undefined} [str]\n * @returns {undefined|string|false}\n */\nconst stripPseudoTypes = (str) => {\n return str && str.replace(/(?:\\.|<>|\\.<>|\\[\\])$/v, '');\n};\n\nexport default iterateJsdoc(({\n context,\n node,\n report,\n settings,\n sourceCode,\n state,\n utils,\n}) => {\n /** @type {string[]} */\n const foundTypedefValues = [];\n\n const {\n scopeManager,\n } = sourceCode;\n\n // When is this ever `null`?\n const globalScope = /** @type {import('eslint').Scope.Scope} */ (\n scopeManager.globalScope\n );\n\n const\n /**\n * @type {{\n * checkUsedTypedefs: boolean\n * definedTypes: string[],\n * disableReporting: boolean,\n * markVariablesAsUsed: boolean,\n * }}\n */ {\n checkUsedTypedefs = false,\n definedTypes = [],\n disableReporting = false,\n markVariablesAsUsed = true,\n } = context.options[0] || {};\n\n /** @type {(string|undefined)[]} */\n let definedPreferredTypes = [];\n const {\n mode,\n preferredTypes,\n structuredTags,\n } = settings;\n if (Object.keys(preferredTypes).length) {\n definedPreferredTypes = /** @type {string[]} */ (Object.values(preferredTypes).map((preferredType) => {\n if (typeof preferredType === 'string') {\n // May become an empty string but will be filtered out below\n return stripPseudoTypes(preferredType);\n }\n\n if (!preferredType) {\n return undefined;\n }\n\n if (typeof preferredType !== 'object') {\n utils.reportSettings(\n 'Invalid `settings.jsdoc.preferredTypes`. Values must be falsy, a string, or an object.',\n );\n }\n\n return stripPseudoTypes(preferredType.replacement);\n })\n .filter(Boolean));\n }\n\n const allComments = sourceCode.getAllComments();\n const comments = getJSDocCommentBlocks(sourceCode);\n\n const globals = allComments\n .filter((comment) => {\n return (/^\\s*globals/v).test(comment.value);\n }).flatMap((commentNode) => {\n return commentNode.value.replace(/^\\s*globals/v, '').trim().split(/,\\s*/v);\n }).concat(Object.keys(context.languageOptions.globals ?? []));\n\n const typedefs = getDocumentNamepathDefiningTags(sourceCode);\n\n const typedefDeclarations = typedefs\n .map((tag) => {\n return tag.name;\n });\n\n const importTags = settings.mode === 'typescript' ? /** @type {string[]} */ (comments.flatMap((doc) => {\n return doc.tags.filter(({\n tag,\n }) => {\n return tag === 'import';\n });\n }).flatMap((tag) => {\n const {\n description,\n name,\n type,\n } = tag;\n const typePart = type ? `{${type}} ` : '';\n const imprt = 'import ' + (description ?\n `${typePart}${name} ${description}` :\n `${typePart}${name}`);\n\n const importsExports = parseImportsExports(imprt.trim());\n\n const types = [];\n const namedImports = Object.values(importsExports.namedImports || {})[0]?.[0];\n if (namedImports) {\n if (namedImports.default) {\n types.push(namedImports.default);\n }\n\n if (namedImports.names) {\n types.push(...Object.keys(namedImports.names));\n }\n }\n\n const namespaceImports = Object.values(importsExports.namespaceImports || {})[0]?.[0];\n if (namespaceImports) {\n if (namespaceImports.namespace) {\n types.push(namespaceImports.namespace);\n }\n\n if (namespaceImports.default) {\n types.push(namespaceImports.default);\n }\n }\n\n return types;\n }).filter(Boolean)) : [];\n\n const ancestorNodes = [];\n\n let currentNode = node;\n // No need for Program node?\n while (currentNode?.parent) {\n ancestorNodes.push(currentNode);\n currentNode = currentNode.parent;\n }\n\n /**\n * @param {import('eslint').Rule.Node} ancestorNode\n * @returns {import('comment-parser').Spec[]}\n */\n const getTemplateTags = function (ancestorNode) {\n const commentNode = getJSDocComment(sourceCode, ancestorNode, settings);\n if (!commentNode) {\n return [];\n }\n\n const jsdc = parseComment(commentNode, '');\n\n return jsdc.tags.filter((tag) => {\n return tag.tag === 'template';\n });\n };\n\n // `currentScope` may be `null` or `Program`, so in such a case,\n // we look to present tags instead\n const templateTags = ancestorNodes.length ?\n ancestorNodes.flatMap((ancestorNode) => {\n return getTemplateTags(ancestorNode);\n }) :\n // We err on the side of being too aggressive; checking only\n // present tags is not sufficient\n comments.flatMap((doc) => {\n return doc.tags.filter(({\n tag,\n }) => {\n return tag === 'template';\n });\n });\n\n const closureGenericTypes = templateTags.flatMap((tag) => {\n return utils.parseClosureTemplateTag(tag);\n });\n\n // In modules, including Node, there is a global scope at top with the\n // Program scope inside\n const cjsOrESMScope = globalScope.childScopes[0]?.block?.type === 'Program';\n\n /**\n * @param {import(\"eslint\").Scope.Scope | null} scope\n * @returns {Set<string>}\n */\n const getValidRuntimeIdentifiers = (scope) => {\n const result = new Set();\n\n let scp = scope;\n\n /**\n * @param {import(\"eslint\").Scope.Scope | null} sc\n */\n const getChildScopes = (sc) => {\n if (sc) {\n // We must check child scopes because when multiple nodes find\n // the same comment block, only one node is reported by our code,\n // and it can be the children which are not reported.\n for (const childScope of sc.childScopes) {\n for (const {\n name,\n } of childScope.variables) {\n result.add(name);\n }\n\n for (const grandChildScope of childScope.childScopes) {\n getChildScopes(grandChildScope);\n }\n }\n }\n };\n\n getChildScopes(scp);\n\n while (scp) {\n for (const {\n name,\n } of scp.variables) {\n result.add(name);\n }\n\n scp = scp.upper;\n }\n\n return result;\n };\n\n /**\n * Recursively extracts types from a namespace declaration.\n * @param {string} prefix - The namespace prefix (e.g., \"MyNamespace\" or \"Outer.Inner\").\n * @param {import('@typescript-eslint/types').TSESTree.TSModuleDeclaration} moduleDeclaration - The module declaration node.\n * @returns {string[]} Array of fully qualified type names.\n */\n const getNamespaceTypes = (prefix, moduleDeclaration) => {\n /* c8 ignore next 3 -- Guard for ambient modules without body. */\n if (!moduleDeclaration.body || moduleDeclaration.body.type !== 'TSModuleBlock') {\n return [];\n }\n\n return moduleDeclaration.body.body.flatMap((item) => {\n /** @type {import('@typescript-eslint/types').TSESTree.ProgramStatement | import('@typescript-eslint/types').TSESTree.NamedExportDeclarations | null} */\n let declaration = item;\n\n if (item.type === 'ExportNamedDeclaration' && item.declaration) {\n declaration = item.declaration;\n }\n\n if (declaration.type === 'TSTypeAliasDeclaration' || declaration.type === 'ClassDeclaration') {\n /* c8 ignore next 4 -- Guard for anonymous class declarations. */\n if (!declaration.id) {\n return [];\n }\n\n return [\n `${prefix}.${declaration.id.name}`,\n ];\n }\n\n if (declaration.type === 'TSInterfaceDeclaration') {\n return [\n `${prefix}.${declaration.id.name}`,\n ...declaration.body.body.map((prop) => {\n // Only `TSPropertySignature` and `TSMethodSignature` have 'key'.\n if (prop.type !== 'TSPropertySignature' && prop.type !== 'TSMethodSignature') {\n return '';\n }\n\n // Key can be computed or a literal, only handle Identifier.\n if (prop.key.type !== 'Identifier') {\n return '';\n }\n\n const propName = prop.key.name;\n /* c8 ignore next -- `propName` is always truthy for Identifiers. */\n return propName ? `${prefix}.${declaration.id.name}.${propName}` : '';\n }).filter(Boolean),\n ];\n }\n\n // Handle nested namespaces.\n if (declaration.type === 'TSModuleDeclaration') {\n /* c8 ignore next -- Nested string-literal modules aren't valid TS syntax. */\n const nestedName = declaration.id?.type === 'Identifier' ? declaration.id.name : '';\n /* c8 ignore next 3 -- Guard. */\n if (!nestedName) {\n return [];\n }\n\n return [\n `${prefix}.${nestedName}`,\n ...getNamespaceTypes(`${prefix}.${nestedName}`, declaration),\n ];\n }\n\n // Fallback for unhandled declaration types (e.g., TSEnumDeclaration, FunctionDeclaration, etc.).\n return [];\n });\n };\n\n /**\n * We treat imports differently as we can't introspect their children.\n * @type {string[]}\n */\n const imports = [];\n\n /** @type {Set<string>} */\n const closedTypes = new Set();\n\n const tsModuleVariables = scopeManager.scopes.filter(({\n type,\n }) => {\n // @ts-expect-error TS\n return type === 'tsModule';\n }).flatMap(({\n variables,\n }) => {\n return variables.map(({\n name,\n }) => {\n return name;\n });\n });\n\n const allDefinedTypes = new Set(globalScope.variables.map(({\n name,\n }) => {\n return name;\n })\n\n // If the file is a module, concat the variables from the module scope.\n .concat(\n cjsOrESMScope ?\n globalScope.childScopes.flatMap(({\n variables,\n }) => {\n return variables;\n }).flatMap(({\n identifiers,\n name,\n }) => {\n const globalItem = /** @type {import('estree').Identifier & {parent: import('@typescript-eslint/types').TSESTree.Node}} */ (\n identifiers?.[0]\n )?.parent;\n switch (globalItem?.type) {\n case 'ClassDeclaration':\n closedTypes.add(name);\n return [\n name,\n ...globalItem.body.body.map((item) => {\n const property = /** @type {import('@typescript-eslint/types').TSESTree.Identifier} */ (\n /** @type {import('@typescript-eslint/types').TSESTree.PropertyDefinition} */ (\n item)?.key)?.name;\n /* c8 ignore next 3 -- Guard */\n if (!property) {\n return '';\n }\n\n return `${name}.${property}`;\n }).filter(Boolean),\n ];\n case 'ImportDefaultSpecifier':\n case 'ImportNamespaceSpecifier':\n case 'ImportSpecifier':\n imports.push(name);\n break;\n case 'TSInterfaceDeclaration':\n return [\n name,\n ...globalItem.body.body.map((item) => {\n const property = /** @type {import('@typescript-eslint/types').TSESTree.Identifier} */ (\n /** @type {import('@typescript-eslint/types').TSESTree.TSPropertySignature} */ (\n item)?.key)?.name;\n /* c8 ignore next 3 -- Guard */\n if (!property) {\n return '';\n }\n\n return `${name}.${property}`;\n }).filter(Boolean),\n ];\n case 'TSModuleDeclaration':\n closedTypes.add(name);\n return [\n name,\n ...getNamespaceTypes(name, globalItem),\n ];\n case 'VariableDeclarator':\n if (/** @type {import('@typescript-eslint/types').TSESTree.Identifier} */ (\n /** @type {import('@typescript-eslint/types').TSESTree.CallExpression} */ (\n globalItem?.init\n )?.callee)?.name === 'require'\n ) {\n imports.push(/** @type {import('@typescript-eslint/types').TSESTree.Identifier} */ (\n globalItem.id\n ).name);\n break;\n }\n\n // Module scope names are also defined\n return [\n name,\n ];\n }\n\n return [\n name,\n ];\n /* c8 ignore next */\n }) : [],\n )\n .concat(extraTypes)\n .concat(typedefDeclarations)\n .concat(importTags)\n .concat(definedTypes)\n .concat(tsModuleVariables)\n .concat(/** @type {string[]} */ (definedPreferredTypes))\n .concat((() => {\n // Other methods are not in scope, but we need them, and we grab them here\n if (node?.type === 'MethodDefinition') {\n return /** @type {import('estree').ClassBody} */ (node.parent).body.flatMap((methodOrProp) => {\n if (methodOrProp.type === 'MethodDefinition') {\n // eslint-disable-next-line unicorn/no-lonely-if -- Pattern\n if (methodOrProp.key.type === 'Identifier') {\n return [\n methodOrProp.key.name,\n `${/** @type {import('estree').ClassDeclaration} */ (\n node.parent?.parent\n )?.id?.name}.${methodOrProp.key.name}`,\n ];\n }\n }\n\n if (methodOrProp.type === 'PropertyDefinition') {\n // eslint-disable-next-line unicorn/no-lonely-if -- Pattern\n if (methodOrProp.key.type === 'Identifier') {\n return [\n methodOrProp.key.name,\n `${/** @type {import('estree').ClassDeclaration} */ (\n node.parent?.parent\n )?.id?.name}.${methodOrProp.key.name}`,\n ];\n }\n }\n /* c8 ignore next 2 -- Not yet built */\n\n return '';\n }).filter(Boolean);\n }\n\n return [];\n })())\n .concat((() => {\n // Detect static property assignments like `MyClass.Prop = ...`\n const programBody = /** @type {import('@typescript-eslint/types').TSESTree.Program} */ (\n sourceCode.ast\n ).body;\n\n return programBody.flatMap((statement) => {\n if (\n statement.type === 'ExpressionStatement' &&\n statement.expression.type === 'AssignmentExpression' &&\n statement.expression.left.type === 'MemberExpression' &&\n statement.expression.left.object.type === 'Identifier' &&\n statement.expression.left.property.type === 'Identifier' &&\n closedTypes.has(statement.expression.left.object.name)\n ) {\n return [\n `${statement.expression.left.object.name}.${statement.expression.left.property.name}`,\n ];\n }\n\n return [];\n });\n })())\n .concat(...getValidRuntimeIdentifiers(node && (\n (sourceCode.getScope &&\n /* c8 ignore next 3 */\n sourceCode.getScope(node)) ||\n // @ts-expect-error ESLint 8\n context.getScope()\n )))\n .concat(\n settings.mode === 'jsdoc' ?\n [] :\n [\n ...settings.mode === 'typescript' ? typescriptGlobals : [],\n ...closureGenericTypes,\n ],\n ));\n\n /**\n * @typedef {{\n * parsedType: import('jsdoc-type-pratt-parser').RootResult;\n * tag: import('comment-parser').Spec|import('@es-joy/jsdoccomment').JsdocInlineTagNoType & {\n * line?: import('../iterateJsdoc.js').Integer\n * }\n * }} TypeAndTagInfo\n */\n\n /**\n * @param {string} propertyName\n * @returns {(tag: (import('@es-joy/jsdoccomment').JsdocInlineTagNoType & {\n * name?: string,\n * type?: string,\n * line?: import('../iterateJsdoc.js').Integer\n * })|import('comment-parser').Spec & {\n * namepathOrURL?: string\n * }\n * ) => undefined|TypeAndTagInfo}\n */\n const tagToParsedType = (propertyName) => {\n return (tag) => {\n try {\n const potentialType = tag[\n /** @type {\"type\"|\"name\"|\"namepathOrURL\"} */ (propertyName)\n ];\n return {\n parsedType: mode === 'permissive' ?\n tryParseType(/** @type {string} */ (potentialType)) :\n parseType(/** @type {string} */ (potentialType), mode),\n tag,\n };\n } catch {\n return undefined;\n }\n };\n };\n\n const typeTags = utils.filterTags(({\n tag,\n }) => {\n return tag !== 'import' && utils.tagMightHaveTypePosition(tag) && (tag !== 'suppress' || settings.mode !== 'closure');\n }).map(tagToParsedType('type'));\n\n const namepathReferencingTags = utils.filterTags(({\n tag,\n }) => {\n return utils.isNamepathReferencingTag(tag);\n }).map(tagToParsedType('name'));\n\n const namepathOrUrlReferencingTags = utils.filterAllTags(({\n tag,\n }) => {\n return utils.isNamepathOrUrlReferencingTag(tag);\n }).map(tagToParsedType('namepathOrURL'));\n\n const definedNamesAndNamepaths = new Set(utils.filterTags(({\n tag,\n }) => {\n return utils.isNameOrNamepathDefiningTag(tag);\n }).map(({\n name,\n }) => {\n return name;\n }));\n\n const tagsWithTypes = /** @type {TypeAndTagInfo[]} */ ([\n ...typeTags,\n ...namepathReferencingTags,\n ...namepathOrUrlReferencingTags,\n // Remove types which failed to parse\n ].filter(Boolean));\n\n for (const {\n parsedType,\n tag,\n } of tagsWithTypes) {\n // eslint-disable-next-line complexity -- Refactor\n traverse(parsedType, (nde, parentNode) => {\n /**\n * @type {import('jsdoc-type-pratt-parser').NameResult & {\n * _parent?: import('jsdoc-type-pratt-parser').NonRootResult\n * }}\n */\n // eslint-disable-next-line canonical/id-match -- Avoid clashes\n (nde)._parent = parentNode;\n const {\n type,\n value,\n } = /** @type {import('jsdoc-type-pratt-parser').NameResult} */ (nde);\n\n let val = value;\n\n /** @type {import('jsdoc-type-pratt-parser').NonRootResult|undefined} */\n let currNode = nde;\n do {\n currNode =\n /**\n * @type {import('jsdoc-type-pratt-parser').NameResult & {\n * _parent?: import('jsdoc-type-pratt-parser').NonRootResult\n * }}\n */ (currNode)._parent;\n if (\n // Avoid appending for imports and globals since we don't want to\n // check their properties which may or may not exist\n !imports.includes(val) && !globals.includes(val) &&\n !importTags.includes(val) &&\n !extraTypes.includes(val) &&\n !typedefDeclarations.includes(val) &&\n !globalTypes.includes(val) &&\n currNode && 'right' in currNode &&\n currNode.right?.type === 'JsdocTypeProperty'\n ) {\n val = val + '.' + currNode.right.value;\n }\n } while (currNode?.type === 'JsdocTypeNamePath');\n\n if (type === 'JsdocTypeName') {\n const structuredTypes = structuredTags[tag.tag]?.type;\n const rootNamespace = val.split('.')[0];\n const isNamespaceValid = (definedTypes.includes(rootNamespace) || allDefinedTypes.has(rootNamespace)) &&\n !closedTypes.has(rootNamespace);\n\n if (!allDefinedTypes.has(val) &&\n !definedNamesAndNamepaths.has(val) &&\n (!Array.isArray(structuredTypes) || !structuredTypes.includes(val)) && !isNamespaceValid\n ) {\n const parent =\n /**\n * @type {import('jsdoc-type-pratt-parser').RootResult & {\n * _parent?: import('jsdoc-type-pratt-parser').NonRootResult\n * }}\n */ (nde)._parent;\n if (parent?.type === 'JsdocTypeTypeParameter') {\n return;\n }\n\n if (parent?.type === 'JsdocTypeFunction' &&\n /** @type {import('jsdoc-type-pratt-parser').FunctionResult} */\n (parent)?.typeParameters?.some((typeParam) => {\n return value === typeParam.name.value;\n })\n ) {\n return;\n }\n\n if (parent?.type === 'JsdocTypeInfer' && value === parent.element.value) {\n allDefinedTypes.add(value);\n return;\n }\n\n if (!disableReporting) {\n report(`The type '${val}' is undefined.`, null, tag);\n }\n } else if (markVariablesAsUsed && !extraTypes.includes(val)) {\n if (sourceCode.markVariableAsUsed) {\n sourceCode.markVariableAsUsed(val);\n /* c8 ignore next 4 */\n } else {\n // @ts-expect-error ESLint 8\n context.markVariableAsUsed(val);\n }\n }\n\n if (checkUsedTypedefs && typedefDeclarations.includes(val)) {\n foundTypedefValues.push(val);\n }\n }\n });\n }\n\n state.foundTypedefValues = foundTypedefValues;\n}, {\n // We use this method rather than checking at end of handler above because\n // in that case, it is invoked too many times and would thus report errors\n // too many times.\n exit ({\n context,\n state,\n utils,\n }) {\n const {\n checkUsedTypedefs = false,\n } = context.options[0] || {};\n\n if (!checkUsedTypedefs) {\n return;\n }\n\n const allComments = context.sourceCode.getAllComments();\n const comments = allComments\n .filter((comment) => {\n return (/^\\*(?!\\*)/v).test(comment.value);\n })\n .map((commentNode) => {\n return {\n doc: parseComment(commentNode, ''),\n loc: commentNode.loc,\n };\n });\n const typedefs = comments\n .flatMap(({\n doc,\n loc,\n }) => {\n const tags = doc.tags.filter(({\n tag,\n }) => {\n return utils.isNameOrNamepathDefiningTag(tag);\n });\n if (!tags.length) {\n return [];\n }\n\n return {\n loc,\n tags,\n };\n });\n\n for (const typedef of typedefs) {\n if (\n !state.foundTypedefValues.includes(typedef.tags[0].name)\n ) {\n context.report({\n loc: /** @type {import('@eslint/core').SourceLocation} */ (typedef.loc),\n message: 'This typedef was not used within the file',\n });\n }\n }\n },\n iterateAllJsdocs: true,\n meta: {\n docs: {\n description: 'Besides some expected built-in types, prohibits any types not specified as globals or within `@typedef`.',\n url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/no-undefined-types.md#repos-sticky-header',\n },\n schema: [\n {\n additionalProperties: false,\n properties: {\n checkUsedTypedefs: {\n description: 'Whether to check typedefs for use within the file',\n type: 'boolean',\n },\n definedTypes: {\n description: `This array can be populated to indicate other types which\nare automatically considered as defined (in addition to globals, etc.).\nDefaults to an empty array.`,\n items: {\n type: 'string',\n },\n type: 'array',\n },\n disableReporting: {\n description: `Whether to disable reporting of errors. Defaults to\n\\`false\\`. This may be set to \\`true\\` in order to take advantage of only\nmarking defined variables as used or checking used typedefs.`,\n type: 'boolean',\n },\n markVariablesAsUsed: {\n description: `Whether to mark variables as used for the purposes\nof the \\`no-unused-vars\\` rule when they are not found to be undefined.\nDefaults to \\`true\\`. May be set to \\`false\\` to enforce a practice of not\nimporting types unless used in code.`,\n type: 'boolean',\n },\n },\n type: 'object',\n },\n ],\n type: 'suggestion',\n },\n});\n"],"mappings":"AAAA,OAAO,YAAY,IACjB,YAAY,QACP,oBAAoB;AAC3B,SACE,+BAA+B,EAC/B,qBAAqB,QAChB,kBAAkB;AACzB,SACE,eAAe,EACf,KAAK,IAAI,SAAS,EAClB,QAAQ,EACR,QAAQ,IAAI,YAAY,QACnB,sBAAsB;AAC7B,SACE,mBAAmB,QACd,uBAAuB;AAE9B,MAAM,UAAU,GAAG,CACjB,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAC1D,UAAU,EAAE,QAAQ,EACpB,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,UAAU,EACrC,KAAK,EAAE,GAAG,EAAE,OAAO,EAAE,SAAS,EAAE,OAAO,EACvC,MAAM,EAAE,MAAM,EAAE,OAAO,EACvB,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,CACxD;AAED,MAAM,WAAW,GAAG,CAClB,YAAY,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,CACzC;AAED,MAAM,gBAAgB,GAAG,CACvB,UAAU,EACV,UAAU,EACV,gBAAgB,CACjB;AAED,MAAM,iBAAiB,GAAG,CACxB,GAAG,gBAAgB;AAEnB;AACA,SAAS,EACT,SAAS,EACT,UAAU,EACV,UAAU,EACV,QAAQ,EACR,MAAM,EACN,MAAM,EACN,SAAS,EACT,SAAS,EACT,aAAa,EACb,YAAY,EACZ,uBAAuB,EACvB,YAAY,EACZ,cAAc,EACd,mBAAmB,EACnB,mBAAmB,EACnB,UAAU,EACV,WAAW,EACX,WAAW,EACX,YAAY,EACZ,cAAc,CACf;;AAED;AACA;AACA;AACA;AACA,MAAM,gBAAgB,GAAI,GA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,CAAC,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"noUndefinedTypes.cjs","names":["iterateJsdoc","getJSDocCommentBlocks","getDocumentNamepathDefiningTags","parseImportsExports","getJSDocComment","parseComment","tryParseType","parseType","traverse"],"sources":["../../src/rules/noUndefinedTypes.js"],"sourcesContent":["import iterateJsdoc, {\n parseComment,\n} from '../iterateJsdoc.js';\nimport {\n getDocumentNamepathDefiningTags,\n getJSDocCommentBlocks,\n} from '../jsdocUtils.js';\nimport {\n getJSDocComment,\n parse as parseType,\n traverse,\n tryParse as tryParseType,\n} from '@es-joy/jsdoccomment';\nimport {\n parseImportsExports,\n} from 'parse-imports-exports';\n\nconst extraTypes = [\n 'null', 'undefined', 'void', 'string', 'boolean', 'object',\n 'function', 'symbol',\n 'number', 'bigint', 'NaN', 'Infinity',\n 'any', '*', 'never', 'unknown', 'const',\n 'this', 'true', 'false',\n 'Array', 'Object', 'RegExp', 'Date', 'Function', 'Intl',\n];\n\nconst globalTypes = [\n 'globalThis', 'global', 'window', 'self',\n];\n\nconst iterableIterator = [\n 'Iterable',\n 'Iterator',\n 'IteratorObject',\n];\n\nconst typescriptGlobals = [\n ...iterableIterator,\n\n // https://www.typescriptlang.org/docs/handbook/utility-types.html\n 'Awaited',\n 'Partial',\n 'Required',\n 'Readonly',\n 'Record',\n 'Pick',\n 'Omit',\n 'Exclude',\n 'Extract',\n 'NonNullable',\n 'Parameters',\n 'ConstructorParameters',\n 'ReturnType',\n 'InstanceType',\n 'ThisParameterType',\n 'OmitThisParameter',\n 'ThisType',\n 'Uppercase',\n 'Lowercase',\n 'Capitalize',\n 'Uncapitalize',\n];\n\n/**\n * @param {string|false|undefined} [str]\n * @returns {undefined|string|false}\n */\nconst stripPseudoTypes = (str) => {\n return str && str.replace(/(?:\\.|<>|\\.<>|\\[\\])$/v, '');\n};\n\nexport default iterateJsdoc(({\n context,\n node,\n report,\n settings,\n sourceCode,\n state,\n utils,\n}) => {\n /** @type {string[]} */\n const foundTypedefValues = [];\n\n const {\n scopeManager,\n } = sourceCode;\n\n // When is this ever `null`?\n const globalScope = /** @type {import('eslint').Scope.Scope} */ (\n scopeManager.globalScope\n );\n\n const\n /**\n * @type {{\n * checkUsedTypedefs: boolean\n * definedTypes: string[],\n * disableReporting: boolean,\n * markVariablesAsUsed: boolean,\n * }}\n */ {\n checkUsedTypedefs = false,\n definedTypes = [],\n disableReporting = false,\n markVariablesAsUsed = true,\n } = context.options[0] || {};\n\n /** @type {(string|undefined)[]} */\n let definedPreferredTypes = [];\n const {\n mode,\n preferredTypes,\n structuredTags,\n } = settings;\n if (Object.keys(preferredTypes).length) {\n definedPreferredTypes = /** @type {string[]} */ (Object.values(preferredTypes).map((preferredType) => {\n if (typeof preferredType === 'string') {\n // May become an empty string but will be filtered out below\n return stripPseudoTypes(preferredType);\n }\n\n if (!preferredType) {\n return undefined;\n }\n\n if (typeof preferredType !== 'object') {\n utils.reportSettings(\n 'Invalid `settings.jsdoc.preferredTypes`. Values must be falsy, a string, or an object.',\n );\n }\n\n return stripPseudoTypes(preferredType.replacement);\n })\n .filter(Boolean));\n }\n\n const allComments = sourceCode.getAllComments();\n const comments = getJSDocCommentBlocks(sourceCode);\n\n const globals = allComments\n .filter((comment) => {\n return (/^\\s*globals/v).test(comment.value);\n }).flatMap((commentNode) => {\n return commentNode.value.replace(/^\\s*globals/v, '').trim().split(/,\\s*/v);\n }).concat(Object.keys(context.languageOptions.globals ?? []));\n\n const typedefs = getDocumentNamepathDefiningTags(sourceCode);\n\n const typedefDeclarations = typedefs\n .map((tag) => {\n return tag.name;\n });\n\n const importTags = settings.mode === 'typescript' ? /** @type {string[]} */ (comments.flatMap((doc) => {\n return doc.tags.filter(({\n tag,\n }) => {\n return tag === 'import';\n });\n }).flatMap((tag) => {\n const {\n description,\n name,\n type,\n } = tag;\n const typePart = type ? `{${type}} ` : '';\n const imprt = 'import ' + (description ?\n `${typePart}${name} ${description}` :\n `${typePart}${name}`);\n\n const importsExports = parseImportsExports(imprt.trim());\n\n const types = [];\n const namedImports = Object.values(importsExports.namedImports || {})[0]?.[0];\n if (namedImports) {\n if (namedImports.default) {\n types.push(namedImports.default);\n }\n\n if (namedImports.names) {\n types.push(...Object.keys(namedImports.names));\n }\n }\n\n const namespaceImports = Object.values(importsExports.namespaceImports || {})[0]?.[0];\n if (namespaceImports) {\n if (namespaceImports.namespace) {\n types.push(namespaceImports.namespace);\n }\n\n if (namespaceImports.default) {\n types.push(namespaceImports.default);\n }\n }\n\n return types;\n }).filter(Boolean)) : [];\n\n const ancestorNodes = [];\n\n let currentNode = node;\n // No need for Program node?\n while (currentNode?.parent) {\n ancestorNodes.push(currentNode);\n currentNode = currentNode.parent;\n }\n\n /**\n * @param {import('eslint').Rule.Node} ancestorNode\n * @returns {import('comment-parser').Spec[]}\n */\n const getTemplateTags = function (ancestorNode) {\n const commentNode = getJSDocComment(sourceCode, ancestorNode, settings);\n if (!commentNode) {\n return [];\n }\n\n const jsdc = parseComment(commentNode, '');\n\n return jsdc.tags.filter((tag) => {\n return tag.tag === 'template';\n });\n };\n\n // `currentScope` may be `null` or `Program`, so in such a case,\n // we look to present tags instead\n const templateTags = ancestorNodes.length ?\n ancestorNodes.flatMap((ancestorNode) => {\n return getTemplateTags(ancestorNode);\n }) :\n // We err on the side of being too aggressive; checking only\n // present tags is not sufficient\n comments.flatMap((doc) => {\n return doc.tags.filter(({\n tag,\n }) => {\n return tag === 'template';\n });\n });\n\n const closureGenericTypes = templateTags.flatMap((tag) => {\n return utils.parseClosureTemplateTag(tag);\n });\n\n // In modules, including Node, there is a global scope at top with the\n // Program scope inside\n const cjsOrESMScope = globalScope.childScopes[0]?.block?.type === 'Program';\n\n /**\n * @param {import(\"eslint\").Scope.Scope | null} scope\n * @returns {Set<string>}\n */\n const getValidRuntimeIdentifiers = (scope) => {\n const result = new Set();\n\n let scp = scope;\n\n /**\n * @param {import(\"eslint\").Scope.Scope | null} sc\n */\n const getChildScopes = (sc) => {\n if (sc) {\n // We must check child scopes because when multiple nodes find\n // the same comment block, only one node is reported by our code,\n // and it can be the children which are not reported.\n for (const childScope of sc.childScopes) {\n for (const {\n name,\n } of childScope.variables) {\n result.add(name);\n }\n\n for (const grandChildScope of childScope.childScopes) {\n getChildScopes(grandChildScope);\n }\n }\n }\n };\n\n getChildScopes(scp);\n\n while (scp) {\n for (const {\n name,\n } of scp.variables) {\n result.add(name);\n }\n\n scp = scp.upper;\n }\n\n return result;\n };\n\n /**\n * Recursively extracts types from a namespace declaration.\n * @param {string} prefix - The namespace prefix (e.g., \"MyNamespace\" or \"Outer.Inner\").\n * @param {import('@typescript-eslint/types').TSESTree.TSModuleDeclaration} moduleDeclaration - The module declaration node.\n * @returns {string[]} Array of fully qualified type names.\n */\n const getNamespaceTypes = (prefix, moduleDeclaration) => {\n /* c8 ignore next 3 -- Guard for ambient modules without body. */\n if (!moduleDeclaration.body || moduleDeclaration.body.type !== 'TSModuleBlock') {\n return [];\n }\n\n return moduleDeclaration.body.body.flatMap((item) => {\n /** @type {import('@typescript-eslint/types').TSESTree.ProgramStatement | import('@typescript-eslint/types').TSESTree.NamedExportDeclarations | null} */\n let declaration = item;\n\n if (item.type === 'ExportNamedDeclaration' && item.declaration) {\n declaration = item.declaration;\n }\n\n if (declaration.type === 'TSTypeAliasDeclaration' || declaration.type === 'ClassDeclaration') {\n /* c8 ignore next 4 -- Guard for anonymous class declarations. */\n if (!declaration.id) {\n return [];\n }\n\n return [\n `${prefix}.${declaration.id.name}`,\n ];\n }\n\n if (declaration.type === 'TSInterfaceDeclaration') {\n return [\n `${prefix}.${declaration.id.name}`,\n ...declaration.body.body.map((prop) => {\n // Only `TSPropertySignature` and `TSMethodSignature` have 'key'.\n if (prop.type !== 'TSPropertySignature' && prop.type !== 'TSMethodSignature') {\n return '';\n }\n\n // Key can be computed or a literal, only handle Identifier.\n if (prop.key.type !== 'Identifier') {\n return '';\n }\n\n const propName = prop.key.name;\n /* c8 ignore next -- `propName` is always truthy for Identifiers. */\n return propName ? `${prefix}.${declaration.id.name}.${propName}` : '';\n }).filter(Boolean),\n ];\n }\n\n // Handle nested namespaces.\n if (declaration.type === 'TSModuleDeclaration') {\n /* c8 ignore next -- Nested string-literal modules aren't valid TS syntax. */\n const nestedName = declaration.id?.type === 'Identifier' ? declaration.id.name : '';\n /* c8 ignore next 3 -- Guard. */\n if (!nestedName) {\n return [];\n }\n\n return [\n `${prefix}.${nestedName}`,\n ...getNamespaceTypes(`${prefix}.${nestedName}`, declaration),\n ];\n }\n\n // Fallback for unhandled declaration types (e.g., TSEnumDeclaration, FunctionDeclaration, etc.).\n return [];\n });\n };\n\n /**\n * We treat imports differently as we can't introspect their children.\n * @type {string[]}\n */\n const imports = [];\n\n /** @type {Set<string>} */\n const closedTypes = new Set();\n\n const tsModuleVariables = scopeManager.scopes.filter(({\n type,\n }) => {\n // @ts-expect-error TS\n return type === 'tsModule';\n }).flatMap(({\n variables,\n }) => {\n return variables.map(({\n name,\n }) => {\n return name;\n });\n });\n\n const allDefinedTypes = new Set(globalScope.variables.map(({\n name,\n }) => {\n return name;\n })\n\n // If the file is a module, concat the variables from the module scope.\n .concat(\n cjsOrESMScope ?\n globalScope.childScopes.flatMap(({\n variables,\n }) => {\n return variables;\n }).flatMap(({\n identifiers,\n name,\n }) => {\n const globalItem = /** @type {import('estree').Identifier & {parent: import('@typescript-eslint/types').TSESTree.Node}} */ (\n identifiers?.[0]\n )?.parent;\n switch (globalItem?.type) {\n case 'ClassDeclaration':\n closedTypes.add(name);\n return [\n name,\n ...globalItem.body.body.map((item) => {\n const property = /** @type {import('@typescript-eslint/types').TSESTree.Identifier} */ (\n /** @type {import('@typescript-eslint/types').TSESTree.PropertyDefinition} */ (\n item)?.key)?.name;\n /* c8 ignore next 3 -- Guard */\n if (!property) {\n return '';\n }\n\n return `${name}.${property}`;\n }).filter(Boolean),\n ];\n case 'ImportDefaultSpecifier':\n case 'ImportNamespaceSpecifier':\n case 'ImportSpecifier':\n imports.push(name);\n break;\n case 'TSInterfaceDeclaration':\n return [\n name,\n ...globalItem.body.body.map((item) => {\n const property = /** @type {import('@typescript-eslint/types').TSESTree.Identifier} */ (\n /** @type {import('@typescript-eslint/types').TSESTree.TSPropertySignature} */ (\n item)?.key)?.name;\n /* c8 ignore next 3 -- Guard */\n if (!property) {\n return '';\n }\n\n return `${name}.${property}`;\n }).filter(Boolean),\n ];\n case 'TSModuleDeclaration':\n closedTypes.add(name);\n return [\n name,\n ...getNamespaceTypes(name, globalItem),\n ];\n case 'VariableDeclarator':\n if (/** @type {import('@typescript-eslint/types').TSESTree.Identifier} */ (\n /** @type {import('@typescript-eslint/types').TSESTree.CallExpression} */ (\n globalItem?.init\n )?.callee)?.name === 'require'\n ) {\n imports.push(/** @type {import('@typescript-eslint/types').TSESTree.Identifier} */ (\n globalItem.id\n ).name);\n break;\n }\n\n // Module scope names are also defined\n return [\n name,\n ];\n }\n\n return [\n name,\n ];\n /* c8 ignore next */\n }) : [],\n )\n .concat(extraTypes)\n .concat(typedefDeclarations)\n .concat(importTags)\n .concat(definedTypes)\n .concat(tsModuleVariables)\n .concat(/** @type {string[]} */ (definedPreferredTypes))\n .concat((() => {\n // Other methods are not in scope, but we need them, and we grab them here\n if (node?.type === 'MethodDefinition') {\n return /** @type {import('estree').ClassBody} */ (node.parent).body.flatMap((methodOrProp) => {\n if (methodOrProp.type === 'MethodDefinition') {\n // eslint-disable-next-line unicorn/no-lonely-if -- Pattern\n if (methodOrProp.key.type === 'Identifier') {\n return [\n methodOrProp.key.name,\n `${/** @type {import('estree').ClassDeclaration} */ (\n node.parent?.parent\n )?.id?.name}.${methodOrProp.key.name}`,\n ];\n }\n }\n\n if (methodOrProp.type === 'PropertyDefinition') {\n // eslint-disable-next-line unicorn/no-lonely-if -- Pattern\n if (methodOrProp.key.type === 'Identifier') {\n return [\n methodOrProp.key.name,\n `${/** @type {import('estree').ClassDeclaration} */ (\n node.parent?.parent\n )?.id?.name}.${methodOrProp.key.name}`,\n ];\n }\n }\n /* c8 ignore next 2 -- Not yet built */\n\n return '';\n }).filter(Boolean);\n }\n\n return [];\n })())\n .concat((() => {\n // Detect static property assignments like `MyClass.Prop = ...`\n const programBody = /** @type {import('@typescript-eslint/types').TSESTree.Program} */ (\n sourceCode.ast\n ).body;\n\n return programBody.flatMap((statement) => {\n if (\n statement.type === 'ExpressionStatement' &&\n statement.expression.type === 'AssignmentExpression' &&\n statement.expression.left.type === 'MemberExpression' &&\n statement.expression.left.object.type === 'Identifier' &&\n statement.expression.left.property.type === 'Identifier' &&\n closedTypes.has(statement.expression.left.object.name)\n ) {\n return [\n `${statement.expression.left.object.name}.${statement.expression.left.property.name}`,\n ];\n }\n\n return [];\n });\n })())\n .concat(...getValidRuntimeIdentifiers(node && (\n (sourceCode.getScope &&\n /* c8 ignore next 3 */\n sourceCode.getScope(node)) ||\n // @ts-expect-error ESLint 8\n context.getScope()\n )))\n .concat(\n settings.mode === 'jsdoc' ?\n [] :\n [\n ...settings.mode === 'typescript' ? typescriptGlobals : [],\n ...closureGenericTypes,\n ],\n ));\n\n /**\n * @typedef {{\n * parsedType: import('jsdoc-type-pratt-parser').RootResult;\n * tag: import('comment-parser').Spec|import('@es-joy/jsdoccomment').JsdocInlineTagNoType & {\n * line?: import('../iterateJsdoc.js').Integer\n * }\n * }} TypeAndTagInfo\n */\n\n /**\n * @param {string} propertyName\n * @returns {(tag: (import('@es-joy/jsdoccomment').JsdocInlineTagNoType & {\n * name?: string,\n * type?: string,\n * line?: import('../iterateJsdoc.js').Integer\n * })|import('comment-parser').Spec & {\n * namepathOrURL?: string\n * }\n * ) => undefined|TypeAndTagInfo}\n */\n const tagToParsedType = (propertyName) => {\n return (tag) => {\n try {\n const potentialType = tag[\n /** @type {\"type\"|\"name\"|\"namepathOrURL\"} */ (propertyName)\n ];\n return {\n parsedType: mode === 'permissive' ?\n tryParseType(/** @type {string} */ (potentialType)) :\n parseType(/** @type {string} */ (potentialType), mode),\n tag,\n };\n } catch {\n return undefined;\n }\n };\n };\n\n const typeTags = utils.filterTags(({\n tag,\n }) => {\n return tag !== 'import' && utils.tagMightHaveTypePosition(tag) && (tag !== 'suppress' || settings.mode !== 'closure');\n }).map(tagToParsedType('type'));\n\n const namepathReferencingTags = utils.filterTags(({\n tag,\n }) => {\n return utils.isNamepathReferencingTag(tag);\n }).map(tagToParsedType('name'));\n\n const namepathOrUrlReferencingTags = utils.filterAllTags(({\n tag,\n }) => {\n return utils.isNamepathOrUrlReferencingTag(tag);\n }).map(tagToParsedType('namepathOrURL'));\n\n const definedNamesAndNamepaths = new Set(utils.filterTags(({\n tag,\n }) => {\n return utils.isNameOrNamepathDefiningTag(tag);\n }).map(({\n name,\n }) => {\n return name;\n }));\n\n const tagsWithTypes = /** @type {TypeAndTagInfo[]} */ ([\n ...typeTags,\n ...namepathReferencingTags,\n ...namepathOrUrlReferencingTags,\n // Remove types which failed to parse\n ].filter(Boolean));\n\n for (const {\n parsedType,\n tag,\n } of tagsWithTypes) {\n // eslint-disable-next-line complexity -- Refactor\n traverse(parsedType, (nde, parentNode) => {\n /**\n * @type {import('jsdoc-type-pratt-parser').NameResult & {\n * _parent?: import('jsdoc-type-pratt-parser').NonRootResult\n * }}\n */\n // eslint-disable-next-line canonical/id-match -- Avoid clashes\n (nde)._parent = parentNode;\n const {\n type,\n value,\n } = /** @type {import('jsdoc-type-pratt-parser').NameResult} */ (nde);\n\n let val = value;\n\n /** @type {import('jsdoc-type-pratt-parser').NonRootResult|undefined} */\n let currNode = nde;\n do {\n currNode =\n /**\n * @type {import('jsdoc-type-pratt-parser').NameResult & {\n * _parent?: import('jsdoc-type-pratt-parser').NonRootResult\n * }}\n */ (currNode)._parent;\n if (\n // Avoid appending for imports and globals since we don't want to\n // check their properties which may or may not exist\n !imports.includes(val) && !globals.includes(val) &&\n !importTags.includes(val) &&\n !extraTypes.includes(val) &&\n !typedefDeclarations.includes(val) &&\n !globalTypes.includes(val) &&\n currNode && 'right' in currNode &&\n currNode.right?.type === 'JsdocTypeProperty'\n ) {\n val = val + '.' + currNode.right.value;\n }\n } while (currNode?.type === 'JsdocTypeNamePath');\n\n if (type === 'JsdocTypeName') {\n const structuredTypes = structuredTags[tag.tag]?.type;\n const rootNamespace = val.split('.')[0];\n const isNamespaceValid = (definedTypes.includes(rootNamespace) || allDefinedTypes.has(rootNamespace)) &&\n !closedTypes.has(rootNamespace);\n\n if (!allDefinedTypes.has(val) &&\n !definedNamesAndNamepaths.has(val) &&\n (!Array.isArray(structuredTypes) || !structuredTypes.includes(val)) && !isNamespaceValid\n ) {\n const parent =\n /**\n * @type {import('jsdoc-type-pratt-parser').RootResult & {\n * _parent?: import('jsdoc-type-pratt-parser').NonRootResult\n * }}\n */ (nde)._parent;\n if (parent?.type === 'JsdocTypeTypeParameter') {\n return;\n }\n\n if (parent?.type === 'JsdocTypeFunction' &&\n /** @type {import('jsdoc-type-pratt-parser').FunctionResult} */\n (parent)?.typeParameters?.some((typeParam) => {\n return value === typeParam.name.value;\n })\n ) {\n return;\n }\n\n if (parent?.type === 'JsdocTypeInfer' && value === parent.element.value) {\n allDefinedTypes.add(value);\n return;\n }\n\n if (!disableReporting) {\n report(`The type '${val}' is undefined.`, null, tag);\n }\n } else if (markVariablesAsUsed && !extraTypes.includes(val)) {\n if (sourceCode.markVariableAsUsed) {\n sourceCode.markVariableAsUsed(val);\n /* c8 ignore next 4 */\n } else {\n // @ts-expect-error ESLint 8\n context.markVariableAsUsed(val);\n }\n }\n\n if (checkUsedTypedefs && typedefDeclarations.includes(val)) {\n foundTypedefValues.push(val);\n }\n }\n });\n }\n\n state.foundTypedefValues = foundTypedefValues;\n}, {\n // We use this method rather than checking at end of handler above because\n // in that case, it is invoked too many times and would thus report errors\n // too many times.\n exit ({\n context,\n state,\n utils,\n }) {\n const {\n checkUsedTypedefs = false,\n } = context.options[0] || {};\n\n if (!checkUsedTypedefs) {\n return;\n }\n\n const allComments = context.sourceCode.getAllComments();\n const comments = allComments\n .filter((comment) => {\n return (/^\\*(?!\\*)/v).test(comment.value);\n })\n .map((commentNode) => {\n return {\n doc: parseComment(commentNode, ''),\n loc: commentNode.loc,\n };\n });\n const typedefs = comments\n .flatMap(({\n doc,\n loc,\n }) => {\n const tags = doc.tags.filter(({\n tag,\n }) => {\n return utils.isNameOrNamepathDefiningTag(tag);\n });\n if (!tags.length) {\n return [];\n }\n\n return {\n loc,\n tags,\n };\n });\n\n for (const typedef of typedefs) {\n if (\n !state.foundTypedefValues.includes(typedef.tags[0].name)\n ) {\n context.report({\n loc: /** @type {import('@eslint/core').SourceLocation} */ (typedef.loc),\n message: 'This typedef was not used within the file',\n });\n }\n }\n },\n iterateAllJsdocs: true,\n meta: {\n docs: {\n description: 'Besides some expected built-in types, prohibits any types not specified as globals or within `@typedef`.',\n url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/no-undefined-types.md#repos-sticky-header',\n },\n schema: [\n {\n additionalProperties: false,\n properties: {\n checkUsedTypedefs: {\n description: 'Whether to check typedefs for use within the file',\n type: 'boolean',\n },\n definedTypes: {\n description: `This array can be populated to indicate other types which\nare automatically considered as defined (in addition to globals, etc.).\nDefaults to an empty array.`,\n items: {\n type: 'string',\n },\n type: 'array',\n },\n disableReporting: {\n description: `Whether to disable reporting of errors. Defaults to\n\\`false\\`. This may be set to \\`true\\` in order to take advantage of only\nmarking defined variables as used or checking used typedefs.`,\n type: 'boolean',\n },\n markVariablesAsUsed: {\n description: `Whether to mark variables as used for the purposes\nof the \\`no-unused-vars\\` rule when they are not found to be undefined.\nDefaults to \\`true\\`. May be set to \\`false\\` to enforce a practice of not\nimporting types unless used in code.`,\n type: 'boolean',\n },\n },\n type: 'object',\n },\n ],\n type: 'suggestion',\n },\n});\n"],"mappings":";;;;;;AAAA;AAGA;AAIA;AAMA;AAE+B;AAE/B,MAAM,UAAU,GAAG,CACjB,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAC1D,UAAU,EAAE,QAAQ,EACpB,QAAQ,EAAE,QAAQ,E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AAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,EACxD;QACA,OAAO,CAAC,MAAM,CAAC;UACb,GAAG,GAAE,oDAAsD,OAAO,CAAC,GAAG,CAAC;UACvE,OAAO,EAAE;QACX,CAAC,CAAC;MACJ;IACF;EACF,CAAC;EACD,gBAAgB,EAAE,IAAI;EACtB,IAAI,EAAE;IACJ,IAAI,EAAE;MACJ,WAAW,EAAE,0GAA0G;MACvH,GAAG,EAAE;IACP,CAAC;IACD,MAAM,EAAE,CACN;MACE,oBAAoB,EAAE,KAAK;MAC3B,UAAU,EAAE;QACV,iBAAiB,EAAE;UACjB,WAAW,EAAE,mDAAmD;UAChE,IAAI,EAAE;QACR,CAAC;QACD,YAAY,EAAE;UACZ,WAAW,EAAE;AACzB;AACA,4BAA4B;UAChB,KAAK,EAAE;YACL,IAAI,EAAE;UACR,CAAC;UACD,IAAI,EAAE;QACR,CAAC;QACD,gBAAgB,EAAE;UAChB,WAAW,EAAE;AACzB;AACA,6DAA6D;UACjD,IAAI,EAAE;QACR,CAAC;QACD,mBAAmB,EAAE;UACnB,WAAW,EAAE;AACzB;AACA;AACA,qCAAqC;UACzB,IAAI,EAAE;QACR;MACF,CAAC;MACD,IAAI,EAAE;IACR,CAAC,CACF;IACD,IAAI,EAAE;EACR;AACF,CAAC,CAAC;AAAA","ignoreList":[]}
|
|
@@ -1,12 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _iterateJsdoc = _interopRequireWildcard(require("../iterateJsdoc.cjs"));
|
|
8
|
+
var _jsdoccomment = require("@es-joy/jsdoccomment");
|
|
9
|
+
var _eslint = require("eslint");
|
|
10
|
+
var _parseImportsExports = require("parse-imports-exports");
|
|
11
|
+
var _semver = _interopRequireDefault(require("semver"));
|
|
12
|
+
var _toValidIdentifier = _interopRequireDefault(require("../to-valid-identifier.cjs"));
|
|
13
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
14
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
15
|
+
var _default = exports.default = (0, _iterateJsdoc.default)(({
|
|
10
16
|
context,
|
|
11
17
|
indent,
|
|
12
18
|
jsdoc,
|
|
@@ -26,7 +32,7 @@ export default iterateJsdoc(({
|
|
|
26
32
|
const comments = allComments.filter(comment => {
|
|
27
33
|
return /^\*(?!\*)/v.test(comment.value);
|
|
28
34
|
}).map(commentNode => {
|
|
29
|
-
return commentParserToESTree(parseComment(commentNode, ''), mode === 'permissive' ? 'typescript' : mode);
|
|
35
|
+
return (0, _jsdoccomment.commentParserToESTree)((0, _iterateJsdoc.parseComment)(commentNode, ''), mode === 'permissive' ? 'typescript' : mode);
|
|
30
36
|
});
|
|
31
37
|
const typedefs = comments.flatMap(doc => {
|
|
32
38
|
return doc.tags.filter(({
|
|
@@ -65,7 +71,7 @@ export default iterateJsdoc(({
|
|
|
65
71
|
}
|
|
66
72
|
|
|
67
73
|
// For ESLint < 10, use the simple approach of inserting before programNode
|
|
68
|
-
if (
|
|
74
|
+
if (_semver.default.lt(_eslint.Linter.version, '10.0.0')) {
|
|
69
75
|
return fixer.insertTextBefore(programNode, importText);
|
|
70
76
|
}
|
|
71
77
|
|
|
@@ -90,15 +96,15 @@ export default iterateJsdoc(({
|
|
|
90
96
|
const potentialType = tag.type;
|
|
91
97
|
let parsedType;
|
|
92
98
|
try {
|
|
93
|
-
parsedType = mode === 'permissive' ?
|
|
99
|
+
parsedType = mode === 'permissive' ? (0, _jsdoccomment.tryParse)(/** @type {string} */potentialType) : (0, _jsdoccomment.parse)(/** @type {string} */potentialType, mode);
|
|
94
100
|
} catch {
|
|
95
101
|
return;
|
|
96
102
|
}
|
|
97
|
-
traverse(parsedType, (nde, parentNode) => {
|
|
103
|
+
(0, _jsdoccomment.traverse)(parsedType, (nde, parentNode) => {
|
|
98
104
|
// @ts-expect-error Adding our own property for use below
|
|
99
105
|
nde.parentNode = parentNode;
|
|
100
106
|
});
|
|
101
|
-
traverse(parsedType, nde => {
|
|
107
|
+
(0, _jsdoccomment.traverse)(parsedType, nde => {
|
|
102
108
|
const {
|
|
103
109
|
element,
|
|
104
110
|
type
|
|
@@ -129,7 +135,7 @@ export default iterateJsdoc(({
|
|
|
129
135
|
if (currentNode.type !== 'JsdocTypeNamePath') {
|
|
130
136
|
break;
|
|
131
137
|
}
|
|
132
|
-
pathSegments.unshift(currentNode.right.type === 'JsdocTypeIndexedAccessIndex' ? stringify(currentNode.right.right) : currentNode.right.value);
|
|
138
|
+
pathSegments.unshift(currentNode.right.type === 'JsdocTypeIndexedAccessIndex' ? (0, _jsdoccomment.stringify)(currentNode.right.right) : currentNode.right.value);
|
|
133
139
|
nodes.unshift(currentNode);
|
|
134
140
|
propertyOrBrackets.unshift(currentNode.pathType);
|
|
135
141
|
quotes.unshift(currentNode.right.type === 'JsdocTypeIndexedAccessIndex' ? undefined : currentNode.right.meta.quote);
|
|
@@ -140,7 +146,7 @@ export default iterateJsdoc(({
|
|
|
140
146
|
* @param {string[]} extrPathSegments
|
|
141
147
|
*/
|
|
142
148
|
const getFixer = (name, extrPathSegments) => {
|
|
143
|
-
const matchingName =
|
|
149
|
+
const matchingName = (0, _toValidIdentifier.default)(name);
|
|
144
150
|
return () => {
|
|
145
151
|
/** @type {import('jsdoc-type-pratt-parser').NamePathResult|undefined} */
|
|
146
152
|
let node = nodes.at(0);
|
|
@@ -189,7 +195,7 @@ export default iterateJsdoc(({
|
|
|
189
195
|
}
|
|
190
196
|
for (const src of tag.source) {
|
|
191
197
|
if (src.tokens.type) {
|
|
192
|
-
src.tokens.type = `{${stringify(parsedType)}}`;
|
|
198
|
+
src.tokens.type = `{${(0, _jsdoccomment.stringify)(parsedType)}}`;
|
|
193
199
|
break;
|
|
194
200
|
}
|
|
195
201
|
}
|
|
@@ -213,7 +219,7 @@ export default iterateJsdoc(({
|
|
|
213
219
|
namepathMatch = false;
|
|
214
220
|
break;
|
|
215
221
|
}
|
|
216
|
-
if (typedefNode.right.type === 'JsdocTypeIndexedAccessIndex' && stringify(typedefNode.right.right) !== pathSegment || typedefNode.right.type !== 'JsdocTypeIndexedAccessIndex' && typedefNode.right.value !== pathSegment) {
|
|
222
|
+
if (typedefNode.right.type === 'JsdocTypeIndexedAccessIndex' && (0, _jsdoccomment.stringify)(typedefNode.right.right) !== pathSegment || typedefNode.right.type !== 'JsdocTypeIndexedAccessIndex' && typedefNode.right.value !== pathSegment) {
|
|
217
223
|
if (namepathMatch === true) {
|
|
218
224
|
// It stopped matching, so stop
|
|
219
225
|
break;
|
|
@@ -241,7 +247,7 @@ export default iterateJsdoc(({
|
|
|
241
247
|
}
|
|
242
248
|
const findMatchingImport = () => {
|
|
243
249
|
for (const imprt of imports) {
|
|
244
|
-
const parsedImport = parseImportsExports(estreeToString(imprt).replace(/^\s*@/v, '').trim());
|
|
250
|
+
const parsedImport = (0, _parseImportsExports.parseImportsExports)((0, _jsdoccomment.estreeToString)(imprt).replace(/^\s*@/v, '').trim());
|
|
245
251
|
const namedImportsModuleSpecifier = Object.keys(parsedImport.namedImports || {})[0];
|
|
246
252
|
const namedImports = Object.values(parsedImport.namedImports || {})[0]?.[0];
|
|
247
253
|
const namedImportNames = (namedImports && namedImports.names && Object.keys(namedImports.names)) ?? [];
|
|
@@ -289,7 +295,7 @@ export default iterateJsdoc(({
|
|
|
289
295
|
if (!pathSegments.length) {
|
|
290
296
|
utils.reportJSDoc('Inline `import()` found; prefer `@import`', tag, enableFixer ? fixer => {
|
|
291
297
|
getFixer(element.value, [])();
|
|
292
|
-
return createImportInserter(`/** @import * as ${
|
|
298
|
+
return createImportInserter(`/** @import * as ${(0, _toValidIdentifier.default)(element.value)} from '${element.value}'; */`)(fixer);
|
|
293
299
|
} : null);
|
|
294
300
|
return;
|
|
295
301
|
}
|
|
@@ -307,7 +313,7 @@ export default iterateJsdoc(({
|
|
|
307
313
|
} else {
|
|
308
314
|
getFixer(/** @type {string} */pathSegments.at(-1), pathSegments.slice(0, -1))();
|
|
309
315
|
}
|
|
310
|
-
const importText = outputType === 'namespaced-import' ? `/** @import * as ${
|
|
316
|
+
const importText = outputType === 'namespaced-import' ? `/** @import * as ${(0, _toValidIdentifier.default)(element.value)} from '${element.value}'; */` : `/** @import { ${(0, _toValidIdentifier.default)(/* c8 ignore next -- TS */
|
|
311
317
|
pathSegments.at(-1) ?? '')} } from '${element.value}'; */`;
|
|
312
318
|
return createImportInserter(importText)(fixer);
|
|
313
319
|
} : null);
|
|
@@ -352,4 +358,5 @@ export default iterateJsdoc(({
|
|
|
352
358
|
type: 'suggestion'
|
|
353
359
|
}
|
|
354
360
|
});
|
|
361
|
+
module.exports = exports.default;
|
|
355
362
|
//# sourceMappingURL=preferImportTag.cjs.map
|