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

refactor(aria): move properties to aria-metdata #4481

Merged
merged 1 commit into from
Nov 7, 2024

Conversation

Conaclos
Copy link
Member

@Conaclos Conaclos commented Nov 6, 2024

Summary

Part of #4241.
This PR moves aria properties from biome-aria to biome-aria-metadata.
I renamed AriaPropertiesEnum to AriaAttribute because aria properties includes both aria properties and aria states.
This is also the name used by MDN.

I also renamed AriaPropertyType to AriaValueType and added the tokens directly in the Token and TokenList variants.

I didn't see the utility of declaring a service for retrieving the Aria attributes. So, I removed the service.
This allows to use the Ast query instead of the Aria query in some rules.
Once #4241 completed, we will certainly get rid of the Aria query.

Also, we should certainly merge the biome-aria and biome-aria-metadata crates.

Test Plan

O updated the snapshots.
The only side effect of the change is some reordering of tokens: I placed the default token first.

@github-actions github-actions bot added A-Linter Area: linter A-Formatter Area: formatter L-JavaScript Language: JavaScript and super languages labels Nov 6, 2024
Comment on lines +362 to +372
let default_value = data
.values
.iter()
.find(|(_, data)| data.is_default)
.map(|(name, _)| name);
let other_values = data
.values
.iter()
.filter(|(_, data)| !data.is_default)
.map(|(name, _)| name);
let values = default_value.into_iter().chain(other_values);
Copy link
Member Author

@Conaclos Conaclos Nov 6, 2024

Choose a reason for hiding this comment

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

This part is responsible for the reordering of values in the snapshots.

@Conaclos Conaclos requested review from a team November 6, 2024 20:02
@Conaclos Conaclos force-pushed the conaclos/biome-aria-metdata-aria-attributes branch from ea077f7 to 383a0cd Compare November 6, 2024 20:04
@ematipico
Copy link
Member

We should write somewhere instructions on how to update these data. I know we have a scraper, did we write somewhere how to use it?

Copy link

codspeed-hq bot commented Nov 6, 2024

CodSpeed Performance Report

Merging #4481 will not alter performance

Comparing conaclos/biome-aria-metdata-aria-attributes (383a0cd) with main (d9d7bd7)

Summary

✅ 99 untouched benchmarks

@Conaclos
Copy link
Member Author

Conaclos commented Nov 6, 2024

We should write somewhere instructions on how to update these data. I know we have a scraper, did we write somewhere how to use it?

I previously introduced CONTRIBUTING.ms in biome_aria_metadata. Have you other suggestions?

@ematipico
Copy link
Member

We should write somewhere instructions on how to update these data. I know we have a scraper, did we write somewhere how to use it?

I previously introduced CONTRIBUTING.ms in biome_aria_metadata. Have you other suggestions?

I think it's enough. Thank you!

@Conaclos Conaclos merged commit 3fe9193 into main Nov 7, 2024
12 checks passed
@Conaclos Conaclos deleted the conaclos/biome-aria-metdata-aria-attributes branch November 7, 2024 09:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Formatter Area: formatter A-Linter Area: linter L-JavaScript Language: JavaScript and super languages
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants