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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. // @ts-nocheck
  2. 'use strict';
  3. const _ = require('lodash');
  4. const isCustomProperty = require('../../utils/isCustomProperty');
  5. const isStandardSyntaxDeclaration = require('../../utils/isStandardSyntaxDeclaration');
  6. const isStandardSyntaxProperty = require('../../utils/isStandardSyntaxProperty');
  7. const optionsMatches = require('../../utils/optionsMatches');
  8. const properties = require('known-css-properties').all;
  9. const report = require('../../utils/report');
  10. const ruleMessages = require('../../utils/ruleMessages');
  11. const validateOptions = require('../../utils/validateOptions');
  12. const vendor = require('../../utils/vendor');
  13. const ruleName = 'property-no-unknown';
  14. const messages = ruleMessages(ruleName, {
  15. rejected: (property) => `Unexpected unknown property "${property}"`,
  16. });
  17. function rule(actual, options) {
  18. const allValidProperties = new Set(properties);
  19. return (root, result) => {
  20. const validOptions = validateOptions(
  21. result,
  22. ruleName,
  23. { actual },
  24. {
  25. actual: options,
  26. possible: {
  27. ignoreProperties: [_.isString, _.isRegExp],
  28. checkPrefixed: _.isBoolean,
  29. ignoreSelectors: [_.isString, _.isRegExp],
  30. ignoreAtRules: [_.isString, _.isRegExp],
  31. },
  32. optional: true,
  33. },
  34. );
  35. if (!validOptions) {
  36. return;
  37. }
  38. const shouldCheckPrefixed = _.get(options, 'checkPrefixed');
  39. root.walkDecls(checkStatement);
  40. function checkStatement(decl) {
  41. const prop = decl.prop;
  42. if (!isStandardSyntaxProperty(prop)) {
  43. return;
  44. }
  45. if (!isStandardSyntaxDeclaration(decl)) {
  46. return;
  47. }
  48. if (isCustomProperty(prop)) {
  49. return;
  50. }
  51. if (!shouldCheckPrefixed && vendor.prefix(prop)) {
  52. return;
  53. }
  54. if (optionsMatches(options, 'ignoreProperties', prop)) {
  55. return;
  56. }
  57. const { selector } = decl.parent;
  58. if (selector && optionsMatches(options, 'ignoreSelectors', selector)) {
  59. return;
  60. }
  61. let node = decl.parent;
  62. while (node && node.type !== 'root') {
  63. const { type, name } = node;
  64. if (type === 'atrule' && optionsMatches(options, 'ignoreAtRules', name)) {
  65. return;
  66. }
  67. node = node.parent;
  68. }
  69. if (allValidProperties.has(prop.toLowerCase())) {
  70. return;
  71. }
  72. report({
  73. message: messages.rejected(prop),
  74. node: decl,
  75. result,
  76. ruleName,
  77. });
  78. }
  79. };
  80. }
  81. rule.ruleName = ruleName;
  82. rule.messages = messages;
  83. module.exports = rule;