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-inline-snapshots.js 1.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.default = void 0;
  6. var _experimentalUtils = require("@typescript-eslint/experimental-utils");
  7. var _utils = require("./utils");
  8. var _default = (0, _utils.createRule)({
  9. name: __filename,
  10. meta: {
  11. docs: {
  12. category: 'Best Practices',
  13. description: 'Suggest using inline snapshots',
  14. recommended: false
  15. },
  16. deprecated: true,
  17. replacedBy: ['no-restricted-matchers'],
  18. messages: {
  19. toMatch: 'Use toMatchInlineSnapshot() instead',
  20. toMatchError: 'Use toThrowErrorMatchingInlineSnapshot() instead'
  21. },
  22. fixable: 'code',
  23. schema: [],
  24. type: 'suggestion'
  25. },
  26. defaultOptions: [],
  27. create(context) {
  28. return {
  29. CallExpression(node) {
  30. const {
  31. callee
  32. } = node;
  33. if (callee.type !== _experimentalUtils.AST_NODE_TYPES.MemberExpression || callee.property.type !== _experimentalUtils.AST_NODE_TYPES.Identifier) {
  34. return;
  35. }
  36. if (callee.property.name === 'toMatchSnapshot') {
  37. context.report({
  38. fix(fixer) {
  39. return [fixer.replaceText(callee.property, 'toMatchInlineSnapshot')];
  40. },
  41. messageId: 'toMatch',
  42. node: callee.property
  43. });
  44. } else if (callee.property.name === 'toThrowErrorMatchingSnapshot') {
  45. context.report({
  46. fix(fixer) {
  47. return [fixer.replaceText(callee.property, 'toThrowErrorMatchingInlineSnapshot')];
  48. },
  49. messageId: 'toMatchError',
  50. node: callee.property
  51. });
  52. }
  53. }
  54. };
  55. }
  56. });
  57. exports.default = _default;