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

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. // @ts-nocheck
  2. 'use strict';
  3. const eachDeclarationBlock = require('../../utils/eachDeclarationBlock');
  4. const isCustomProperty = require('../../utils/isCustomProperty');
  5. const isStandardSyntaxProperty = require('../../utils/isStandardSyntaxProperty');
  6. const report = require('../../utils/report');
  7. const ruleMessages = require('../../utils/ruleMessages');
  8. const validateOptions = require('../../utils/validateOptions');
  9. const ruleName = 'declaration-block-no-duplicate-custom-properties';
  10. const messages = ruleMessages(ruleName, {
  11. rejected: (property) => `Unexpected duplicate "${property}"`,
  12. });
  13. function rule(on) {
  14. return (root, result) => {
  15. const validOptions = validateOptions(result, ruleName, { actual: on });
  16. if (!validOptions) {
  17. return;
  18. }
  19. eachDeclarationBlock(root, (eachDecl) => {
  20. const decls = new Set();
  21. eachDecl((decl) => {
  22. const prop = decl.prop;
  23. if (!isStandardSyntaxProperty(prop)) {
  24. return;
  25. }
  26. if (!isCustomProperty(prop)) {
  27. return;
  28. }
  29. const isDuplicate = decls.has(prop);
  30. if (isDuplicate) {
  31. report({
  32. message: messages.rejected(prop),
  33. node: decl,
  34. result,
  35. ruleName,
  36. });
  37. return;
  38. }
  39. decls.add(prop);
  40. });
  41. });
  42. };
  43. }
  44. rule.ruleName = ruleName;
  45. rule.messages = messages;
  46. module.exports = rule;