Skip to content

Commit

Permalink
Error on deprecated compat keys (#2210)
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
ddbeck and Elchi3 authored Nov 13, 2024
1 parent 955bc01 commit e51f69a
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions scripts/dist.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.`,
);
}
Expand Down Expand Up @@ -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());
Expand Down

0 comments on commit e51f69a

Please sign in to comment.