--- source: crates/biome_js_analyze/tests/spec_tests.rs expression: invalid-module.cjs --- # Input ```cjs if (foo) { var a; function foo() {} } ``` # Diagnostics ``` invalid-module.cjs:2:2 lint/correctness/noInnerDeclarations ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! This var should be declared at the root of the script. 1 │ if (foo) { > 2 │ var a; │ ^^^^^ 3 │ function foo() {} 4 │ } i The var is accessible in the whole body of the script. To avoid confusion, it should be declared at the root of the script. ``` ``` invalid-module.cjs:3:2 lint/correctness/noInnerDeclarations ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! This function should be declared at the root of the script. 1 │ if (foo) { 2 │ var a; > 3 │ function foo() {} │ ^^^^^^^^^^^^^^^^^ 4 │ } i The function is accessible in the whole body of the script. To avoid confusion, it should be declared at the root of the script. ```