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.

index.js 1002B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. // @ts-nocheck
  2. 'use strict';
  3. const _ = require('lodash');
  4. const report = require('../../utils/report');
  5. const ruleMessages = require('../../utils/ruleMessages');
  6. const validateOptions = require('../../utils/validateOptions');
  7. const ruleName = 'comment-pattern';
  8. const messages = ruleMessages(ruleName, {
  9. expected: (pattern) => `Expected comment to match pattern "${pattern}"`,
  10. });
  11. function rule(pattern) {
  12. return (root, result) => {
  13. const validOptions = validateOptions(result, ruleName, {
  14. actual: pattern,
  15. possible: [_.isRegExp, _.isString],
  16. });
  17. if (!validOptions) {
  18. return;
  19. }
  20. const normalizedPattern = _.isString(pattern) ? new RegExp(pattern) : pattern;
  21. root.walkComments((comment) => {
  22. const text = comment.text;
  23. if (normalizedPattern.test(text)) {
  24. return;
  25. }
  26. report({
  27. message: messages.expected(pattern),
  28. node: comment,
  29. result,
  30. ruleName,
  31. });
  32. });
  33. };
  34. }
  35. rule.ruleName = ruleName;
  36. rule.messages = messages;
  37. module.exports = rule;