Skip to content

Add feature for discouraged import assertions #2565

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

Merged
merged 2 commits into from
Jan 23, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion features/css-modules.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
name: CSS import attributes
description: 'Module `import … with { type: "css" } statements load CSS modules as constructable stylesheets. Also known as CSS module scripts and formerly known as import assertions.'
description: 'Module `import … with { type: "css" } statements load CSS modules as constructable stylesheets. Also known as CSS module scripts.'
spec: https://html.spec.whatwg.org/multipage/webappapis.html#css-module-script
13 changes: 13 additions & 0 deletions features/import-assertions.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: Import assertions
description: 'Module `import … assert { type: "json" }` and `import … assert { type: "css" }` JavaScript statements load JSON and CSS data.'
spec: https://github.com/tc39/proposal-import-attributes/tree/abca60286360b47f9a6be25a28f489c2cb157beb
discouraged:
according_to:
- https://github.com/tc39/proposal-import-attributes/pull/131
alternatives:
- css-modules
- json-modules
compat_features:
- javascript.statements.import.import_assertions
- javascript.statements.import.import_assertions.type_css
- javascript.statements.import.import_assertions.type_json
10 changes: 10 additions & 0 deletions features/import-assertions.yml.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Generated from: import-assertions.yml
# Do not edit this file by hand. Edit the source file instead!

status:
baseline: false
support: {}
compat_features:
- javascript.statements.import.import_assertions
- javascript.statements.import.import_assertions.type_css
- javascript.statements.import.import_assertions.type_json
2 changes: 1 addition & 1 deletion features/json-modules.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: JSON import attributes
description: 'Module `import … with { type: "json" }` statements load JSON data. Also known as JSON module scripts and formerly known as import assertions.'
description: 'Module `import … with { type: "json" }` statements load JSON data. Also known as JSON module scripts.'
spec: https://html.spec.whatwg.org/multipage/webappapis.html#json-module-script
group: json
# TODO: Tag javascript.statements.import when https://github.com/web-platform-dx/web-features/issues/1173 is resolved.
4 changes: 4 additions & 0 deletions scripts/specs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,10 @@ const defaultAllowlist: allowlistItem[] = [
[
"https://immersive-web.github.io/webvr/spec/1.1/",
"Allowed because this is the legacy spec that defines WebVR."
],
[
"https://github.com/tc39/proposal-import-attributes/tree/abca60286360b47f9a6be25a28f489c2cb157beb",
"Allowed because import assertions were replaced in-place by import attributes. Remove this exception when javascript.statements.import.import_assertions is dropped from BCD in June 2026."
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice-to-have: a script that goes over this array and checks if the specs listed here are actually used in features. This way we don't need to remember to remove items.

]
];

Expand Down
Loading