From 70613eb00f5839ae195a3a68afce21219b963a3b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20De=20Boey?= Date: Tue, 7 Mar 2023 23:56:27 +0100 Subject: [PATCH] feat(remix-eslint-config): add deprecation warning to `@remix-run/eslint-config/jest` ESLint config --- .changeset/wicked-hairs-tell.md | 5 +++++ packages/remix-eslint-config/jest.js | 17 +++++++++++++++++ 2 files changed, 22 insertions(+) create mode 100644 .changeset/wicked-hairs-tell.md diff --git a/.changeset/wicked-hairs-tell.md b/.changeset/wicked-hairs-tell.md new file mode 100644 index 00000000000..edfb0d34c55 --- /dev/null +++ b/.changeset/wicked-hairs-tell.md @@ -0,0 +1,5 @@ +--- +"@remix-run/eslint-config": minor +--- + +add deprecation warning to `@remix-run/eslint-config/jest` ESLint config diff --git a/packages/remix-eslint-config/jest.js b/packages/remix-eslint-config/jest.js index f69586b6fac..dac2ee8da83 100644 --- a/packages/remix-eslint-config/jest.js +++ b/packages/remix-eslint-config/jest.js @@ -6,6 +6,23 @@ const jestRules = require("./rules/jest"); */ require("@rushstack/eslint-patch/modern-module-resolution"); +const alreadyWarned = {}; +const warnOnce = (condition, message) => { + if (!condition && !alreadyWarned[message]) { + alreadyWarned[message] = true; + console.warn(message); + } +}; + +warnOnce( + false, + "⚠️ DEPRECATED: The `@remix-run/eslint-config/jest` ESLint config " + + "has been deprecated in favor of " + + "`@remix-run/eslint-config/jest-testing-library` and will be removed in " + + "Remix v2. Please update your code to use " + + "`@remix-run/eslint-config/jest-testing-library` instead." +); + /** * @deprecated Use `@remix-run/eslint-config/jest-testing-library` instead. */