From e51f69af605dbaabef508619f750e919da16e665 Mon Sep 17 00:00:00 2001 From: "Daniel D. Beck" Date: Wed, 13 Nov 2024 17:49:34 +0100 Subject: [PATCH] Error on deprecated compat keys (#2210) Until we have a representation for discouraged features, we should treat using deprecated BCD keys as an error. This also silences the compat key tag warning, which isn't very useful right now. Co-authored-by: Florian Scholz --- scripts/dist.ts | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/scripts/dist.ts b/scripts/dist.ts index 795b7811113..22ac8a3b3f4 100644 --- a/scripts/dist.ts +++ b/scripts/dist.ts @@ -201,7 +201,7 @@ function toDist(sourcePath: string): YAML.Document { if (source.compat_features) { source.compat_features.sort(); if (isDeepStrictEqual(source.compat_features, taggedCompatFeatures)) { - logger.warn( + logger.silly( `${id}: compat_features override matches tags in @mdn/browser-compat-data. Consider deleting the compat_features override.`, ); } @@ -234,9 +234,18 @@ function toDist(sourcePath: string): YAML.Document { }); if (computedStatus.discouraged) { - logger.warn( - `${id}: contains at least one deprecated compat feature and can never be Baseline. Was this intentional?`, - ); + const isDraft: boolean = source.draft_date ?? false; + + if (!source.draft_date) { + logger.error( + `${id}: contains at least one deprecated compat feature and can never be Baseline. This is forbidden for published features.`, + ); + exitStatus = 1; + } else { + logger.warn( + `${id}: draft contains at least one deprecated compat feature and can never be Baseline. Was this intentional?`, + ); + } } computedStatus = JSON.parse(computedStatus.toJSON());