requireParamName.js 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.default = void 0;
  6. var _iterateJsdoc = _interopRequireDefault(require("../iterateJsdoc.js"));
  7. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  8. var _default = exports.default = (0, _iterateJsdoc.default)(({
  9. report,
  10. utils
  11. }) => {
  12. utils.forEachPreferredTag('param', (jsdocParameter, targetTagName) => {
  13. if (jsdocParameter.tag && jsdocParameter.name === '') {
  14. report(`There must be an identifier after @${targetTagName} ${jsdocParameter.type === '' ? 'type' : 'tag'}.`, null, jsdocParameter);
  15. }
  16. });
  17. }, {
  18. contextDefaults: true,
  19. meta: {
  20. docs: {
  21. description: 'Requires that all function parameters have names.',
  22. url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/require-param-name.md#repos-sticky-header'
  23. },
  24. schema: [{
  25. additionalProperties: false,
  26. properties: {
  27. contexts: {
  28. items: {
  29. anyOf: [{
  30. type: 'string'
  31. }, {
  32. additionalProperties: false,
  33. properties: {
  34. comment: {
  35. type: 'string'
  36. },
  37. context: {
  38. type: 'string'
  39. }
  40. },
  41. type: 'object'
  42. }]
  43. },
  44. type: 'array'
  45. }
  46. },
  47. type: 'object'
  48. }],
  49. type: 'suggestion'
  50. }
  51. });
  52. module.exports = exports.default;
  53. //# sourceMappingURL=requireParamName.js.map