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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. // @ts-nocheck
  2. 'use strict';
  3. const _ = require('lodash');
  4. const functionArgumentsSearch = require('../../utils/functionArgumentsSearch');
  5. const isStandardSyntaxUrl = require('../../utils/isStandardSyntaxUrl');
  6. const report = require('../../utils/report');
  7. const ruleMessages = require('../../utils/ruleMessages');
  8. const validateOptions = require('../../utils/validateOptions');
  9. const ruleName = 'function-url-no-scheme-relative';
  10. const messages = ruleMessages(ruleName, {
  11. rejected: 'Unexpected scheme-relative url',
  12. });
  13. function rule(actual) {
  14. return (root, result) => {
  15. const validOptions = validateOptions(result, ruleName, { actual });
  16. if (!validOptions) {
  17. return;
  18. }
  19. root.walkDecls((decl) => {
  20. functionArgumentsSearch(decl.toString().toLowerCase(), 'url', (args, index) => {
  21. const url = _.trim(args, ' \'"');
  22. if (!isStandardSyntaxUrl(url) || !url.startsWith('//')) {
  23. return;
  24. }
  25. report({
  26. message: messages.rejected,
  27. node: decl,
  28. index,
  29. result,
  30. ruleName,
  31. });
  32. });
  33. });
  34. };
  35. }
  36. rule.ruleName = ruleName;
  37. rule.messages = messages;
  38. module.exports = rule;