-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Linter: Make sure multiple version ranges are sorted according to some rules #1596
Comments
I opened #1996 earlier with this same intent after finding a problem with the ServiceWorker page: On the ServiceWorker page, this happens: The problem here is that the support array first has the information about Edge 16, where the feature is supported behind a flag, and then subsequently has information about Edge 17, where it's fully supported by default. The browser-compat-data/api/ServiceWorker.json Lines 16 to 29 in 6cad84a
The reason this is a problem is because Kumascript assumes that the support array will have the proper support info first, which in this case doesn't happen. See these lines in kumascript: // the first entry should be the most relevant/recent and will be treated as "the truth"
checkSupport(supportInfo[0].version_added, supportInfo[0].version_removed); If we make this assumption, we should try to enforce it with the linter somehow, though I'm not sure how you'd go about doing that. 🤔 Here's an example where it works properlyFrom the flex page browser-compat-data/css/properties/flex.json Lines 44 to 78 in 01c2b6d
|
As concerns display of BCD on MDN, this has meanwhile been addressed by mdn/yari#5649 (support history) and mdn/yari#5946 (support cell). /cc @queengooborg |
FWIW This ranking/ordering algorithm implemented in yari is even a bit more sophisticated than the one suggested in #5352. But ... I also wonder if it wouldn't be best to distinguish between repository and (npm) package. In particular, always ordering items in the repository simply by their lowest version_number (i.e. In packaged BCD, the most relevant item could be moved to the top. Alternative approaches for the packaged BCD would be:
type SupportStatusSummary =
| { implemented: "never" }
| {
implemented: "partial" | "full"
alternative_name?: string
flags?: Array<{type: string, name: string, value_to_set: string}>
version_added: string,
version_removed?: string
} |
I personally feel that we should keep the contributor version as close to the bundled version as possible, and that this shouldn't introduce a schema-changing update. However, I'd be down to implement a sorting algorithm based on Yari's own, to synchronize the rendering on Yari with what other consumers will receive! |
I've merged the PRs for migration 005, with the intention that we can follow-up with any changes to sorting in the later, should we desire to do so. (Not that it matters as much now, since Yari has their own sorting.) |
Given multiple version ranges ...
we should make sure that the first array element is always the most relevant (as this one will appear in the main compat cell).
For that we need to come up with some rules to guarantee "most relevant" first and generally make sense of the ordering there. Thoughts:
The text was updated successfully, but these errors were encountered: