{"version":3,"file":"requireTags.cjs","names":["buildForbidRuleDefinition"],"sources":["../../src/rules/requireTags.js"],"sourcesContent":["import {\n  buildForbidRuleDefinition,\n} from '../buildForbidRuleDefinition.js';\n\nexport default buildForbidRuleDefinition({\n  description: 'Requires tags be present, optionally for specific contexts',\n  getContexts (context, report) {\n    // Transformed options to this option in `modifyContext`:\n    if (!context.options[0].contexts) {\n      report('Rule `require-tags` is missing a `tags` option.');\n      return false;\n    }\n\n    const {\n      contexts,\n    } = context.options[0];\n\n    return contexts;\n  },\n  modifyContext (context) {\n    const tags = /** @type {(string|{tag: string, context: string})[]} */ (\n      context.options?.[0]?.tags\n    );\n\n    const cntxts = tags?.map((tag) => {\n      const tagName = typeof tag === 'string' ? tag : tag.tag;\n      return {\n        comment: `JsdocBlock:not(*:has(JsdocTag[tag=${\n          tagName\n        }]))`,\n        context: typeof tag === 'string' ? 'any' : tag.context,\n        message: `Missing required tag \"${tagName}\"`,\n      };\n    });\n\n    // Reproduce context object with our own `contexts`\n    const propertyDescriptors = Object.getOwnPropertyDescriptors(context);\n    return Object.create(\n      Object.getPrototypeOf(context),\n      {\n        ...propertyDescriptors,\n        options: {\n          ...propertyDescriptors.options,\n          value: [\n            {\n              contexts: cntxts,\n            },\n          ],\n        },\n      },\n    );\n  },\n  schema: [\n    {\n      additionalProperties: false,\n      properties: {\n        tags: {\n          description: `May be an array of either strings or objects with\na string \\`tag\\` property and \\`context\\` string property.`,\n          items: {\n            anyOf: [\n              {\n                type: 'string',\n              },\n              {\n                properties: {\n                  context: {\n                    type: 'string',\n                  },\n                  tag: {\n                    type: 'string',\n                  },\n                },\n                type: 'object',\n              },\n            ],\n          },\n          type: 'array',\n        },\n      },\n      type: 'object',\n    },\n  ],\n  url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/require-tags.md#repos-sticky-header',\n});\n"],"mappings":";;;;;;AAAA;AAEyC,iCAE1B,IAAAA,2BAAA,yBAAyB,EAAC;EACvC,WAAW,EAAE,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