Treat var as Block Scoped (block-scoped-var)

The block-scoped-var rule generates warnings when variables are used outside of the block in which they were defined. This emulates C-style block scope.

functiondoSomething(){if(true){varbuild=true;}console.log(build);}

Rule Details

This rule aims to reduce the usage of variables outside of their binding context and emulate traditional block scope from other languages. This is to help newcomers to the language avoid difficult bugs with variable hoisting.