Software zum Installieren eines Smart-Mirror Frameworks , zum Nutzen von hochschulrelevanten Informationen, auf einem Raspberry-Pi.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

requireDescription.js 3.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.default = void 0;
  6. var _lodash = _interopRequireDefault(require("lodash"));
  7. var _iterateJsdoc = _interopRequireDefault(require("../iterateJsdoc"));
  8. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  9. var _default = (0, _iterateJsdoc.default)(({
  10. jsdoc,
  11. report,
  12. utils,
  13. context
  14. }) => {
  15. if (utils.avoidDocs()) {
  16. return;
  17. }
  18. const {
  19. descriptionStyle = 'body'
  20. } = context.options[0] || {};
  21. let targetTagName = utils.getPreferredTagName({
  22. // We skip reporting except when `@description` is essential to the rule,
  23. // so user can block the tag and still meaningfully use this rule
  24. // even if the tag is present (and `check-tag-names` is the one to
  25. // normally report the fact that it is blocked but present)
  26. skipReportingBlockedTag: descriptionStyle !== 'tag',
  27. tagName: 'description'
  28. });
  29. if (!targetTagName) {
  30. return;
  31. }
  32. const isBlocked = typeof targetTagName === 'object' && targetTagName.blocked;
  33. if (isBlocked) {
  34. targetTagName = targetTagName.tagName;
  35. }
  36. const checkDescription = description => {
  37. const exampleContent = _lodash.default.compact(description.trim().split('\n'));
  38. return exampleContent.length;
  39. };
  40. if (descriptionStyle !== 'tag') {
  41. const {
  42. description
  43. } = utils.getDescription();
  44. if (checkDescription(description || '')) {
  45. return;
  46. }
  47. if (descriptionStyle === 'body') {
  48. const descTags = utils.getPresentTags(['desc', 'description']);
  49. if (descTags.length) {
  50. const [{
  51. tag: tagName
  52. }] = descTags;
  53. report(`Remove the @${tagName} tag to leave a plain block description or add additional description text above the @${tagName} line.`);
  54. } else {
  55. report('Missing JSDoc block description.');
  56. }
  57. return;
  58. }
  59. }
  60. const functionExamples = isBlocked ? [] : _lodash.default.filter(jsdoc.tags, {
  61. tag: targetTagName
  62. });
  63. if (!functionExamples.length) {
  64. report(descriptionStyle === 'any' ? `Missing JSDoc block description or @${targetTagName} declaration.` : `Missing JSDoc @${targetTagName} declaration.`);
  65. return;
  66. }
  67. functionExamples.forEach(example => {
  68. if (!checkDescription(`${example.name} ${utils.getTagDescription(example)}`)) {
  69. report(`Missing JSDoc @${targetTagName} description.`, null, example);
  70. }
  71. });
  72. }, {
  73. contextDefaults: true,
  74. meta: {
  75. docs: {
  76. description: 'Requires that all functions have a description.',
  77. url: 'https://github.com/gajus/eslint-plugin-jsdoc#eslint-plugin-jsdoc-rules-require-description'
  78. },
  79. schema: [{
  80. additionalProperties: false,
  81. properties: {
  82. checkConstructors: {
  83. default: true,
  84. type: 'boolean'
  85. },
  86. checkGetters: {
  87. default: true,
  88. type: 'boolean'
  89. },
  90. checkSetters: {
  91. default: true,
  92. type: 'boolean'
  93. },
  94. contexts: {
  95. items: {
  96. anyOf: [{
  97. type: 'string'
  98. }, {
  99. additionalProperties: false,
  100. properties: {
  101. comment: {
  102. type: 'string'
  103. },
  104. context: {
  105. type: 'string'
  106. }
  107. },
  108. type: 'object'
  109. }]
  110. },
  111. type: 'array'
  112. },
  113. descriptionStyle: {
  114. enum: ['body', 'tag', 'any'],
  115. type: 'string'
  116. },
  117. exemptedBy: {
  118. items: {
  119. type: 'string'
  120. },
  121. type: 'array'
  122. }
  123. },
  124. type: 'object'
  125. }],
  126. type: 'suggestion'
  127. }
  128. });
  129. exports.default = _default;
  130. module.exports = exports.default;
  131. //# sourceMappingURL=requireDescription.js.map