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-sparse-arrays.js 1.2KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. /**
  2. * @fileoverview Disallow sparse arrays
  3. * @author Nicholas C. Zakas
  4. */
  5. "use strict";
  6. //------------------------------------------------------------------------------
  7. // Rule Definition
  8. //------------------------------------------------------------------------------
  9. module.exports = {
  10. meta: {
  11. type: "problem",
  12. docs: {
  13. description: "disallow sparse arrays",
  14. category: "Possible Errors",
  15. recommended: true,
  16. url: "https://eslint.org/docs/rules/no-sparse-arrays"
  17. },
  18. schema: [],
  19. messages: {
  20. unexpectedSparseArray: "Unexpected comma in middle of array."
  21. }
  22. },
  23. create(context) {
  24. //--------------------------------------------------------------------------
  25. // Public
  26. //--------------------------------------------------------------------------
  27. return {
  28. ArrayExpression(node) {
  29. const emptySpot = node.elements.indexOf(null) > -1;
  30. if (emptySpot) {
  31. context.report({ node, messageId: "unexpectedSparseArray" });
  32. }
  33. }
  34. };
  35. }
  36. };