use rslint_parser::{
    ast::{JsAnyArrayElement, JsArrayExpression, JsArrayHole},
    AstSeparatedList,
};

impl ToFormatElement for JsArrayExpression {
    fn to_format_element(&self, formatter: &Formatter) -> FormatResult<FormatElement> {
        let elements = self.elements();

        Ok(group_elements(formatter.format_delimited(
            &self.l_brack_token()?,
            |open_token_trailing, close_token_leading| {
                // Specifically do not use format_separated as array expressions need
                // separators inserted after empty expressions regardless of the
                // formatting since this makes a semantic difference