tslint-consistent-codestyle icon indicating copy to clipboard operation
tslint-consistent-codestyle copied to clipboard

no-var-before-return: add fixer

Open ajafff opened this issue 8 years ago • 1 comments
trafficstars

Should be easy to implement.

Some things to consider:

function f() {
    var a = foo(), b = bar(a, a);
    return b;
}

function f() {
    var a = foo();
    return bar(a, a);
}
function f() {
    var a: {} = "foo"; // move annotation to funtion signature, iff this is the only return
    return a;
}

function f(): {} {
    return "foo";
}

ajafff avatar Sep 30 '17 15:09 ajafff

turn out to be not as easy as I thought. The fixer needs to handle destructuring as well

ajafff avatar Oct 02 '17 20:10 ajafff