Ohm-Management - Projektarbeit B-ME
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-assign.js 1.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /**
  2. * @fileoverview Rule to check use of chained assignment expressions
  3. * @author Stewart Rand
  4. */
  5. "use strict";
  6. //------------------------------------------------------------------------------
  7. // Rule Definition
  8. //------------------------------------------------------------------------------
  9. module.exports = {
  10. meta: {
  11. type: "suggestion",
  12. docs: {
  13. description: "disallow use of chained assignment expressions",
  14. category: "Stylistic Issues",
  15. recommended: false,
  16. url: "https://eslint.org/docs/rules/no-multi-assign"
  17. },
  18. schema: []
  19. },
  20. create(context) {
  21. //--------------------------------------------------------------------------
  22. // Public
  23. //--------------------------------------------------------------------------
  24. return {
  25. AssignmentExpression(node) {
  26. if (["AssignmentExpression", "VariableDeclarator"].indexOf(node.parent.type) !== -1) {
  27. context.report({
  28. node,
  29. message: "Unexpected chained assignment."
  30. });
  31. }
  32. }
  33. };
  34. }
  35. };