biome_js_parser 0.5.7

Biome's JavaScript parser
Documentation
JsModule {
    bom_token: missing (optional),
    interpreter_token: missing (optional),
    directives: JsDirectiveList [],
    items: JsModuleItemList [
        JsVariableStatement {
            declaration: JsVariableDeclaration {
                await_token: missing (optional),
                kind: LET_KW@0..4 "let" [] [Whitespace(" ")],
                declarators: JsVariableDeclaratorList [
                    JsVariableDeclarator {
                        id: JsIdentifierBinding {
                            name_token: IDENT@4..5 "a" [] [],
                        },
                        variable_annotation: missing (optional),
                        initializer: missing (optional),
                    },
                    COMMA@5..7 "," [] [Whitespace(" ")],
                    JsVariableDeclarator {
                        id: JsObjectBindingPattern {
                            l_curly_token: L_CURLY@7..9 "{" [] [Whitespace(" ")],
                            properties: JsObjectBindingPatternPropertyList [
                                JsObjectBindingPatternShorthandProperty {
                                    identifier: JsIdentifierBinding {
                                        name_token: IDENT@9..11 "b" [] [Whitespace(" ")],
                                    },
                                    init: missing (optional),
                                },
                            ],
                            r_curly_token: R_CURLY@11..13 "}" [] [Whitespace(" ")],
                        },
                        variable_annotation: missing (optional),
                        initializer: JsInitializerClause {
                            eq_token: EQ@13..15 "=" [] [Whitespace(" ")],
                            expression: JsObjectExpression {
                                l_curly_token: L_CURLY@15..17 "{" [] [Whitespace(" ")],
                                members: JsObjectMemberList [
                                    JsPropertyObjectMember {
                                        name: JsLiteralMemberName {
                                            value: IDENT@17..18 "a" [] [],
                                        },
                                        colon_token: COLON@18..20 ":" [] [Whitespace(" ")],
                                        value: JsNumberLiteralExpression {
                                            value_token: JS_NUMBER_LITERAL@20..23 "10" [] [Whitespace(" ")],
                                        },
                                    },
                                ],
                                r_curly_token: R_CURLY@23..24 "}" [] [],
                            },
                        },
                    },
                ],
            },
            semicolon_token: missing (optional),
        },
        JsVariableStatement {
            declaration: JsVariableDeclaration {
                await_token: missing (optional),
                kind: CONST_KW@24..31 "const" [Newline("\n")] [Whitespace(" ")],
                declarators: JsVariableDeclaratorList [
                    JsVariableDeclarator {
                        id: JsIdentifierBinding {
                            name_token: IDENT@31..33 "c" [] [Whitespace(" ")],
                        },
                        variable_annotation: missing (optional),
                        initializer: JsInitializerClause {
                            eq_token: EQ@33..35 "=" [] [Whitespace(" ")],
                            expression: JsNumberLiteralExpression {
                                value_token: JS_NUMBER_LITERAL@35..36 "1" [] [],
                            },
                        },
                    },
                    COMMA@36..38 "," [] [Whitespace(" ")],
                    JsVariableDeclarator {
                        id: JsObjectBindingPattern {
                            l_curly_token: L_CURLY@38..40 "{" [] [Whitespace(" ")],
                            properties: JsObjectBindingPatternPropertyList [
                                JsObjectBindingPatternShorthandProperty {
                                    identifier: JsIdentifierBinding {
                                        name_token: IDENT@40..42 "d" [] [Whitespace(" ")],
                                    },
                                    init: missing (optional),
                                },
                            ],
                            r_curly_token: R_CURLY@42..44 "}" [] [Whitespace(" ")],
                        },
                        variable_annotation: missing (optional),
                        initializer: JsInitializerClause {
                            eq_token: EQ@44..46 "=" [] [Whitespace(" ")],
                            expression: JsObjectExpression {
                                l_curly_token: L_CURLY@46..48 "{" [] [Whitespace(" ")],
                                members: JsObjectMemberList [
                                    JsPropertyObjectMember {
                                        name: JsLiteralMemberName {
                                            value: IDENT@48..49 "a" [] [],
                                        },
                                        colon_token: COLON@49..51 ":" [] [Whitespace(" ")],
                                        value: JsNumberLiteralExpression {
                                            value_token: JS_NUMBER_LITERAL@51..54 "10" [] [Whitespace(" ")],
                                        },
                                    },
                                ],
                                r_curly_token: R_CURLY@54..55 "}" [] [],
                            },
                        },
                    },
                ],
            },
            semicolon_token: missing (optional),
        },
        JsVariableStatement {
            declaration: JsVariableDeclaration {
                await_token: missing (optional),
                kind: CONST_KW@55..62 "const" [Newline("\n")] [Whitespace(" ")],
                declarators: JsVariableDeclaratorList [
                    JsVariableDeclarator {
                        id: JsIdentifierBinding {
                            name_token: IDENT@62..63 "e" [] [],
                        },
                        variable_annotation: missing (optional),
                        initializer: missing (optional),
                    },
                ],
            },
            semicolon_token: SEMICOLON@63..64 ";" [] [],
        },
        JsVariableStatement {
            declaration: JsVariableDeclaration {
                await_token: missing (optional),
                kind: LET_KW@64..69 "let" [Newline("\n")] [Whitespace(" ")],
                declarators: JsVariableDeclaratorList [
                    JsVariableDeclarator {
                        id: JsArrayBindingPattern {
                            l_brack_token: L_BRACK@69..70 "[" [] [],
                            elements: JsArrayBindingPatternElementList [
                                JsArrayBindingPatternElement {
                                    pattern: JsIdentifierBinding {
                                        name_token: IDENT@70..71 "f" [] [],
                                    },
                                    init: missing (optional),
                                },
                            ],
                            r_brack_token: R_BRACK@71..72 "]" [] [],
                        },
                        variable_annotation: missing (optional),
                        initializer: missing (optional),
                    },
                ],
            },
            semicolon_token: SEMICOLON@72..73 ";" [] [],
        },
        JsVariableStatement {
            declaration: JsVariableDeclaration {
                await_token: missing (optional),
                kind: CONST_KW@73..80 "const" [Newline("\n")] [Whitespace(" ")],
                declarators: JsVariableDeclaratorList [
                    JsVariableDeclarator {
                        id: JsObjectBindingPattern {
                            l_curly_token: L_CURLY@80..82 "{" [] [Whitespace(" ")],
                            properties: JsObjectBindingPatternPropertyList [
                                JsObjectBindingPatternShorthandProperty {
                                    identifier: JsIdentifierBinding {
                                        name_token: IDENT@82..84 "g" [] [Whitespace(" ")],
                                    },
                                    init: missing (optional),
                                },
                            ],
                            r_curly_token: R_CURLY@84..85 "}" [] [],
                        },
                        variable_annotation: missing (optional),
                        initializer: missing (optional),
                    },
                ],
            },
            semicolon_token: SEMICOLON@85..86 ";" [] [],
        },
    ],
    eof_token: EOF@86..87 "" [Newline("\n")] [],
}

