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

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. // @ts-nocheck
  2. 'use strict';
  3. const report = require('../../utils/report');
  4. const ruleMessages = require('../../utils/ruleMessages');
  5. const validateOptions = require('../../utils/validateOptions');
  6. const ruleName = 'no-empty-first-line';
  7. const noEmptyFirstLineTest = /^\s*[\r\n]/;
  8. const messages = ruleMessages(ruleName, {
  9. rejected: 'Unexpected empty line',
  10. });
  11. function rule(actual, _, context) {
  12. return (root, result) => {
  13. const validOptions = validateOptions(result, ruleName, { actual });
  14. if (!validOptions || root.source.inline || root.source.lang === 'object-literal') {
  15. return;
  16. }
  17. const rootString = context.fix ? root.toString() : root.source.input.css;
  18. if (!rootString.trim()) {
  19. return;
  20. }
  21. if (noEmptyFirstLineTest.test(rootString)) {
  22. if (context.fix) {
  23. root.nodes[0].raws.before = root.first.raws.before.trimStart();
  24. return;
  25. }
  26. report({
  27. message: messages.rejected,
  28. node: root,
  29. result,
  30. ruleName,
  31. });
  32. }
  33. };
  34. }
  35. rule.ruleName = ruleName;
  36. rule.messages = messages;
  37. module.exports = rule;