"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _iterateJsdoc = _interopRequireDefault(require("../iterateJsdoc"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

const defaultEmptyTags = ['abstract', 'async', 'generator', 'global', 'hideconstructor', 'ignore', 'inheritdoc', 'inner', 'instance', 'override', 'readonly'];
const emptyIfNotClosure = ['package', 'private', 'protected', 'public', 'static'];

var _default = (0, _iterateJsdoc.default)(({
  settings,
  jsdoc,
  utils
}) => {
  if (!jsdoc.tags) {
    return;
  }

  const emptyTags = utils.filterTags(({
    tag: tagName
  }) => {
    return defaultEmptyTags.includes(tagName) || utils.hasOptionTag(tagName) && jsdoc.tags.some(({
      tag
    }) => {
      return tag === tagName;
    }) || settings.mode !== 'closure' && emptyIfNotClosure.includes(tagName);
  });
  emptyTags.forEach(tag => {
    const fix = () => {
      tag.name = '';
      tag.description = '';
      tag.type = '';
      tag.optional = false;
      tag.default = undefined;
    };

    const content = tag.name || tag.description || tag.type;

    if (content) {
      utils.reportJSDoc(`@${tag.tag} should be empty.`, tag, fix);
    }
  });
}, {
  checkPrivate: true,
  iterateAllJsdocs: true,
  meta: {
    fixable: 'code',
    schema: [{
      additionalProperties: false,
      properties: {
        tags: {
          items: {
            type: 'string'
          },
          type: 'array'
        }
      },
      type: 'object'
    }],
    type: 'suggestion'
  }
});

exports.default = _default;
module.exports = exports.default;
//# sourceMappingURL=emptyTags.js.map