JSHint will throw the "const '{a}' has already been declared" error when it encounters a constant declaration with an identifier that has already been used in a previous constant declaration, when the esnext option is set to true. In the following example we declare a constant CONST_1 and then attempt to declare a second constant with the same identifier:
This error is raised to highlight a possible fatal JavaScript Type Error. Your code is likely to fail if you do not fix this issue.
The current implementation of the const statement is a Mozilla-specific extension. It is not found in the ECMAScript 5 specification and should not be relied upon for widespread support.
The Mozilla Developer Network gives the following details for the const keyword:
The value of a constant cannot change through re-assignment, and a constant cannot be re-declared. Because of this, although it is possible to declare a constant without initializing it, it would be useless to do so.
You can fix this issue by removing any re-declarations of constants declared with the const keyword:
However, since browser support for the const statement is limited, and currently differs greatly in implementation, it's recommended that you don't use it all, and simply use the var statement instead. A common convention to indicate a variable with a value that shouldn't change is to give that variable an identifier made up of uppercase characters, as has been done in the previous examples:
In JSHint 1.0.0 and above you have the ability to ignore any warning with a special option syntax. Since this message relates to a fatal syntax error you cannot disable it.