no-with.js 756 B

123456789101112131415161718192021222324252627282930313233
  1. /**
  2. * @fileoverview Rule to flag use of with statement
  3. * @author Nicholas C. Zakas
  4. */
  5. "use strict";
  6. //------------------------------------------------------------------------------
  7. // Rule Definition
  8. //------------------------------------------------------------------------------
  9. module.exports = {
  10. meta: {
  11. docs: {
  12. description: "disallow `with` statements",
  13. category: "Best Practices",
  14. recommended: false,
  15. url: "https://eslint.org/docs/rules/no-with"
  16. },
  17. schema: []
  18. },
  19. create(context) {
  20. return {
  21. WithStatement(node) {
  22. context.report({ node, message: "Unexpected use of 'with' statement." });
  23. }
  24. };
  25. }
  26. };