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 1.1KB

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