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

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