Variables that are declared inside a block but used outside of it (which is possible with a ``++var++``-style declaration) should be declared outside the block.
\[~ann.campbell.2] WDYT if we change this rule to not function scope but to java-like scopes (function+loops+if)?
Following to this convention will ease transition to ES2015 variables declarations (let and const)
=== on 17 Feb 2016, 09:24:03 Elena Vilchik wrote:
\[~ann.campbell.2] I removed part about functions as it probably will produce FP. See
----
var y; // OK
function foo(p) {
if (y) {
bar(y);
}
y = p;
}
for (var j = 1; j < 10; j++) {
foo(j)
}
----
=== on 18 Feb 2016, 09:49:46 Elena Vilchik wrote:
\[~ann.campbell.2] Looks like after removing this "function" thing this rule has not much in common with RSPEC-1899. May be we should make it as separate RSPEC, WDYT? (cc [~pierre-yves.nicolas])