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 2.1KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. // @ts-nocheck
  2. 'use strict';
  3. const _ = require('lodash');
  4. const declarationValueIndex = require('../../utils/declarationValueIndex');
  5. const getUnitFromValueNode = require('../../utils/getUnitFromValueNode');
  6. const matchesStringOrRegExp = require('../../utils/matchesStringOrRegExp');
  7. const report = require('../../utils/report');
  8. const ruleMessages = require('../../utils/ruleMessages');
  9. const validateOptions = require('../../utils/validateOptions');
  10. const valueParser = require('postcss-value-parser');
  11. const vendor = require('../../utils/vendor');
  12. const ruleName = 'declaration-property-unit-blacklist';
  13. const messages = ruleMessages(ruleName, {
  14. rejected: (property, unit) => `Unexpected unit "${unit}" for property "${property}"`,
  15. });
  16. function rule(list) {
  17. return (root, result) => {
  18. const validOptions = validateOptions(result, ruleName, {
  19. actual: list,
  20. possible: [_.isObject],
  21. });
  22. if (!validOptions) {
  23. return;
  24. }
  25. result.warn(
  26. `'${ruleName}' has been deprecated. Instead use 'declaration-property-unit-disallowed-list'.`,
  27. {
  28. stylelintType: 'deprecation',
  29. stylelintReference: `https://github.com/stylelint/stylelint/blob/13.7.0/lib/rules/${ruleName}/README.md`,
  30. },
  31. );
  32. root.walkDecls((decl) => {
  33. const prop = decl.prop;
  34. const value = decl.value;
  35. const unprefixedProp = vendor.unprefixed(prop);
  36. const propList = _.find(list, (units, propIdentifier) =>
  37. matchesStringOrRegExp(unprefixedProp, propIdentifier),
  38. );
  39. if (!propList) {
  40. return;
  41. }
  42. valueParser(value).walk((node) => {
  43. // Ignore wrong units within `url` function
  44. if (node.type === 'function' && node.value.toLowerCase() === 'url') {
  45. return false;
  46. }
  47. if (node.type === 'string') {
  48. return;
  49. }
  50. const unit = getUnitFromValueNode(node);
  51. if (!unit || (unit && !propList.includes(unit.toLowerCase()))) {
  52. return;
  53. }
  54. report({
  55. message: messages.rejected(prop, unit),
  56. node: decl,
  57. index: declarationValueIndex(decl) + node.sourceIndex,
  58. result,
  59. ruleName,
  60. });
  61. });
  62. });
  63. };
  64. }
  65. rule.ruleName = ruleName;
  66. rule.messages = messages;
  67. rule.meta = { deprecated: true };
  68. module.exports = rule;