ECMAScript 2015 introduced the
const keywords for block-scope variable declaration. Using
creates a read-only (constant) variable.
The distinction between the variable types created by
var and by
let is significant, and a switch to
will help alleviate many of the variable scope issues which have caused confusion in the past.
Because these new keywords create more precise variable types, they are preferred in environments that support ECMAScript 2015. However, some
refactoring may be required by the switch from
let, and you should be aware that they raise
in pre-ECMAScript 2015 environments.
This rule raises an issue when
var is used instead of
Noncompliant Code Example
var color = "blue";
var size = 4;
const color = "blue";
let size = 4;