-
-
Notifications
You must be signed in to change notification settings - Fork 534
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(json_deserailize): remove visit_member_name
#618
Conversation
visit_member_name
Parser conformance results onjs/262
jsx/babel
symbols/microsoft
ts/babel
ts/microsoft
|
Thank you @Conaclos , could you also explain why you did this refactor? It would be great to have some context |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am going to block it so I get the notification when you update the PR. Could you please share any info on potential optimisations (memory and/or speed)?
_diagnostics: &mut Vec<DeserializationDiagnostic>, | ||
) -> Option<()> { | ||
unimplemented!("you should implement visit_member_value") | ||
unimplemented!("you should implement visit_plain_value") | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This crate is meant to create "events" on specific types so the consumer can do what they need on those types. By removing these visitors, we removed the ability to visit them. I don't think that's what we meant. It's like a simplified serde
.
While member_name
and member_value
can arguably be better names, plain_value
is more cryptic because it doesn't explain what we are visiting. Value of a key? And what about the keys themselves?
report_unknown_member_name( | ||
&name, | ||
&["name", "closureIndex", "dependenciesIndex"], | ||
diagnostics, | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is another change that I need help understanding. I should probably wait for your explanation.
Mainly to avoid checking twice if a key is valid. Before this PR we first check if the key is allowed in
In fact, I found
I don't see the purpose of I think we could go beyond by removing the |
54726c2
to
0a7ee71
Compare
The purpose of We had this system in the old Rome (typescript), too.
Because that's how the implementor does it, but that doesn't mean that we are meant to delete the original methods. We just need to not call a method if we can, or we don't need to. You can't know if in the future another implementor will need or not to use that visitor.
If you don't use it, it doesn't mean it's not needed and doesn't have a purpose. You should see this crate as a library for general purposes, not something specifically tailored over JSON. The idea is to have:
Then, each language names these types differently, but they are semantically the same. I hope this clarifies a bit things, please let me know if you have more questions |
Even in the case where we introduce a new config language, I doubt that we will be able to share code that uses
And value of list? And plain values?
I might disagree with you on this one. I prefer to add a feature when it is actually used or planned to be used. |
0a7ee71
to
4500bc8
Compare
4500bc8
to
36f65f4
Compare
And you never will, as long as we have
Any value, depending on the language we're parsing. TOML or YAML supports more values than JSON. But yes, plain values
We could remove what we don't use, not a big deal |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I caught some changes that aren't needed and some other changes should be reverted because they are breaking changes.
crates/biome_js_analyze/src/semantic_analyzers/correctness/use_exhaustive_dependencies.rs
Outdated
Show resolved
Hide resolved
crates/biome_js_analyze/src/semantic_analyzers/style/use_naming_convention.rs
Outdated
Show resolved
Hide resolved
12e3ca9
to
98568c5
Compare
98568c5
to
de38f70
Compare
de38f70
to
1a74a41
Compare
update snapshots with new CLI config readout add seemingly all implementations of conditional spacing add tests and fix some conditional spacing refactor(json_deserailize): remove `visit_member_name` (biomejs#618) re-add option after merge conflicts un-re-format changelog fix clippy lint input uses checked not value fix configuration codegen run format on js
Summary
visit_member_value
tovisit_value
visit_member_name
The removal of
visit_member_name
allowed the removal ofhas_only_known_keys
.This utility function is now replaced by
report_unknown_map_key
.It is called in
visit_map
when an unknown key is detected.I also replaced
has_only_known_variants
withreport_unknown_variant
.It is called in
visit_value
when an unknown variant is found.Test Plan
Ci should pass.
A CLI snapshot was updated because it now correctly report an unknown rule name.