<commit_before># Suggest to use `const` (prefer-const)

If a variable is never modified, using the `const` declaration is better.

`const` declaration tells readers "this variable is never modified", reduces what they must think.
So it will improve maintainability.

## Rule Details

This rule is aimed to flag variables that are declared using `let` keyword, but never modified after initial assignment.

The following patterns are considered warnings:

```js
let a = 3;
console.log(a);
```

```js
for (let i in [1,2,3]) { // `a` is re-defined (not modified) on each loop step.
    console.log(i);
}
```

```js
for (let a of [1,2,3]) { // `a` is re-defined (not modified) on each loop step.
    console.log(a);
}
```

The following patterns are not considered warnings:

```js
let a; // there is not the initializer.
console.log(a);
```

```js
for (let i = 0, end = 10; i < end; ++i) { // `end` is never modified, but we cannot separate the declaration without changing the scope.
    console.log(a);
}
```

```js
var a = 3; // suggest to use `no-var` rule.
console.log(a);
```

## When Not to Use It

If you don't want to be notified about variables that are never modified after initial assignment, you can safely disable this rule.<commit_msg>Docs: Fix a minor typo in a prefer-const example<commit_after># Suggest to use `const` (prefer-const)

If a variable is never modified, using the `const` declaration is better.

`const` declaration tells readers "this variable is never modified", reduces what they must think.
So it will improve maintainability.

## Rule Details

This rule is aimed to flag variables that are declared using `let` keyword, but never modified after initial assignment.

The following patterns are considered warnings:

```js
let a = 3;
console.log(a);
```

```js
for (let i in [1,2,3]) { // `i` is re-defined (not modified) on each loop step.
    console.log(i);
}
```

```js
for (let a of [1,2,3]) { // `a` is re-defined (not modified) on each loop step.
    console.log(a);
}
```

The following patterns are not considered warnings:

```js
let a; // there is not the initializer.
console.log(a);
```

```js
for (let i = 0, end = 10; i < end; ++i) { // `end` is never modified, but we cannot separate the declaration without changing the scope.
    console.log(a);
}
```

```js
var a = 3; // suggest to use `no-var` rule.
console.log(a);
```

## When Not to Use It

If you don't want to be notified about variables that are never modified after initial assignment, you can safely disable this rule.
{'fraction_non_alphanumeric': 0.12495057334914986, 'fraction_numerical': 0.008699090549624358, 'mean_word_length': 3.8098859315589353, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2457074', 'n_tokens_mistral': 803, 'n_tokens_neox': 764, 'n_words': 367}