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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. // @ts-nocheck
  2. 'use strict';
  3. const declarationColonSpaceChecker = require('../declarationColonSpaceChecker');
  4. const declarationValueIndex = require('../../utils/declarationValueIndex');
  5. const ruleMessages = require('../../utils/ruleMessages');
  6. const validateOptions = require('../../utils/validateOptions');
  7. const whitespaceChecker = require('../../utils/whitespaceChecker');
  8. const ruleName = 'declaration-colon-space-after';
  9. const messages = ruleMessages(ruleName, {
  10. expectedAfter: () => 'Expected single space after ":"',
  11. rejectedAfter: () => 'Unexpected whitespace after ":"',
  12. expectedAfterSingleLine: () => 'Expected single space after ":" with a single-line declaration',
  13. });
  14. function rule(expectation, options, context) {
  15. const checker = whitespaceChecker('space', expectation, messages);
  16. return (root, result) => {
  17. const validOptions = validateOptions(result, ruleName, {
  18. actual: expectation,
  19. possible: ['always', 'never', 'always-single-line'],
  20. });
  21. if (!validOptions) {
  22. return;
  23. }
  24. declarationColonSpaceChecker({
  25. root,
  26. result,
  27. locationChecker: checker.after,
  28. checkedRuleName: ruleName,
  29. fix: context.fix
  30. ? (decl, index) => {
  31. const colonIndex = index - declarationValueIndex(decl);
  32. const between = decl.raws.between;
  33. if (expectation.startsWith('always')) {
  34. decl.raws.between =
  35. between.slice(0, colonIndex) + between.slice(colonIndex).replace(/^:\s*/, ': ');
  36. return true;
  37. }
  38. if (expectation === 'never') {
  39. decl.raws.between =
  40. between.slice(0, colonIndex) + between.slice(colonIndex).replace(/^:\s*/, ':');
  41. return true;
  42. }
  43. }
  44. : null,
  45. });
  46. };
  47. }
  48. rule.ruleName = ruleName;
  49. rule.messages = messages;
  50. module.exports = rule;