--- source: crates/biome_js_analyze/tests/spec_tests.rs expression: invalid.jsonc --- # Input ```cjs var a = 3; var a = 10; ``` # Diagnostics ``` invalid.jsonc:1:16 lint/suspicious/noRedeclare ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! Shouldn't redeclare 'a'. Consider to delete it or rename it. > 1 │ var a = 3; var a = 10; │ ^ i 'a' is defined here: > 1 │ var a = 3; var a = 10; │ ^ ``` # Input ```cjs var c; { var a; var a;} ``` # Diagnostics ``` invalid.jsonc:1:21 lint/suspicious/noRedeclare ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! Shouldn't redeclare 'a'. Consider to delete it or rename it. > 1 │ var c; { var a; var a;}· │ ^ i 'a' is defined here: > 1 │ var c; { var a; var a;}· │ ^ ``` # Input ```cjs var a; { function a(){} } ``` # Diagnostics ``` invalid.jsonc:1:19 lint/suspicious/noRedeclare ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! Shouldn't redeclare 'a'. Consider to delete it or rename it. > 1 │ var a; { function a(){} } │ ^ i 'a' is defined here: > 1 │ var a; { function a(){} } │ ^ ``` # Input ```cjs switch(foo) { case a: var b = 3; case b: var b = 4} ``` # Diagnostics ``` invalid.jsonc:2:13 lint/suspicious/noRedeclare ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! Shouldn't redeclare 'b'. Consider to delete it or rename it. 1 │ switch(foo) { case a: var b = 3; > 2 │ case b: var b = 4} │ ^ i 'b' is defined here: > 1 │ switch(foo) { case a: var b = 3; │ ^ 2 │ case b: var b = 4} ``` # Input ```cjs var a = 3; var a = 10; ``` # Diagnostics ``` invalid.jsonc:1:16 lint/suspicious/noRedeclare ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! Shouldn't redeclare 'a'. Consider to delete it or rename it. > 1 │ var a = 3; var a = 10; │ ^ i 'a' is defined here: > 1 │ var a = 3; var a = 10; │ ^ ``` # Input ```cjs var a = {}; var a = []; ``` # Diagnostics ``` invalid.jsonc:1:17 lint/suspicious/noRedeclare ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! Shouldn't redeclare 'a'. Consider to delete it or rename it. > 1 │ var a = {}; var a = []; │ ^ i 'a' is defined here: > 1 │ var a = {}; var a = []; │ ^ ``` # Input ```cjs var a; function a() {} ``` # Diagnostics ``` invalid.jsonc:1:17 lint/suspicious/noRedeclare ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! Shouldn't redeclare 'a'. Consider to delete it or rename it. > 1 │ var a; function a() {} │ ^ i 'a' is defined here: > 1 │ var a; function a() {} │ ^ ``` # Input ```cjs function a() {} function a() {} ``` # Diagnostics ``` invalid.jsonc:1:26 lint/suspicious/noRedeclare ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! Shouldn't redeclare 'a'. Consider to delete it or rename it. > 1 │ function a() {} function a() {} │ ^ i 'a' is defined here: > 1 │ function a() {} function a() {} │ ^ ``` # Input ```cjs var a = function() { }; var a = function() { } ``` # Diagnostics ``` invalid.jsonc:1:29 lint/suspicious/noRedeclare ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! Shouldn't redeclare 'a'. Consider to delete it or rename it. > 1 │ var a = function() { }; var a = function() { } │ ^ i 'a' is defined here: > 1 │ var a = function() { }; var a = function() { } │ ^ ``` # Input ```cjs var a = function() { }; var a = new Date(); ``` # Diagnostics ``` invalid.jsonc:1:29 lint/suspicious/noRedeclare ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! Shouldn't redeclare 'a'. Consider to delete it or rename it. > 1 │ var a = function() { }; var a = new Date(); │ ^ i 'a' is defined here: > 1 │ var a = function() { }; var a = new Date(); │ ^ ``` # Input ```cjs var a = 3; var a = 10; var a = 15; ``` # Diagnostics ``` invalid.jsonc:1:16 lint/suspicious/noRedeclare ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! Shouldn't redeclare 'a'. Consider to delete it or rename it. > 1 │ var a = 3; var a = 10; var a = 15; │ ^ i 'a' is defined here: > 1 │ var a = 3; var a = 10; var a = 15; │ ^ ``` ``` invalid.jsonc:1:28 lint/suspicious/noRedeclare ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! Shouldn't redeclare 'a'. Consider to delete it or rename it. > 1 │ var a = 3; var a = 10; var a = 15; │ ^ i 'a' is defined here: > 1 │ var a = 3; var a = 10; var a = 15; │ ^ ``` # Input ```cjs var a; var a; ``` # Diagnostics ``` invalid.jsonc:1:12 lint/suspicious/noRedeclare ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! Shouldn't redeclare 'a'. Consider to delete it or rename it. > 1 │ var a; var a; │ ^ i 'a' is defined here: > 1 │ var a; var a; │ ^ ``` # Input ```cjs export var a; var a; ``` # Diagnostics ``` invalid.jsonc:1:19 lint/suspicious/noRedeclare ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! Shouldn't redeclare 'a'. Consider to delete it or rename it. > 1 │ export var a; var a; │ ^ i 'a' is defined here: > 1 │ export var a; var a; │ ^ ``` # Input ```cjs class C { static { var a; var a; } } ``` # Diagnostics ``` invalid.jsonc:1:31 lint/suspicious/noRedeclare ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! Shouldn't redeclare 'a'. Consider to delete it or rename it. > 1 │ class C { static { var a; var a; } } │ ^ i 'a' is defined here: > 1 │ class C { static { var a; var a; } } │ ^ ``` # Input ```cjs class C { static { var a; { var a; } } } ``` # Diagnostics ``` invalid.jsonc:1:33 lint/suspicious/noRedeclare ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! Shouldn't redeclare 'a'. Consider to delete it or rename it. > 1 │ class C { static { var a; { var a; } } } │ ^ i 'a' is defined here: > 1 │ class C { static { var a; { var a; } } } │ ^ ``` # Input ```cjs class C { static { { var a; } var a; } } ``` # Diagnostics ``` invalid.jsonc:1:35 lint/suspicious/noRedeclare ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! Shouldn't redeclare 'a'. Consider to delete it or rename it. > 1 │ class C { static { { var a; } var a; } } │ ^ i 'a' is defined here: > 1 │ class C { static { { var a; } var a; } } │ ^ ``` # Input ```cjs class C { static { { var a; } { var a; } } } ``` # Diagnostics ``` invalid.jsonc:1:37 lint/suspicious/noRedeclare ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! Shouldn't redeclare 'a'. Consider to delete it or rename it. > 1 │ class C { static { { var a; } { var a; } } } │ ^ i 'a' is defined here: > 1 │ class C { static { { var a; } { var a; } } } │ ^ ``` # Input ```cjs var a; var {a = 0, b: Object = 0} = {}; ``` # Diagnostics ``` invalid.jsonc:1:13 lint/suspicious/noRedeclare ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! Shouldn't redeclare 'a'. Consider to delete it or rename it. > 1 │ var a; var {a = 0, b: Object = 0} = {}; │ ^ i 'a' is defined here: > 1 │ var a; var {a = 0, b: Object = 0} = {}; │ ^ ``` # Input ```cjs var a; var {a = 0, b: globalThis = 0} = {}; ``` # Diagnostics ``` invalid.jsonc:1:13 lint/suspicious/noRedeclare ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! Shouldn't redeclare 'a'. Consider to delete it or rename it. > 1 │ var a; var {a = 0, b: globalThis = 0} = {}; │ ^ i 'a' is defined here: > 1 │ var a; var {a = 0, b: globalThis = 0} = {}; │ ^ ``` # Input ```cjs function f() { var a; var a; } ``` # Diagnostics ``` invalid.jsonc:1:27 lint/suspicious/noRedeclare ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! Shouldn't redeclare 'a'. Consider to delete it or rename it. > 1 │ function f() { var a; var a; } │ ^ i 'a' is defined here: > 1 │ function f() { var a; var a; } │ ^ ``` # Input ```cjs function f() { var a; if (test) { var a; } } ``` # Diagnostics ``` invalid.jsonc:1:39 lint/suspicious/noRedeclare ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! Shouldn't redeclare 'a'. Consider to delete it or rename it. > 1 │ function f() { var a; if (test) { var a; } } │ ^ i 'a' is defined here: > 1 │ function f() { var a; if (test) { var a; } } │ ^ ``` # Input ```cjs for (var a, a;;); ``` # Diagnostics ``` invalid.jsonc:1:13 lint/suspicious/noRedeclare ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! Shouldn't redeclare 'a'. Consider to delete it or rename it. > 1 │ for (var a, a;;); │ ^ i 'a' is defined here: > 1 │ for (var a, a;;); │ ^ ``` # Input ```cjs for (;;){ var a, a,;} ``` # Diagnostics ``` invalid.jsonc:1:18 lint/suspicious/noRedeclare ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! Shouldn't redeclare 'a'. Consider to delete it or rename it. > 1 │ for (;;){ var a, a,;} │ ^ i 'a' is defined here: > 1 │ for (;;){ var a, a,;} │ ^ ``` # Input ```cjs function f(x) { var x = 5; } ```