perf(prettier): check commandjs or amd in CallExpression only (#1491)

This commit is contained in:
Dunqing 2023-11-22 10:57:31 +08:00 committed by GitHub
parent 064353c97e
commit 79c67d15c0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -78,7 +78,11 @@ fn print_call_expression_arguments<'a>(
let callee = expression.callee();
let arguments = expression.arguments();
let should_break = !is_commons_js_or_amd_call(expression.callee(), arguments);
let should_break = if matches!(expression, CallExpressionLike::CallExpression(_)) {
!is_commons_js_or_amd_call(expression.callee(), arguments)
} else {
true
};
if arguments.is_empty() {
parts.extend(p.print_inner_comment(Span::new(callee.span().end, expression.span().end)));