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

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. // @ts-nocheck
  2. 'use strict';
  3. const eachDeclarationBlock = require('../../utils/eachDeclarationBlock');
  4. const report = require('../../utils/report');
  5. const ruleMessages = require('../../utils/ruleMessages');
  6. const shorthandData = require('../../reference/shorthandData');
  7. const validateOptions = require('../../utils/validateOptions');
  8. const vendor = require('../../utils/vendor');
  9. const ruleName = 'declaration-block-no-shorthand-property-overrides';
  10. const messages = ruleMessages(ruleName, {
  11. rejected: (shorthand, original) => `Unexpected shorthand "${shorthand}" after "${original}"`,
  12. });
  13. function rule(actual) {
  14. return (root, result) => {
  15. const validOptions = validateOptions(result, ruleName, { actual });
  16. if (!validOptions) {
  17. return;
  18. }
  19. eachDeclarationBlock(root, (eachDecl) => {
  20. const declarations = {};
  21. eachDecl((decl) => {
  22. const prop = decl.prop;
  23. const unprefixedProp = vendor.unprefixed(prop);
  24. const prefix = vendor.prefix(prop).toLowerCase();
  25. const overrideables = shorthandData[unprefixedProp.toLowerCase()];
  26. if (!overrideables) {
  27. declarations[prop.toLowerCase()] = prop;
  28. return;
  29. }
  30. overrideables.forEach((longhandProp) => {
  31. if (!Object.prototype.hasOwnProperty.call(declarations, prefix + longhandProp)) {
  32. return;
  33. }
  34. report({
  35. ruleName,
  36. result,
  37. node: decl,
  38. message: messages.rejected(prop, declarations[prefix + longhandProp]),
  39. });
  40. });
  41. });
  42. });
  43. };
  44. }
  45. rule.ruleName = ruleName;
  46. rule.messages = messages;
  47. module.exports = rule;