Skip to content

Baseline data incorrect in npm package #2762

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
nzakas opened this issue Mar 11, 2025 · 7 comments
Open

Baseline data incorrect in npm package #2762

nzakas opened this issue Mar 11, 2025 · 7 comments

Comments

@nzakas
Copy link

nzakas commented Mar 11, 2025

It looks like the npm package collapses all features in a single YAML file and just uses the baseline status at the top. This results in incorrect baseline status for features where some of the features are low while others are high.

For example, overflow is a baseline high status according to this file (in the comments, not at the top):
https://github.com/web-platform-dx/web-features/blob/main/features/overflow-shorthand.yml.dist

However, in the npm package, it's listed as baseline low. Here's a printout:
https://gist.github.com/nzakas/5bbc9eab6900d1e401208fa7bcf49500#file-css-web-features-json-L6962-L7004

This problem makes it difficult to perform validation based on baseline status.

@tidoust
Copy link
Member

tidoust commented Mar 11, 2025

For example, overflow is a baseline high status according to this file (in the comments, not at the top):
https://github.com/web-platform-dx/web-features/blob/main/features/overflow-shorthand.yml.dist

In this example, the baseline high comments apply to the keys immediately below them. But there are more keys and more comments if you scroll down, and the last keys are not baseline high:
https://github.com/web-platform-dx/web-features/blob/main/features/overflow-shorthand.yml.dist#L105-L119

The last keys are the ones that make the overall overflow feature baseline low.

@nzakas
Copy link
Author

nzakas commented Mar 11, 2025

Gotcha, thanks for explaining. The end result is the same: the baseline value is incorrect in the npm package for most of the features in this file.

@tidoust
Copy link
Member

tidoust commented Mar 11, 2025

Right, the baseline value in the web-features package only applies to the overall feature itself. It is not meant to be applied to the individual BCD keys that compose the feature, although it would be great to have more data on which BCD keys were considered to compute the baseline value (some of it is tracked in #2248). In most cases, the baseline status of the overall feature will be lower than the baseline status of the individual BCD keys.

Wouldn't the compute-baseline package give you what you're looking for, meaning a way to compute a Baseline status for one or more BCD keys?

@atopal
Copy link
Collaborator

atopal commented Mar 12, 2025

@nzakas we actually do have the per key Baseline data available in the releases here on Github. It's in the data.extended.json file. There is a by_compat_key property as part of the feature object. Would that solve your problem?

Also, cc @rviscomi who's been looking into the distinction between keys and features.

@rviscomi
Copy link
Contributor

Yup, after following this discussion I've staged a PR that uses compute-baseline to (hopefully) address this in ESLint: eslint/css#82

@nzakas
Copy link
Author

nzakas commented Mar 12, 2025

Ah nice, thanks. I'll work with @rviscomi on this.

It may be worth calling out this distinction on the web-features README?

@atopal
Copy link
Collaborator

atopal commented Mar 12, 2025

I think you're right. We initially built this for MDN, since their pages are very granular and that's where the keys originally come from, but there are probably a lot more use cases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants