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-empty-pattern.js 1.2KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. /**
  2. * @fileoverview Rule to disallow an empty pattern
  3. * @author Alberto Rodríguez
  4. */
  5. "use strict";
  6. //------------------------------------------------------------------------------
  7. // Rule Definition
  8. //------------------------------------------------------------------------------
  9. module.exports = {
  10. meta: {
  11. type: "problem",
  12. docs: {
  13. description: "disallow empty destructuring patterns",
  14. category: "Best Practices",
  15. recommended: true,
  16. url: "https://eslint.org/docs/rules/no-empty-pattern"
  17. },
  18. schema: [],
  19. messages: {
  20. unexpected: "Unexpected empty {{type}} pattern."
  21. }
  22. },
  23. create(context) {
  24. return {
  25. ObjectPattern(node) {
  26. if (node.properties.length === 0) {
  27. context.report({ node, messageId: "unexpected", data: { type: "object" } });
  28. }
  29. },
  30. ArrayPattern(node) {
  31. if (node.elements.length === 0) {
  32. context.report({ node, messageId: "unexpected", data: { type: "array" } });
  33. }
  34. }
  35. };
  36. }
  37. };