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.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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 = 'custom-media-pattern';
  9. const messages = ruleMessages(ruleName, {
  10. expected: (pattern) => `Expected custom media query name to match pattern "${pattern}"`,
  11. });
  12. function rule(pattern) {
  13. return (root, result) => {
  14. const validOptions = validateOptions(result, ruleName, {
  15. actual: pattern,
  16. possible: [_.isRegExp, _.isString],
  17. });
  18. if (!validOptions) {
  19. return;
  20. }
  21. const regexpPattern = _.isString(pattern) ? new RegExp(pattern) : pattern;
  22. root.walkAtRules((atRule) => {
  23. if (atRule.name.toLowerCase() !== 'custom-media') {
  24. return;
  25. }
  26. const customMediaName = atRule.params.match(/^--(\S+)\b/)[1];
  27. if (regexpPattern.test(customMediaName)) {
  28. return;
  29. }
  30. report({
  31. message: messages.expected(pattern),
  32. node: atRule,
  33. index: atRuleParamIndex(atRule),
  34. result,
  35. ruleName,
  36. });
  37. });
  38. };
  39. }
  40. rule.ruleName = ruleName;
  41. rule.messages = messages;
  42. module.exports = rule;