From 18ee9717b75f0306f1839cbbf58b5bbffd90241f Mon Sep 17 00:00:00 2001 From: Denis Sokolov Date: Mon, 25 Nov 2024 12:00:00 +0000 Subject: [PATCH] config: silence react and jest warnings about versions --- src/config/index.ts | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/config/index.ts b/src/config/index.ts index fdeae36..9b0b63b 100644 --- a/src/config/index.ts +++ b/src/config/index.ts @@ -66,7 +66,24 @@ export const main = { typescript: true, }, react: { - version: "detect", + version: (function () { + try { + return require("react/package.json").version; + } catch (e) { + // If no React, silence the warning about missing version + return "16"; + } + })(), + }, + jest: { + version: (function () { + try { + return require("jest/package.json").version; + } catch (e) { + // If no Jest, silence the warning about missing version + return 27; + } + })(), }, }, } satisfies Linter.Config;