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.

no-multi-str.js 1.8KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. /**
  2. * @fileoverview Rule to flag when using multiline strings
  3. * @author Ilya Volodin
  4. */
  5. "use strict";
  6. //------------------------------------------------------------------------------
  7. // Requirements
  8. //------------------------------------------------------------------------------
  9. const astUtils = require("./utils/ast-utils");
  10. //------------------------------------------------------------------------------
  11. // Rule Definition
  12. //------------------------------------------------------------------------------
  13. module.exports = {
  14. meta: {
  15. type: "suggestion",
  16. docs: {
  17. description: "disallow multiline strings",
  18. category: "Best Practices",
  19. recommended: false,
  20. url: "https://eslint.org/docs/rules/no-multi-str"
  21. },
  22. schema: [],
  23. messages: {
  24. multilineString: "Multiline support is limited to browsers supporting ES5 only."
  25. }
  26. },
  27. create(context) {
  28. /**
  29. * Determines if a given node is part of JSX syntax.
  30. * @param {ASTNode} node The node to check.
  31. * @returns {boolean} True if the node is a JSX node, false if not.
  32. * @private
  33. */
  34. function isJSXElement(node) {
  35. return node.type.indexOf("JSX") === 0;
  36. }
  37. //--------------------------------------------------------------------------
  38. // Public API
  39. //--------------------------------------------------------------------------
  40. return {
  41. Literal(node) {
  42. if (astUtils.LINEBREAK_MATCHER.test(node.raw) && !isJSXElement(node.parent)) {
  43. context.report({
  44. node,
  45. messageId: "multilineString"
  46. });
  47. }
  48. }
  49. };
  50. }
  51. };