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.

checkAlignment.js 1.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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 trimStart = string => {
  9. return string.replace(/^\s+/u, '');
  10. };
  11. var _default = (0, _iterateJsdoc.default)(({
  12. sourceCode,
  13. jsdocNode,
  14. report,
  15. indent
  16. }) => {
  17. // `indent` is whitespace from line 1 (`/**`), so slice and account for "/".
  18. const indentLevel = indent.length + 1;
  19. const sourceLines = sourceCode.getText(jsdocNode).split('\n').slice(1).map(line => {
  20. return line.split('*')[0];
  21. }).filter(line => {
  22. return !trimStart(line).length;
  23. });
  24. const fix = fixer => {
  25. const replacement = sourceCode.getText(jsdocNode).split('\n').map((line, index) => {
  26. // Ignore the first line and all lines not starting with `*`
  27. const ignored = !index || trimStart(line.split('*')[0]).length;
  28. return ignored ? line : `${indent} ${trimStart(line)}`;
  29. }).join('\n');
  30. return fixer.replaceText(jsdocNode, replacement);
  31. };
  32. sourceLines.some((line, lineNum) => {
  33. if (line.length !== indentLevel) {
  34. report('Expected JSDoc block to be aligned.', fix, {
  35. line: lineNum + 1
  36. });
  37. return true;
  38. }
  39. return false;
  40. });
  41. }, {
  42. iterateAllJsdocs: true,
  43. meta: {
  44. docs: {
  45. description: 'Reports invalid alignment of JSDoc block asterisks.',
  46. url: 'https://github.com/gajus/eslint-plugin-jsdoc#eslint-plugin-jsdoc-rules-check-alignment'
  47. },
  48. fixable: 'code',
  49. type: 'layout'
  50. }
  51. });
  52. exports.default = _default;
  53. module.exports = exports.default;
  54. //# sourceMappingURL=checkAlignment.js.map