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.

requireExample.js 2.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  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. context,
  11. jsdoc,
  12. report,
  13. utils
  14. }) => {
  15. if (utils.avoidDocs()) {
  16. return;
  17. }
  18. const {
  19. exemptNoArguments = false
  20. } = context.options[0] || {};
  21. const targetTagName = 'example';
  22. const functionExamples = _lodash.default.filter(jsdoc.tags, {
  23. tag: targetTagName
  24. });
  25. if (!functionExamples.length) {
  26. if (exemptNoArguments && utils.isIteratingFunction() && !utils.hasParams()) {
  27. return;
  28. }
  29. utils.reportJSDoc(`Missing JSDoc @${targetTagName} declaration.`, null, () => {
  30. utils.addTag(targetTagName);
  31. });
  32. return;
  33. }
  34. functionExamples.forEach(example => {
  35. const exampleContent = _lodash.default.compact(`${example.name} ${utils.getTagDescription(example)}`.trim().split('\n'));
  36. if (!exampleContent.length) {
  37. report(`Missing JSDoc @${targetTagName} description.`, null, example);
  38. }
  39. });
  40. }, {
  41. contextDefaults: true,
  42. meta: {
  43. docs: {
  44. description: 'Requires that all functions have examples.',
  45. url: 'https://github.com/gajus/eslint-plugin-jsdoc#eslint-plugin-jsdoc-rules-require-example'
  46. },
  47. fixable: 'code',
  48. schema: [{
  49. additionalProperties: false,
  50. properties: {
  51. checkConstructors: {
  52. default: true,
  53. type: 'boolean'
  54. },
  55. checkGetters: {
  56. default: false,
  57. type: 'boolean'
  58. },
  59. checkSetters: {
  60. default: false,
  61. type: 'boolean'
  62. },
  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. exemptNoArguments: {
  89. default: false,
  90. type: 'boolean'
  91. }
  92. },
  93. type: 'object'
  94. }],
  95. type: 'suggestion'
  96. }
  97. });
  98. exports.default = _default;
  99. module.exports = exports.default;
  100. //# sourceMappingURL=requireExample.js.map