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.

requireThrows.js 2.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.default = void 0;
  6. var _iterateJsdoc = _interopRequireDefault(require("../iterateJsdoc"));
  7. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  8. /**
  9. * We can skip checking for a throws value, in case the documentation is inherited
  10. * or the method is either a constructor or an abstract method.
  11. *
  12. * @param {*} utils
  13. * a reference to the utils which are used to probe if a tag is present or not.
  14. * @returns {boolean}
  15. * true in case deep checking can be skipped; otherwise false.
  16. */
  17. const canSkip = utils => {
  18. return utils.hasATag([// inheritdoc implies that all documentation is inherited
  19. // see https://jsdoc.app/tags-inheritdoc.html
  20. //
  21. // Abstract methods are by definition incomplete,
  22. // so it is not necessary to document that they throw an error.
  23. 'abstract', 'virtual', // The designated type can itself document `@throws`
  24. 'type']) || utils.avoidDocs();
  25. };
  26. var _default = (0, _iterateJsdoc.default)(({
  27. report,
  28. utils
  29. }) => {
  30. // A preflight check. We do not need to run a deep check for abstract
  31. // functions.
  32. if (canSkip(utils)) {
  33. return;
  34. }
  35. const tagName = utils.getPreferredTagName({
  36. tagName: 'throws'
  37. });
  38. if (!tagName) {
  39. return;
  40. }
  41. const tags = utils.getTags(tagName);
  42. const iteratingFunction = utils.isIteratingFunction(); // In case the code returns something, we expect a return value in JSDoc.
  43. const [tag] = tags;
  44. const missingThrowsTag = typeof tag === 'undefined' || tag === null;
  45. const shouldReport = () => {
  46. if (!missingThrowsTag) {
  47. return false;
  48. }
  49. return iteratingFunction && utils.hasThrowValue();
  50. };
  51. if (shouldReport()) {
  52. report(`Missing JSDoc @${tagName} declaration.`);
  53. }
  54. }, {
  55. contextDefaults: true,
  56. meta: {
  57. docs: {
  58. url: 'https://github.com/gajus/eslint-plugin-jsdoc#eslint-plugin-jsdoc-rules-require-returns'
  59. },
  60. schema: [{
  61. additionalProperties: false,
  62. properties: {
  63. contexts: {
  64. items: {
  65. anyOf: [{
  66. type: 'string'
  67. }, {
  68. additionalProperties: false,
  69. properties: {
  70. comment: {
  71. type: 'string'
  72. },
  73. context: {
  74. type: 'string'
  75. }
  76. },
  77. type: 'object'
  78. }]
  79. },
  80. type: 'array'
  81. },
  82. exemptedBy: {
  83. items: {
  84. type: 'string'
  85. },
  86. type: 'array'
  87. }
  88. },
  89. type: 'object'
  90. }],
  91. type: 'suggestion'
  92. }
  93. });
  94. exports.default = _default;
  95. module.exports = exports.default;
  96. //# sourceMappingURL=requireThrows.js.map