no-destructuring.js 964 B

1234567891011121314151617181920212223242526272829303132
  1. /**
  2. * @author Toru Nagashima <https://github.com/mysticatea>
  3. * See LICENSE file in root directory for full license.
  4. */
  5. "use strict"
  6. module.exports = {
  7. meta: {
  8. docs: {
  9. description: "disallow destructuring.",
  10. category: "ES2015",
  11. recommended: false,
  12. url:
  13. "http://mysticatea.github.io/eslint-plugin-es/rules/no-destructuring.html",
  14. },
  15. fixable: null,
  16. messages: {
  17. forbidden: "ES2015 destructuring is forbidden.",
  18. },
  19. schema: [],
  20. type: "problem",
  21. },
  22. create(context) {
  23. return {
  24. ":matches(:function, AssignmentExpression, VariableDeclarator, :function > :matches(AssignmentPattern, RestElement), ForInStatement, ForOfStatement) > :matches(ArrayPattern, ObjectPattern)"(
  25. node
  26. ) {
  27. context.report({ node, messageId: "forbidden" })
  28. },
  29. }
  30. },
  31. }