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.

prefer-strict-equal.js 1.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.default = void 0;
  6. var _utils = require("./utils");
  7. var _default = (0, _utils.createRule)({
  8. name: __filename,
  9. meta: {
  10. docs: {
  11. category: 'Best Practices',
  12. description: 'Suggest using `toStrictEqual()`',
  13. recommended: false,
  14. suggestion: true
  15. },
  16. messages: {
  17. useToStrictEqual: 'Use `toStrictEqual()` instead',
  18. suggestReplaceWithStrictEqual: 'Replace with `toStrictEqual()`'
  19. },
  20. type: 'suggestion',
  21. schema: [],
  22. hasSuggestions: true
  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 && (0, _utils.isParsedEqualityMatcherCall)(matcher, _utils.EqualityMatcher.toEqual)) {
  35. context.report({
  36. messageId: 'useToStrictEqual',
  37. node: matcher.node.property,
  38. suggest: [{
  39. messageId: 'suggestReplaceWithStrictEqual',
  40. fix: fixer => [fixer.replaceText(matcher.node.property, _utils.EqualityMatcher.toStrictEqual)]
  41. }]
  42. });
  43. }
  44. }
  45. };
  46. }
  47. });
  48. exports.default = _default;