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.

declarationColonSpaceChecker.js 1.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. // @ts-nocheck
  2. 'use strict';
  3. const declarationValueIndex = require('../utils/declarationValueIndex');
  4. const isStandardSyntaxDeclaration = require('../utils/isStandardSyntaxDeclaration');
  5. const report = require('../utils/report');
  6. module.exports = function (opts) {
  7. opts.root.walkDecls((decl) => {
  8. if (!isStandardSyntaxDeclaration(decl)) {
  9. return;
  10. }
  11. // Get the raw prop, and only the prop
  12. const endOfPropIndex = declarationValueIndex(decl) + (decl.raws.between || '').length - 1;
  13. // The extra characters tacked onto the end ensure that there is a character to check
  14. // after the colon. Otherwise, with `background:pink` the character after the
  15. const propPlusColon = `${decl.toString().slice(0, endOfPropIndex)}xxx`;
  16. for (let i = 0, l = propPlusColon.length; i < l; i++) {
  17. if (propPlusColon[i] !== ':') {
  18. continue;
  19. }
  20. opts.locationChecker({
  21. source: propPlusColon,
  22. index: i,
  23. lineCheckStr: decl.value,
  24. err: (m) => {
  25. if (opts.fix && opts.fix(decl, i)) {
  26. return;
  27. }
  28. report({
  29. message: m,
  30. node: decl,
  31. index: decl.prop.toString().length + 1,
  32. result: opts.result,
  33. ruleName: opts.checkedRuleName,
  34. });
  35. },
  36. });
  37. break;
  38. }
  39. });
  40. };