mirror of
https://github.com/danbulant/oxc
synced 2026-05-24 12:21:58 +00:00
feat(prettier): support format function for ImportExpression (#1399)
This commit is contained in:
parent
f5894b636b
commit
7951849ec1
2 changed files with 15 additions and 9 deletions
|
|
@ -1546,7 +1546,20 @@ impl<'a> Format<'a> for ParenthesizedExpression<'a> {
|
|||
|
||||
impl<'a> Format<'a> for ImportExpression<'a> {
|
||||
fn format(&self, p: &mut Prettier<'a>) -> Doc<'a> {
|
||||
Doc::Line
|
||||
let mut parts = p.vec();
|
||||
parts.push(ss!("import"));
|
||||
parts.push(ss!("("));
|
||||
parts.push(format!(p, self.source));
|
||||
if !self.arguments.is_empty() {
|
||||
for arg in &self.arguments {
|
||||
parts.push(ss!(","));
|
||||
parts.push(Doc::Line);
|
||||
parts.push(format!(p, arg));
|
||||
}
|
||||
}
|
||||
parts.push(ss!(")"));
|
||||
|
||||
Doc::Group(parts)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
Compatibility: 83/881 (9.42%)
|
||||
Compatibility: 90/881 (10.22%)
|
||||
|
||||
# Failed
|
||||
|
||||
|
|
@ -121,9 +121,7 @@ Compatibility: 83/881 (9.42%)
|
|||
* babel-plugins/flow.js
|
||||
* babel-plugins/function-bind.js
|
||||
* babel-plugins/function-sent.js
|
||||
* babel-plugins/import-assertions-dynamic.js
|
||||
* babel-plugins/import-assertions-static.js
|
||||
* babel-plugins/import-attributes-dynamic.js
|
||||
* babel-plugins/import-attributes-static.js
|
||||
* babel-plugins/import-meta.js
|
||||
* babel-plugins/import-reflection.js
|
||||
|
|
@ -443,7 +441,6 @@ Compatibility: 83/881 (9.42%)
|
|||
* do/do.js
|
||||
|
||||
### dynamic-import
|
||||
* dynamic-import/assertions.js
|
||||
* dynamic-import/test.js
|
||||
|
||||
### empty-paren-comment
|
||||
|
|
@ -609,7 +606,6 @@ Compatibility: 83/881 (9.42%)
|
|||
* import/same-local-and-imported.js
|
||||
|
||||
### import-assertions
|
||||
* import-assertions/dynamic-import.js
|
||||
* import-assertions/empty.js
|
||||
* import-assertions/multi-types.js
|
||||
* import-assertions/non-type.js
|
||||
|
|
@ -619,12 +615,10 @@ Compatibility: 83/881 (9.42%)
|
|||
* import-assertions/without-from.js
|
||||
|
||||
### import-assertions/bracket-spacing
|
||||
* import-assertions/bracket-spacing/dynamic-import.js
|
||||
* import-assertions/bracket-spacing/re-export.js
|
||||
* import-assertions/bracket-spacing/static-import.js
|
||||
|
||||
### import-attributes
|
||||
* import-attributes/dynamic-import.js
|
||||
* import-attributes/empty.js
|
||||
* import-attributes/multi-types.js
|
||||
* import-attributes/non-type.js
|
||||
|
|
@ -633,7 +627,6 @@ Compatibility: 83/881 (9.42%)
|
|||
* import-attributes/without-from.js
|
||||
|
||||
### import-attributes/bracket-spacing
|
||||
* import-attributes/bracket-spacing/dynamic-import.js
|
||||
* import-attributes/bracket-spacing/empty.js
|
||||
* import-attributes/bracket-spacing/re-export.js
|
||||
* import-attributes/bracket-spacing/static-import.js
|
||||
|
|
|
|||
Loading…
Reference in a new issue