Skip to content
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

feat(lint): set mdn_url via unambiguously related browser-compat frontmatter keys #25563

Merged
merged 19 commits into from
Jan 8, 2025

Conversation

caugner
Copy link
Contributor

@caugner caugner commented Jan 2, 2025

Summary

Fills the mdn_url field by matching BCD feature paths with browser-compat keys.

Test results and supporting details

Generally, the way this works is as follows:

  1. take the whole MDN content inventory,
  2. group all pages by BCD feature:
    • using the features referenced in the browser-compat frontmatter,
    • ignoring slug/feature combinations that don't "match" (i.e. one of their tails should contain the other)
  3. overwrite the mdn_url accordingly (unless the current url contains a fragment).

This has some caveats:

  • The "tail match" condition isn't necessarily perfect.

We could only add mdn_urls this way, but it would mean errors (e.g. duplicating a feature, not replacing the mdn_url) could slip through reviews and wouldn't get auto-fixed.

Related issues

See #25555 for a manual PR that should be solved automatically.

@github-actions github-actions bot added infra Infrastructure issues (npm, GitHub Actions, releases) of this project data:webext Compat data for Browser Extensions. https://developer.mozilla.org/Add-ons/WebExtensions data:api Compat data for Web APIs. https://developer.mozilla.org/docs/Web/API data:css Compat data for CSS features. https://developer.mozilla.org/docs/Web/CSS data:html Compat data for HTML elements. https://developer.mozilla.org/docs/Web/HTML linter Issues or pull requests regarding the tests / linter of the JSON files. data:svg Compat data for SVG features. https://developer.mozilla.org/docs/Web/SVG data:wasm Compat data for Web Assembly features. https://developer.mozilla.org/en-US/docs/WebAssembly size:l [PR only] 101-1000 LoC changed labels Jan 2, 2025
@caugner caugner force-pushed the add-mdn-urls-via-browser-compat-frontmatter branch from 09ade07 to 0b8d526 Compare January 2, 2025 19:31
@github-actions github-actions bot removed data:webext Compat data for Browser Extensions. https://developer.mozilla.org/Add-ons/WebExtensions data:svg Compat data for SVG features. https://developer.mozilla.org/docs/Web/SVG data:wasm Compat data for Web Assembly features. https://developer.mozilla.org/en-US/docs/WebAssembly labels Jan 2, 2025
css/properties/display.json Outdated Show resolved Hide resolved
api/CredentialsContainer.json Outdated Show resolved Hide resolved
html/elements/a.json Outdated Show resolved Hide resolved
@caugner caugner requested a review from queengooborg January 3, 2025 15:40
@github-actions github-actions bot added data:svg Compat data for SVG features. https://developer.mozilla.org/docs/Web/SVG data:wasm Compat data for Web Assembly features. https://developer.mozilla.org/en-US/docs/WebAssembly labels Jan 3, 2025
@github-actions github-actions bot added data:http Compat data for HTTP features. https://developer.mozilla.org/docs/Web/HTTP data:mathml Compat data for MathML features. https://developer.mozilla.org/docs/Web/MathML labels Jan 3, 2025
@caugner caugner changed the title Add mdn urls via browser-compat frontmatter Set mdn_url via unambiguously related browser-compat frontmatter keys Jan 3, 2025
@caugner caugner changed the title Set mdn_url via unambiguously related browser-compat frontmatter keys feat(lint): set mdn_url via unambiguously related browser-compat frontmatter keys Jan 3, 2025
@@ -4,7 +4,7 @@
"url": {
"__compat": {
"description": "`<url>`",
"mdn_url": "https://developer.mozilla.org/docs/Web/CSS/url_value",
"mdn_url": "https://developer.mozilla.org/docs/Web/CSS/url_function",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks wrong (in content), as this feature is about the url type, not the url() function.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see also #25413

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See also: #25582.

html/elements/input.json Outdated Show resolved Hide resolved
html/elements/input.json Outdated Show resolved Hide resolved
html/elements/input.json Outdated Show resolved Hide resolved
http/headers/Set-Cookie.json Outdated Show resolved Hide resolved
html/elements/select.json Outdated Show resolved Hide resolved
@Elchi3 Elchi3 self-requested a review January 7, 2025 10:21
lint/linter/test-mdn-urls.ts Outdated Show resolved Hide resolved
@github-actions github-actions bot removed the data:http Compat data for HTTP features. https://developer.mozilla.org/docs/Web/HTTP label Jan 7, 2025
lint/linter/test-mdn-urls.ts Outdated Show resolved Hide resolved
Copy link
Member

@Elchi3 Elchi3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work! 👍

@caugner caugner merged commit e6044d5 into main Jan 8, 2025
11 checks passed
@caugner caugner deleted the add-mdn-urls-via-browser-compat-frontmatter branch January 8, 2025 10:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
data:api Compat data for Web APIs. https://developer.mozilla.org/docs/Web/API data:css Compat data for CSS features. https://developer.mozilla.org/docs/Web/CSS data:html Compat data for HTML elements. https://developer.mozilla.org/docs/Web/HTML data:mathml Compat data for MathML features. https://developer.mozilla.org/docs/Web/MathML data:svg Compat data for SVG features. https://developer.mozilla.org/docs/Web/SVG data:wasm Compat data for Web Assembly features. https://developer.mozilla.org/en-US/docs/WebAssembly infra Infrastructure issues (npm, GitHub Actions, releases) of this project linter Issues or pull requests regarding the tests / linter of the JSON files. size:l [PR only] 101-1000 LoC changed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants