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.

mediaQueryListCommaWhitespaceChecker.js 1.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. // @ts-nocheck
  2. 'use strict';
  3. const atRuleParamIndex = require('../utils/atRuleParamIndex');
  4. const report = require('../utils/report');
  5. const styleSearch = require('style-search');
  6. module.exports = function (opts) {
  7. opts.root.walkAtRules(/^media$/i, (atRule) => {
  8. const params = atRule.raws.params ? atRule.raws.params.raw : atRule.params;
  9. styleSearch({ source: params, target: ',' }, (match) => {
  10. let index = match.startIndex;
  11. if (opts.allowTrailingComments) {
  12. // if there is a comment on the same line at after the comma, check the space after the comment.
  13. let execResult;
  14. while ((execResult = /^[^\S\r\n]*\/\*([\s\S]*?)\*\//.exec(params.slice(index + 1)))) {
  15. index += execResult[0].length;
  16. }
  17. if ((execResult = /^([^\S\r\n]*\/\/([\s\S]*?))\r?\n/.exec(params.slice(index + 1)))) {
  18. index += execResult[1].length;
  19. }
  20. }
  21. checkComma(params, index, atRule);
  22. });
  23. });
  24. function checkComma(source, index, node) {
  25. opts.locationChecker({
  26. source,
  27. index,
  28. err: (m) => {
  29. const commaIndex = index + atRuleParamIndex(node);
  30. if (opts.fix && opts.fix(node, commaIndex)) {
  31. return;
  32. }
  33. report({
  34. message: m,
  35. node,
  36. index: commaIndex,
  37. result: opts.result,
  38. ruleName: opts.checkedRuleName,
  39. });
  40. },
  41. });
  42. }
  43. };