no-debugger.js 952 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. /**
  2. * @fileoverview Rule to flag use of a debugger statement
  3. * @author Nicholas C. Zakas
  4. */
  5. "use strict";
  6. //------------------------------------------------------------------------------
  7. // Rule Definition
  8. //------------------------------------------------------------------------------
  9. /** @type {import('../shared/types').Rule} */
  10. module.exports = {
  11. meta: {
  12. type: "problem",
  13. docs: {
  14. description: "Disallow the use of `debugger`",
  15. recommended: true,
  16. url: "https://eslint.org/docs/rules/no-debugger"
  17. },
  18. fixable: null,
  19. schema: [],
  20. messages: {
  21. unexpected: "Unexpected 'debugger' statement."
  22. }
  23. },
  24. create(context) {
  25. return {
  26. DebuggerStatement(node) {
  27. context.report({
  28. node,
  29. messageId: "unexpected"
  30. });
  31. }
  32. };
  33. }
  34. };