Software zum Installieren eines Smart-Mirror Frameworks , zum Nutzen von hochschulrelevanten Informationen, auf einem Raspberry-Pi.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

no-commented-out-tests.js 1023B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.default = void 0;
  6. var _utils = require("./utils");
  7. function hasTests(node) {
  8. return /^\s*[xf]?(test|it|describe)(\.\w+|\[['"]\w+['"]\])?\s*\(/mu.test(node.value);
  9. }
  10. var _default = (0, _utils.createRule)({
  11. name: __filename,
  12. meta: {
  13. docs: {
  14. category: 'Best Practices',
  15. description: 'Disallow commented out tests',
  16. recommended: 'warn'
  17. },
  18. messages: {
  19. commentedTests: 'Some tests seem to be commented'
  20. },
  21. schema: [],
  22. type: 'suggestion'
  23. },
  24. defaultOptions: [],
  25. create(context) {
  26. const sourceCode = context.getSourceCode();
  27. function checkNode(node) {
  28. if (!hasTests(node)) {
  29. return;
  30. }
  31. context.report({
  32. messageId: 'commentedTests',
  33. node
  34. });
  35. }
  36. return {
  37. Program() {
  38. const comments = sourceCode.getAllComments();
  39. comments.forEach(checkNode);
  40. }
  41. };
  42. }
  43. });
  44. exports.default = _default;