no-destructuring.js 939 B

12345678910111213141516171819202122232425262728293031
  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. schema: [],
  17. messages: {
  18. forbidden: "ES2015 destructuring is forbidden.",
  19. },
  20. },
  21. create(context) {
  22. return {
  23. ":matches(:function, AssignmentExpression, VariableDeclarator, :function > :matches(AssignmentPattern, RestElement), ForInStatement, ForOfStatement) > :matches(ArrayPattern, ObjectPattern)"(
  24. node
  25. ) {
  26. context.report({ node, messageId: "forbidden" })
  27. },
  28. }
  29. },
  30. }