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.

checkIndentation.js 2.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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 maskExcludedContent = (str, excludeTags) => {
  9. const regContent = new RegExp(`([ \\t]+\\*)[ \\t]@(?:${excludeTags.join('|')})(?=[ \\n])([\\w|\\W]*?\\n)(?=[ \\t]*\\*(?:[ \\t]*@|\\/))`, 'gu');
  10. return str.replace(regContent, (_match, margin, code) => {
  11. return new Array(code.match(/\n/gu).length + 1).join(margin + '\n');
  12. });
  13. };
  14. const maskCodeBlocks = str => {
  15. const regContent = /([ \t]+\*)[ \t]```[^\n]*?([\w|\W]*?\n)(?=[ \t]*\*(?:[ \t]*(?:```|@)|\/))/gu;
  16. return str.replace(regContent, (_match, margin, code) => {
  17. return new Array(code.match(/\n/gu).length + 1).join(margin + '\n');
  18. });
  19. };
  20. var _default = (0, _iterateJsdoc.default)(({
  21. sourceCode,
  22. jsdocNode,
  23. report,
  24. context
  25. }) => {
  26. const options = context.options[0] || {};
  27. const {
  28. excludeTags = ['example']
  29. } = options;
  30. const reg = new RegExp(/^(?:\/?\**|[ \t]*)\*[ \t]{2}/gmu);
  31. const textWithoutCodeBlocks = maskCodeBlocks(sourceCode.getText(jsdocNode));
  32. const text = excludeTags.length ? maskExcludedContent(textWithoutCodeBlocks, excludeTags) : textWithoutCodeBlocks;
  33. if (reg.test(text)) {
  34. const lineBreaks = text.slice(0, reg.lastIndex).match(/\n/gu) || [];
  35. report('There must be no indentation.', null, {
  36. line: lineBreaks.length
  37. });
  38. }
  39. }, {
  40. iterateAllJsdocs: true,
  41. meta: {
  42. docs: {
  43. description: 'Reports invalid padding inside JSDoc blocks.',
  44. url: 'https://github.com/gajus/eslint-plugin-jsdoc#eslint-plugin-jsdoc-rules-check-indentation'
  45. },
  46. schema: [{
  47. additionalProperties: false,
  48. properties: {
  49. excludeTags: {
  50. items: {
  51. pattern: '^\\S+$',
  52. type: 'string'
  53. },
  54. type: 'array'
  55. }
  56. },
  57. type: 'object'
  58. }],
  59. type: 'layout'
  60. }
  61. });
  62. exports.default = _default;
  63. module.exports = exports.default;
  64. //# sourceMappingURL=checkIndentation.js.map