From b3d9c876a95683ae04ca08bca1f897ee3f87cbb5 Mon Sep 17 00:00:00 2001 From: "Daniel D. Beck" Date: Tue, 12 Nov 2024 16:39:23 +0100 Subject: [PATCH 1/2] Error on deprecated compat keys 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. --- scripts/dist.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/scripts/dist.ts b/scripts/dist.ts index 795b7811113..24a2ebe06f7 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,10 @@ function toDist(sourcePath: string): YAML.Document { }); if (computedStatus.discouraged) { - logger.warn( + logger.error( `${id}: contains at least one deprecated compat feature and can never be Baseline. Was this intentional?`, ); + exitStatus = 1; } computedStatus = JSON.parse(computedStatus.toJSON()); From b259b5bf66cb26ce11f1a264c84acb47893ff8bb Mon Sep 17 00:00:00 2001 From: "Daniel D. Beck" Date: Wed, 13 Nov 2024 17:26:49 +0100 Subject: [PATCH 2/2] Warn for drafts; error for published features --- scripts/dist.ts | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/scripts/dist.ts b/scripts/dist.ts index 24a2ebe06f7..22ac8a3b3f4 100644 --- a/scripts/dist.ts +++ b/scripts/dist.ts @@ -234,10 +234,18 @@ function toDist(sourcePath: string): YAML.Document { }); if (computedStatus.discouraged) { - logger.error( - `${id}: contains at least one deprecated compat feature and can never be Baseline. Was this intentional?`, - ); - exitStatus = 1; + 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());