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.

valueListCommaWhitespaceChecker.js 1.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. // @ts-nocheck
  2. 'use strict';
  3. const isStandardSyntaxDeclaration = require('../utils/isStandardSyntaxDeclaration');
  4. const isStandardSyntaxProperty = require('../utils/isStandardSyntaxProperty');
  5. const report = require('../utils/report');
  6. const styleSearch = require('style-search');
  7. module.exports = function (opts) {
  8. opts.root.walkDecls((decl) => {
  9. if (!isStandardSyntaxDeclaration(decl) || !isStandardSyntaxProperty(decl.prop)) {
  10. return;
  11. }
  12. const declString = decl.toString();
  13. styleSearch(
  14. {
  15. source: declString,
  16. target: ',',
  17. functionArguments: 'skip',
  18. },
  19. (match) => {
  20. const indexToCheckAfter = opts.determineIndex
  21. ? opts.determineIndex(declString, match)
  22. : match.startIndex;
  23. if (indexToCheckAfter === false) {
  24. return;
  25. }
  26. checkComma(declString, indexToCheckAfter, decl);
  27. },
  28. );
  29. });
  30. function checkComma(source, index, node) {
  31. opts.locationChecker({
  32. source,
  33. index,
  34. err: (m) => {
  35. if (opts.fix && opts.fix(node, index)) {
  36. return;
  37. }
  38. report({
  39. message: m,
  40. node,
  41. index,
  42. result: opts.result,
  43. ruleName: opts.checkedRuleName,
  44. });
  45. },
  46. });
  47. }
  48. };