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.

noMissingSyntax.js 3.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  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. const setDefaults = state => {
  9. if (!state.selectorMap) {
  10. state.selectorMap = {};
  11. }
  12. };
  13. const incrementSelector = (state, selector, comment) => {
  14. if (!state.selectorMap[selector]) {
  15. state.selectorMap[selector] = {};
  16. }
  17. if (!state.selectorMap[selector][comment]) {
  18. state.selectorMap[selector][comment] = 0;
  19. }
  20. state.selectorMap[selector][comment]++;
  21. };
  22. var _default = (0, _iterateJsdoc.default)(({
  23. info: {
  24. selector,
  25. comment
  26. },
  27. state
  28. }) => {
  29. setDefaults(state);
  30. incrementSelector(state, selector, comment);
  31. }, {
  32. contextSelected: true,
  33. exit({
  34. context,
  35. state
  36. }) {
  37. if (!context.options.length) {
  38. context.report({
  39. loc: {
  40. start: {
  41. column: 1,
  42. line: 1
  43. }
  44. },
  45. message: 'Rule `no-missing-syntax` is missing a `context` option.'
  46. });
  47. return;
  48. }
  49. setDefaults(state);
  50. const {
  51. contexts
  52. } = context.options[0]; // Report when MISSING
  53. contexts.some(cntxt => {
  54. var _cntxt$context, _cntxt$comment, _cntxt$minimum;
  55. const contextStr = typeof cntxt === 'object' ? (_cntxt$context = cntxt.context) !== null && _cntxt$context !== void 0 ? _cntxt$context : 'any' : cntxt;
  56. const comment = (_cntxt$comment = cntxt === null || cntxt === void 0 ? void 0 : cntxt.comment) !== null && _cntxt$comment !== void 0 ? _cntxt$comment : '';
  57. const contextKey = contextStr === 'any' ? undefined : contextStr;
  58. if ((!state.selectorMap[contextKey] || !state.selectorMap[contextKey][comment] || state.selectorMap[contextKey][comment] < ((_cntxt$minimum = cntxt === null || cntxt === void 0 ? void 0 : cntxt.minimum) !== null && _cntxt$minimum !== void 0 ? _cntxt$minimum : 1)) && (contextStr !== 'any' || Object.values(state.selectorMap).every(cmmnt => {
  59. var _cntxt$minimum2;
  60. return !cmmnt[comment] || cmmnt[comment] < ((_cntxt$minimum2 = cntxt === null || cntxt === void 0 ? void 0 : cntxt.minimum) !== null && _cntxt$minimum2 !== void 0 ? _cntxt$minimum2 : 1);
  61. }))) {
  62. var _cntxt$message;
  63. const message = (_cntxt$message = cntxt === null || cntxt === void 0 ? void 0 : cntxt.message) !== null && _cntxt$message !== void 0 ? _cntxt$message : 'Syntax is required: {{context}}' + (comment ? ' with {{comment}}' : '');
  64. context.report({
  65. data: {
  66. comment,
  67. context: contextStr
  68. },
  69. loc: {
  70. end: {
  71. line: 1
  72. },
  73. start: {
  74. line: 1
  75. }
  76. },
  77. message
  78. });
  79. return true;
  80. }
  81. return false;
  82. });
  83. },
  84. meta: {
  85. docs: {
  86. description: 'Reports when certain comment structures are always expected.',
  87. url: 'https://github.com/gajus/eslint-plugin-jsdoc#eslint-plugin-jsdoc-rules-no-missing-syntax'
  88. },
  89. fixable: 'code',
  90. schema: [{
  91. additionalProperties: false,
  92. properties: {
  93. contexts: {
  94. items: {
  95. anyOf: [{
  96. type: 'string'
  97. }, {
  98. additionalProperties: false,
  99. properties: {
  100. comment: {
  101. type: 'string'
  102. },
  103. context: {
  104. type: 'string'
  105. },
  106. message: {
  107. type: 'string'
  108. },
  109. minimum: {
  110. type: 'integer'
  111. }
  112. },
  113. type: 'object'
  114. }]
  115. },
  116. type: 'array'
  117. }
  118. },
  119. type: 'object'
  120. }],
  121. type: 'suggestion'
  122. }
  123. });
  124. exports.default = _default;
  125. module.exports = exports.default;
  126. //# sourceMappingURL=noMissingSyntax.js.map