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.

noMultiAsterisks.js 2.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  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 middleAsterisks = /^[* \t]+/u;
  9. var _default = (0, _iterateJsdoc.default)(({
  10. context,
  11. jsdoc,
  12. utils
  13. }) => {
  14. const {
  15. preventAtEnd = true,
  16. preventAtMiddleLines = true
  17. } = context.options[0] || {};
  18. jsdoc.source.some(({
  19. tokens,
  20. number
  21. }) => {
  22. const {
  23. delimiter,
  24. tag,
  25. name,
  26. type,
  27. description,
  28. end
  29. } = tokens;
  30. if (preventAtMiddleLines && !end && !tag && !type && !name && middleAsterisks.test(description)) {
  31. const fix = () => {
  32. tokens.description = description.replace(middleAsterisks, '');
  33. };
  34. utils.reportJSDoc('Should be no multiple asterisks on middle lines.', {
  35. line: number
  36. }, fix, true);
  37. return true;
  38. }
  39. if (!preventAtEnd || !end) {
  40. return false;
  41. }
  42. const isSingleLineBlock = delimiter === '/**';
  43. const delim = isSingleLineBlock ? '*' : delimiter;
  44. const endAsterisks = isSingleLineBlock ? /\*((?:\*|(?: |\t))*)\*$/u : /((?:\*|(?: |\t))*)\*$/u;
  45. const endingAsterisksAndSpaces = (description + delim).match(endAsterisks);
  46. if (!endingAsterisksAndSpaces || !isSingleLineBlock && endingAsterisksAndSpaces[1] && !endingAsterisksAndSpaces[1].trim()) {
  47. return false;
  48. }
  49. const endFix = () => {
  50. if (!isSingleLineBlock) {
  51. tokens.delimiter = '';
  52. }
  53. tokens.description = (description + delim).replace(endAsterisks, '');
  54. };
  55. utils.reportJSDoc('Should be no multiple asterisks on end lines.', {
  56. line: number
  57. }, endFix, true);
  58. return true;
  59. });
  60. }, {
  61. iterateAllJsdocs: true,
  62. meta: {
  63. docs: {
  64. description: '',
  65. url: 'https://github.com/gajus/eslint-plugin-jsdoc#eslint-plugin-jsdoc-rules-no-multi-asterisks'
  66. },
  67. fixable: 'code',
  68. schema: [{
  69. additionalProperies: false,
  70. properties: {
  71. preventAtEnd: {
  72. type: 'boolean'
  73. },
  74. preventAtMiddleLines: {
  75. type: 'boolean'
  76. }
  77. },
  78. type: 'object'
  79. }],
  80. type: 'suggestion'
  81. }
  82. });
  83. exports.default = _default;
  84. module.exports = exports.default;
  85. //# sourceMappingURL=noMultiAsterisks.js.map