Use ?. where it represents the intended semantics (#11512)
This commit is contained in:
@@ -21,7 +21,7 @@ export function BlockStatement(node: Object) {
|
||||
this.token("{");
|
||||
this.printInnerComments(node);
|
||||
|
||||
const hasDirectives = node.directives && node.directives.length;
|
||||
const hasDirectives = node.directives?.length;
|
||||
|
||||
if (node.body.length || hasDirectives) {
|
||||
this.newline();
|
||||
|
||||
@@ -147,7 +147,7 @@ export function ImportDeclaration(node: Object) {
|
||||
}
|
||||
|
||||
const specifiers = node.specifiers.slice(0);
|
||||
if (specifiers && specifiers.length) {
|
||||
if (specifiers?.length) {
|
||||
// print "special" specifiers first
|
||||
for (;;) {
|
||||
const first = specifiers[0];
|
||||
|
||||
Reference in New Issue
Block a user