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

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. // @ts-nocheck
  2. 'use strict';
  3. const isStandardSyntaxAtRule = require('../../utils/isStandardSyntaxAtRule');
  4. const report = require('../../utils/report');
  5. const ruleMessages = require('../../utils/ruleMessages');
  6. const validateOptions = require('../../utils/validateOptions');
  7. const ruleName = 'at-rule-name-case';
  8. const messages = ruleMessages(ruleName, {
  9. expected: (actual, expected) => `Expected "${actual}" to be "${expected}"`,
  10. });
  11. function rule(expectation, options, context) {
  12. return (root, result) => {
  13. const validOptions = validateOptions(result, ruleName, {
  14. actual: expectation,
  15. possible: ['lower', 'upper'],
  16. });
  17. if (!validOptions) {
  18. return;
  19. }
  20. root.walkAtRules((atRule) => {
  21. if (!isStandardSyntaxAtRule(atRule)) {
  22. return;
  23. }
  24. const name = atRule.name;
  25. const expectedName = expectation === 'lower' ? name.toLowerCase() : name.toUpperCase();
  26. if (name === expectedName) {
  27. return;
  28. }
  29. if (context.fix) {
  30. atRule.name = expectedName;
  31. return;
  32. }
  33. report({
  34. message: messages.expected(name, expectedName),
  35. node: atRule,
  36. ruleName,
  37. result,
  38. });
  39. });
  40. };
  41. }
  42. rule.ruleName = ruleName;
  43. rule.messages = messages;
  44. module.exports = rule;