项目原始demo,不改动
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.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.
 
 
 
 

43 lines
1.2 KiB

  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. docs: {
  12. description: "disallow use of chained assignment expressions",
  13. category: "Stylistic Issues",
  14. recommended: false,
  15. url: "https://eslint.org/docs/rules/no-multi-assign"
  16. },
  17. schema: []
  18. },
  19. create(context) {
  20. //--------------------------------------------------------------------------
  21. // Public
  22. //--------------------------------------------------------------------------
  23. return {
  24. AssignmentExpression(node) {
  25. if (["AssignmentExpression", "VariableDeclarator"].indexOf(node.parent.type) !== -1) {
  26. context.report({
  27. node,
  28. message: "Unexpected chained assignment."
  29. });
  30. }
  31. }
  32. };
  33. }
  34. };