forked from rome/tools
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(rome_js_parser): support property init in ambient context (new n…
…ode) (rome#4225)
- Loading branch information
Showing
24 changed files
with
1,148 additions
and
89 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
crates/rome_js_formatter/src/ts/classes/initialized_property_signature_class_member.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
use crate::js::classes::property_class_member::{ | ||
AnyJsPropertyClassMember, FormatClassPropertySemicolon, | ||
}; | ||
use crate::prelude::*; | ||
use crate::utils::AnyJsAssignmentLike; | ||
use rome_formatter::write; | ||
use rome_js_syntax::TsInitializedPropertySignatureClassMember; | ||
#[derive(Debug, Clone, Default)] | ||
pub(crate) struct FormatTsInitializedPropertySignatureClassMember; | ||
impl FormatNodeRule<TsInitializedPropertySignatureClassMember> | ||
for FormatTsInitializedPropertySignatureClassMember | ||
{ | ||
fn fmt_fields( | ||
&self, | ||
node: &TsInitializedPropertySignatureClassMember, | ||
f: &mut JsFormatter, | ||
) -> FormatResult<()> { | ||
let semicolon_token = node.semicolon_token(); | ||
|
||
write!( | ||
f, | ||
[ | ||
AnyJsAssignmentLike::from(node.clone()), | ||
FormatClassPropertySemicolon::new( | ||
&AnyJsPropertyClassMember::from(node.clone()), | ||
semicolon_token.as_ref() | ||
) | ||
] | ||
) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
crates/rome_js_formatter/tests/specs/ts/class/readonly_ambient_property.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
declare class A { | ||
readonly prop = "value"; | ||
|
||
|
||
} | ||
export class B { | ||
|
||
declare readonly prop = "value__value__value__value__value__value__value"; | ||
|
||
} |
Oops, something went wrong.