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-truthy-falsy.js 1.1KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.default = void 0;
  6. var _utils = require("./utils");
  7. // todo: refactor into "ban-matchers"
  8. var _default = (0, _utils.createRule)({
  9. name: __filename,
  10. meta: {
  11. docs: {
  12. category: 'Best Practices',
  13. description: 'Disallow using `toBeTruthy()` & `toBeFalsy()`',
  14. recommended: false
  15. },
  16. deprecated: true,
  17. replacedBy: ['no-restricted-matchers'],
  18. messages: {
  19. avoidMatcher: 'Avoid {{ matcherName }}'
  20. },
  21. type: 'suggestion',
  22. schema: []
  23. },
  24. defaultOptions: [],
  25. create(context) {
  26. return {
  27. CallExpression(node) {
  28. if (!(0, _utils.isExpectCall)(node)) {
  29. return;
  30. }
  31. const {
  32. matcher
  33. } = (0, _utils.parseExpectCall)(node);
  34. if (!matcher || !['toBeTruthy', 'toBeFalsy'].includes(matcher.name)) {
  35. return;
  36. }
  37. context.report({
  38. messageId: 'avoidMatcher',
  39. node: matcher.node.property,
  40. data: {
  41. matcherName: matcher.name
  42. }
  43. });
  44. }
  45. };
  46. }
  47. });
  48. exports.default = _default;