项目原始demo,不改动
Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.
To repozytorium jest zarchiwizowane. Możesz wyświetlać pliki i je sklonować, ale nie możesz do niego przepychać zmian lub otwierać zgłoszeń/Pull Requestów.

12345678910111213141516171819202122232425262728293031323334353637383940
  1. /**
  2. * @fileoverview Rule to flag when deleting variables
  3. * @author Ilya Volodin
  4. */
  5. "use strict";
  6. //------------------------------------------------------------------------------
  7. // Rule Definition
  8. //------------------------------------------------------------------------------
  9. module.exports = {
  10. meta: {
  11. docs: {
  12. description: "disallow deleting variables",
  13. category: "Variables",
  14. recommended: true,
  15. url: "https://eslint.org/docs/rules/no-delete-var"
  16. },
  17. schema: [],
  18. messages: {
  19. unexpected: "Variables should not be deleted."
  20. }
  21. },
  22. create(context) {
  23. return {
  24. UnaryExpression(node) {
  25. if (node.operator === "delete" && node.argument.type === "Identifier") {
  26. context.report({ node, messageId: "unexpected" });
  27. }
  28. }
  29. };
  30. }
  31. };