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.

requireAsteriskPrefix.js 3.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  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. var _default = (0, _iterateJsdoc.default)(({
  9. context,
  10. jsdoc,
  11. utils,
  12. indent
  13. }) => {
  14. const [defaultRequireValue = 'always', {
  15. tags: tagMap = {}
  16. } = {}] = context.options;
  17. const {
  18. source
  19. } = jsdoc;
  20. const always = defaultRequireValue === 'always';
  21. const never = defaultRequireValue === 'never';
  22. let currentTag;
  23. source.some(({
  24. number,
  25. tokens
  26. }) => {
  27. var _tagMap$any2;
  28. const {
  29. delimiter,
  30. tag,
  31. end,
  32. description
  33. } = tokens;
  34. const neverFix = () => {
  35. tokens.delimiter = '';
  36. tokens.postDelimiter = '';
  37. };
  38. const checkNever = checkValue => {
  39. var _tagMap$always, _tagMap$never;
  40. if (delimiter && delimiter !== '/**' && (never && !((_tagMap$always = tagMap.always) !== null && _tagMap$always !== void 0 && _tagMap$always.includes(checkValue)) || (_tagMap$never = tagMap.never) !== null && _tagMap$never !== void 0 && _tagMap$never.includes(checkValue))) {
  41. utils.reportJSDoc('Expected JSDoc line to have no prefix.', {
  42. column: 0,
  43. line: number
  44. }, neverFix);
  45. return true;
  46. }
  47. return false;
  48. };
  49. const alwaysFix = () => {
  50. if (!tokens.start) {
  51. tokens.start = indent + ' ';
  52. }
  53. tokens.delimiter = '*';
  54. tokens.postDelimiter = tag || description ? ' ' : '';
  55. };
  56. const checkAlways = checkValue => {
  57. var _tagMap$never2, _tagMap$always2;
  58. if (!delimiter && (always && !((_tagMap$never2 = tagMap.never) !== null && _tagMap$never2 !== void 0 && _tagMap$never2.includes(checkValue)) || (_tagMap$always2 = tagMap.always) !== null && _tagMap$always2 !== void 0 && _tagMap$always2.includes(checkValue))) {
  59. utils.reportJSDoc('Expected JSDoc line to have the prefix.', {
  60. column: 0,
  61. line: number
  62. }, alwaysFix);
  63. return true;
  64. }
  65. return false;
  66. };
  67. if (tag) {
  68. // Remove at sign
  69. currentTag = tag.slice(1);
  70. }
  71. if ( // If this is the end but has a tag, the delimiter will also be
  72. // populated and will be safely ignored later
  73. end && !tag) {
  74. return false;
  75. }
  76. if (!currentTag) {
  77. var _tagMap$any;
  78. if ((_tagMap$any = tagMap.any) !== null && _tagMap$any !== void 0 && _tagMap$any.includes('*description')) {
  79. return false;
  80. }
  81. if (checkNever('*description')) {
  82. return true;
  83. }
  84. if (checkAlways('*description')) {
  85. return true;
  86. }
  87. return false;
  88. }
  89. if ((_tagMap$any2 = tagMap.any) !== null && _tagMap$any2 !== void 0 && _tagMap$any2.includes(currentTag)) {
  90. return false;
  91. }
  92. if (checkNever(currentTag)) {
  93. return true;
  94. }
  95. if (checkAlways(currentTag)) {
  96. return true;
  97. }
  98. return false;
  99. });
  100. }, {
  101. iterateAllJsdocs: true,
  102. meta: {
  103. fixable: 'code',
  104. schema: [{
  105. enum: ['always', 'never', 'any'],
  106. type: 'string'
  107. }, {
  108. additionalProperties: false,
  109. properties: {
  110. tags: {
  111. properties: {
  112. always: {
  113. items: {
  114. type: 'string'
  115. },
  116. type: 'array'
  117. },
  118. any: {
  119. items: {
  120. type: 'string'
  121. },
  122. type: 'array'
  123. },
  124. never: {
  125. items: {
  126. type: 'string'
  127. },
  128. type: 'array'
  129. }
  130. },
  131. type: 'object'
  132. }
  133. },
  134. type: 'object'
  135. }],
  136. type: 'layout'
  137. }
  138. });
  139. exports.default = _default;
  140. module.exports = exports.default;
  141. //# sourceMappingURL=requireAsteriskPrefix.js.map