0: JS_MODULE@0..87
  0: (empty)
  1: (empty)
  2: JS_DIRECTIVE_LIST@0..0
  3: JS_MODULE_ITEM_LIST@0..86
    0: JS_VARIABLE_STATEMENT@0..24
      0: JS_VARIABLE_DECLARATION@0..24
        0: (empty)
        1: LET_KW@0..4 "let" [] [Whitespace(" ")]
        2: JS_VARIABLE_DECLARATOR_LIST@4..24
          0: JS_VARIABLE_DECLARATOR@4..5
            0: JS_IDENTIFIER_BINDING@4..5
              0: IDENT@4..5 "a" [] []
            1: (empty)
            2: (empty)
          1: COMMA@5..7 "," [] [Whitespace(" ")]
          2: JS_VARIABLE_DECLARATOR@7..24
            0: JS_OBJECT_BINDING_PATTERN@7..13
              0: L_CURLY@7..9 "{" [] [Whitespace(" ")]
              1: JS_OBJECT_BINDING_PATTERN_PROPERTY_LIST@9..11
                0: JS_OBJECT_BINDING_PATTERN_SHORTHAND_PROPERTY@9..11
                  0: JS_IDENTIFIER_BINDING@9..11
                    0: IDENT@9..11 "b" [] [Whitespace(" ")]
                  1: (empty)
              2: R_CURLY@11..13 "}" [] [Whitespace(" ")]
            1: (empty)
            2: JS_INITIALIZER_CLAUSE@13..24
              0: EQ@13..15 "=" [] [Whitespace(" ")]
              1: JS_OBJECT_EXPRESSION@15..24
                0: L_CURLY@15..17 "{" [] [Whitespace(" ")]
                1: JS_OBJECT_MEMBER_LIST@17..23
                  0: JS_PROPERTY_OBJECT_MEMBER@17..23
                    0: JS_LITERAL_MEMBER_NAME@17..18
                      0: IDENT@17..18 "a" [] []
                    1: COLON@18..20 ":" [] [Whitespace(" ")]
                    2: JS_NUMBER_LITERAL_EXPRESSION@20..23
                      0: JS_NUMBER_LITERAL@20..23 "10" [] [Whitespace(" ")]
                2: R_CURLY@23..24 "}" [] []
      1: (empty)
    1: JS_VARIABLE_STATEMENT@24..55
      0: JS_VARIABLE_DECLARATION@24..55
        0: (empty)
        1: CONST_KW@24..31 "const" [Newline("\n")] [Whitespace(" ")]
        2: JS_VARIABLE_DECLARATOR_LIST@31..55
          0: JS_VARIABLE_DECLARATOR@31..36
            0: JS_IDENTIFIER_BINDING@31..33
              0: IDENT@31..33 "c" [] [Whitespace(" ")]
            1: (empty)
            2: JS_INITIALIZER_CLAUSE@33..36
              0: EQ@33..35 "=" [] [Whitespace(" ")]
              1: JS_NUMBER_LITERAL_EXPRESSION@35..36
                0: JS_NUMBER_LITERAL@35..36 "1" [] []
          1: COMMA@36..38 "," [] [Whitespace(" ")]
          2: JS_VARIABLE_DECLARATOR@38..55
            0: JS_OBJECT_BINDING_PATTERN@38..44
              0: L_CURLY@38..40 "{" [] [Whitespace(" ")]
              1: JS_OBJECT_BINDING_PATTERN_PROPERTY_LIST@40..42
                0: JS_OBJECT_BINDING_PATTERN_SHORTHAND_PROPERTY@40..42
                  0: JS_IDENTIFIER_BINDING@40..42
                    0: IDENT@40..42 "d" [] [Whitespace(" ")]
                  1: (empty)
              2: R_CURLY@42..44 "}" [] [Whitespace(" ")]
            1: (empty)
            2: JS_INITIALIZER_CLAUSE@44..55
              0: EQ@44..46 "=" [] [Whitespace(" ")]
              1: JS_OBJECT_EXPRESSION@46..55
                0: L_CURLY@46..48 "{" [] [Whitespace(" ")]
                1: JS_OBJECT_MEMBER_LIST@48..54
                  0: JS_PROPERTY_OBJECT_MEMBER@48..54
                    0: JS_LITERAL_MEMBER_NAME@48..49
                      0: IDENT@48..49 "a" [] []
                    1: COLON@49..51 ":" [] [Whitespace(" ")]
                    2: JS_NUMBER_LITERAL_EXPRESSION@51..54
                      0: JS_NUMBER_LITERAL@51..54 "10" [] [Whitespace(" ")]
                2: R_CURLY@54..55 "}" [] []
      1: (empty)
    2: JS_VARIABLE_STATEMENT@55..64
      0: JS_VARIABLE_DECLARATION@55..63
        0: (empty)
        1: CONST_KW@55..62 "const" [Newline("\n")] [Whitespace(" ")]
        2: JS_VARIABLE_DECLARATOR_LIST@62..63
          0: JS_VARIABLE_DECLARATOR@62..63
            0: JS_IDENTIFIER_BINDING@62..63
              0: IDENT@62..63 "e" [] []
            1: (empty)
            2: (empty)
      1: SEMICOLON@63..64 ";" [] []
    3: JS_VARIABLE_STATEMENT@64..73
      0: JS_VARIABLE_DECLARATION@64..72
        0: (empty)
        1: LET_KW@64..69 "let" [Newline("\n")] [Whitespace(" ")]
        2: JS_VARIABLE_DECLARATOR_LIST@69..72
          0: JS_VARIABLE_DECLARATOR@69..72
            0: JS_ARRAY_BINDING_PATTERN@69..72
              0: L_BRACK@69..70 "[" [] []
              1: JS_ARRAY_BINDING_PATTERN_ELEMENT_LIST@70..71
                0: JS_ARRAY_BINDING_PATTERN_ELEMENT@70..71
                  0: JS_IDENTIFIER_BINDING@70..71
                    0: IDENT@70..71 "f" [] []
                  1: (empty)
              2: R_BRACK@71..72 "]" [] []
            1: (empty)
            2: (empty)
      1: SEMICOLON@72..73 ";" [] []
    4: JS_VARIABLE_STATEMENT@73..86
      0: JS_VARIABLE_DECLARATION@73..85
        0: (empty)
        1: CONST_KW@73..80 "const" [Newline("\n")] [Whitespace(" ")]
        2: JS_VARIABLE_DECLARATOR_LIST@80..85
          0: JS_VARIABLE_DECLARATOR@80..85
            0: JS_OBJECT_BINDING_PATTERN@80..85
              0: L_CURLY@80..82 "{" [] [Whitespace(" ")]
              1: JS_OBJECT_BINDING_PATTERN_PROPERTY_LIST@82..84
                0: JS_OBJECT_BINDING_PATTERN_SHORTHAND_PROPERTY@82..84
                  0: JS_IDENTIFIER_BINDING@82..84
                    0: IDENT@82..84 "g" [] [Whitespace(" ")]
                  1: (empty)
              2: R_CURLY@84..85 "}" [] []
            1: (empty)
            2: (empty)
      1: SEMICOLON@85..86 ";" [] []
  4: EOF@86..87 "" [Newline("\n")] []
--
variable_declaration_statement_err.js:3:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

  × Const declarations must have an initialized value.
  
    1 │ let a, { b } = { a: 10 }
    2 │ const c = 1, { d } = { a: 10 }
  > 3 │ const e;
      │       ^
    4 │ let [f];
    5 │ const { g };
  
  i This variable needs to be initialized.
  
--
variable_declaration_statement_err.js:4:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

  × Object and Array patterns require initializers.
  
    2 │ const c = 1, { d } = { a: 10 }
    3 │ const e;
  > 4 │ let [f];
      │     ^^^
    5 │ const { g };
    6 │ 
  
  i This pattern is declared, but it is not given an initialized value.
  
--
variable_declaration_statement_err.js:5:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

  × Object and Array patterns require initializers.
  
    3 │ const e;
    4 │ let [f];
  > 5 │ const { g };
      │       ^^^^^
    6 │ 
  
  i This pattern is declared, but it is not given an initialized value.
  
--
let a, { b } = { a: 10 }
const c = 1, { d } = { a: 10 }
const e;
let [f];
const { g };