1 # Disallow modifying variables that are declared using `const` (no-const-assign)
3 We cannot modify variables that are declared using `const` keyword.
4 It will raise a runtime error.
6 Under non ES2015 environment, it might be ignored merely.
10 This rule is aimed to flag modifying variables that are declared using `const` keyword.
12 Examples of **incorrect** code for this rule:
15 /*eslint no-const-assign: "error"*/
23 /*eslint no-const-assign: "error"*/
31 /*eslint no-const-assign: "error"*/
38 Examples of **correct** code for this rule:
41 /*eslint no-const-assign: "error"*/
49 /*eslint no-const-assign: "error"*/
52 for (const a in [1, 2, 3]) { // `a` is re-defined (not modified) on each loop step.
58 /*eslint no-const-assign: "error"*/
61 for (const a of [1, 2, 3]) { // `a` is re-defined (not modified) on each loop step.
68 If you don't want to be notified about modifying variables that are declared using `const` keyword, you can safely disable this rule.