== Why is this an issue?

This rule checks that the var keyword is not used to declare a variable with a name that is already in use. It applies to already defined variables as well as to function parameters.

This use of duplicate name is often unwanted and can lead to bugs and more generally to confusing code :


=== Noncompliant code example

[source,text]
----
var a = 'foo';
var a = 'bar'; // Noncompliant

function f(e) {
  var e = "event"; // Noncompliant
}
----


=== Compliant solution

[source,text]
----
var a = 'foo';
var b = 'bar';

function f(e) {
  var g = "event";
}
----


