Skip to content

Disallow const declaration in for loop init part #1820

@mug1wara26

Description

@mug1wara26

As per the source 3 docs, the init part of a for loop should be either an expression or a let expression, however the following code snippet runs on source 3 and 4

let b = 2;
for (const a = 4; b < 10; b = b + 1) {
    display(b);
}

A rule should be added that checks for const declaration.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions