-
-
Notifications
You must be signed in to change notification settings - Fork 475
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(biome_analyze): add RuleAction::new
#2820
refactor(biome_analyze): add RuleAction::new
#2820
Conversation
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.
Forgot to mention that, but this should be impl Into<Applicability>
, so inside the rule we can pass ctx.metadata().fix_kind
CodSpeed Performance ReportMerging #2820 will not alter performanceComparing Summary
|
f68d593
to
c673e9d
Compare
c673e9d
to
fc0dd8a
Compare
crates/biome_analyze/src/rule.rs
Outdated
pub fn new( | ||
category: ActionCategory, | ||
applicability: impl Into<Applicability>, | ||
message: MarkupBuf, |
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 think this can be changed into message: Markup
, so we can move the .to_owned()
inside this function, the caller won't need to do it anymore
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.
Based on this SO answer I don't think impl ToOwned
is the right way to go, at least for now. I think that would require significant changes to how Markup
and MarkupBuf
are implemented.
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.
Actually, we need impl biome_console::fmt::Display
.
Then inside the new
function, we call markup!().to_owned
fc0dd8a
to
679fea3
Compare
crates/biome_js_analyze/src/assists/correctness/organize_imports.rs
Outdated
Show resolved
Hide resolved
73c6cb1
to
8b0ee6a
Compare
3fe941a
to
f42b6ce
Compare
f42b6ce
to
40b9736
Compare
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.
That's awesome!
Summary
For #2799, we want to phase out the manual construction of the
RuleAction
struct to make theapplicability
field private.This is intensionally small to make it easy to review before I do a huge codemod to actually phase out the manual construction.
related to: #2799
Test Plan
It compiles.