index.js 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. "use strict";
  2. var __assign = (this && this.__assign) || function () {
  3. __assign = Object.assign || function(t) {
  4. for (var s, i = 1, n = arguments.length; i < n; i++) {
  5. s = arguments[i];
  6. for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
  7. t[p] = s[p];
  8. }
  9. return t;
  10. };
  11. return __assign.apply(this, arguments);
  12. };
  13. var __importDefault = (this && this.__importDefault) || function (mod) {
  14. return (mod && mod.__esModule) ? mod : { "default": mod };
  15. };
  16. var await_async_query_1 = __importDefault(require("./rules/await-async-query"));
  17. var await_async_utils_1 = __importDefault(require("./rules/await-async-utils"));
  18. var await_fire_event_1 = __importDefault(require("./rules/await-fire-event"));
  19. var consistent_data_testid_1 = __importDefault(require("./rules/consistent-data-testid"));
  20. var no_await_sync_events_1 = __importDefault(require("./rules/no-await-sync-events"));
  21. var no_await_sync_query_1 = __importDefault(require("./rules/no-await-sync-query"));
  22. var no_debug_1 = __importDefault(require("./rules/no-debug"));
  23. var no_dom_import_1 = __importDefault(require("./rules/no-dom-import"));
  24. var no_manual_cleanup_1 = __importDefault(require("./rules/no-manual-cleanup"));
  25. var no_render_in_setup_1 = __importDefault(require("./rules/no-render-in-setup"));
  26. var no_wait_for_empty_callback_1 = __importDefault(require("./rules/no-wait-for-empty-callback"));
  27. var no_wait_for_snapshot_1 = __importDefault(require("./rules/no-wait-for-snapshot"));
  28. var prefer_explicit_assert_1 = __importDefault(require("./rules/prefer-explicit-assert"));
  29. var prefer_presence_queries_1 = __importDefault(require("./rules/prefer-presence-queries"));
  30. var prefer_screen_queries_1 = __importDefault(require("./rules/prefer-screen-queries"));
  31. var prefer_wait_for_1 = __importDefault(require("./rules/prefer-wait-for"));
  32. var prefer_find_by_1 = __importDefault(require("./rules/prefer-find-by"));
  33. var rules = {
  34. 'await-async-query': await_async_query_1.default,
  35. 'await-async-utils': await_async_utils_1.default,
  36. 'await-fire-event': await_fire_event_1.default,
  37. 'consistent-data-testid': consistent_data_testid_1.default,
  38. 'no-await-sync-events': no_await_sync_events_1.default,
  39. 'no-await-sync-query': no_await_sync_query_1.default,
  40. 'no-debug': no_debug_1.default,
  41. 'no-dom-import': no_dom_import_1.default,
  42. 'no-manual-cleanup': no_manual_cleanup_1.default,
  43. 'no-render-in-setup': no_render_in_setup_1.default,
  44. 'no-wait-for-empty-callback': no_wait_for_empty_callback_1.default,
  45. 'no-wait-for-snapshot': no_wait_for_snapshot_1.default,
  46. 'prefer-explicit-assert': prefer_explicit_assert_1.default,
  47. 'prefer-find-by': prefer_find_by_1.default,
  48. 'prefer-presence-queries': prefer_presence_queries_1.default,
  49. 'prefer-screen-queries': prefer_screen_queries_1.default,
  50. 'prefer-wait-for': prefer_wait_for_1.default,
  51. };
  52. var recommendedRules = {
  53. 'testing-library/await-async-query': 'error',
  54. 'testing-library/await-async-utils': 'error',
  55. 'testing-library/no-await-sync-query': 'error',
  56. 'testing-library/prefer-find-by': 'error',
  57. };
  58. module.exports = {
  59. rules: rules,
  60. configs: {
  61. recommended: {
  62. plugins: ['testing-library'],
  63. rules: recommendedRules,
  64. },
  65. angular: {
  66. plugins: ['testing-library'],
  67. rules: __assign(__assign({}, recommendedRules), { 'testing-library/no-debug': 'warn', 'testing-library/no-dom-import': ['error', 'angular'] }),
  68. },
  69. react: {
  70. plugins: ['testing-library'],
  71. rules: __assign(__assign({}, recommendedRules), { 'testing-library/no-debug': 'warn', 'testing-library/no-dom-import': ['error', 'react'] }),
  72. },
  73. vue: {
  74. plugins: ['testing-library'],
  75. rules: __assign(__assign({}, recommendedRules), { 'testing-library/await-fire-event': 'error', 'testing-library/no-debug': 'warn', 'testing-library/no-dom-import': ['error', 'vue'] }),
  76. },
  77. },
  78. };