From 4ec84ca7fbe145847b24d1ddc313cdf810d5f01e Mon Sep 17 00:00:00 2001 From: Anton Kastritskiy Date: Mon, 4 Sep 2023 03:42:29 -0700 Subject: [PATCH] allow ignoring packages for @types/* major version compatability Reviewed By: LukeDefeo Differential Revision: D48779653 fbshipit-source-id: ddea9730d1066212bfa7933df7f6a2c178e49766 --- desktop/scripts/verify-types-dependencies.tsx | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/desktop/scripts/verify-types-dependencies.tsx b/desktop/scripts/verify-types-dependencies.tsx index 30ff59ed3..3060351b8 100644 --- a/desktop/scripts/verify-types-dependencies.tsx +++ b/desktop/scripts/verify-types-dependencies.tsx @@ -11,6 +11,23 @@ import cp from 'child_process'; import fs from 'fs-extra'; import semver from 'semver'; +/** + * Lists all dependencies that DO NOT have to match their type declaration package major versions + * + * Leave a comment for packages that you list here + */ +const IGNORED_TYPES = new Set( + [ + // node is not an installed package + 'node', + + // we are useing experimental versions of these packages + 'react', + 'react-dom', + 'react-test-renderer', + ].map((x) => `@types/${x}`), +); + type UnmatchedLibType = { types: readonly [string, string]; lib: readonly [string, string]; @@ -29,7 +46,7 @@ function validatePackageJson(filepath: string): PackageJsonResult { const typesPackages: Array<[string, string]> = [ ...Object.entries(deps).filter(([k, v]) => k.startsWith('@types/')), ...Object.entries(devDeps).filter(([k, v]) => k.startsWith('@types/')), - ]; + ].filter((x) => !IGNORED_TYPES.has(x[0])); const unmatchedTypesPackages: UnmatchedLibType[] = typesPackages .map(([rawName, rawVersion]) => {