{"version":3,"file":"requireTags.cjs","names":["_buildForbidRuleDefinition","require","_default","exports","default","buildForbidRuleDefinition","description","getContexts","context","report","options","contexts","modifyContext","tags","cntxts","map","tag","tagName","comment","message","propertyDescriptors","Object","getOwnPropertyDescriptors","create","getPrototypeOf","value","schema","additionalProperties","properties","items","anyOf","type","url","module"],"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  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