Skip to content

Const declarations should be analyzed as block-local, not function-local as var #45

Open

Description

@unv-unv

JavaScript inspection highlights same name const declarations in different blocks. But const declares variable as block-local, not function-local as var. So it's not a problem to have same-name const declaration in blocks that are not parent/child to each other.

изображение

function foo(bar)
{
    if (bar)
    {
        const qux = "foobar";
        console.log(qux);
    }
    else
    {
        const qux = "garply";
        console.log(qux);
    }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions