3.7.31.8.9namespace StrictTest {
'use strict';
export class StrictClass {
test() {
console.log('test');
}
}
}
with tslint.json:
{
"rules": {
"no-unused-expression": true,
"use-strict": [true, "check-module"]
}
}
Strict.ts[2, 5]: expected an assignment or function call
'use strict' expression triggers no-unused-expression violation
'use strict' expression should not trigger no-unused-expression violation when placed in top of a module/namespace.
In particular, removing the 'use strict' expression from the above code causes a violation of the use-strict rule with the check-module argument.
Let's make sure to add a regression test for this kind of usage in https://github.com/palantir/tslint/blob/master/test/rules/no-unused-expression/test.ts.lint
This is a bug, thanks for the heads-up! I guess then that there are four(?) valid locations for this in TS:
Looking at the spec I'm not entirely sure on #4, but since classes compile down to a function, might be logical?
Edit: It looks like TS won't even emit a 'use strict;' statement at the top of a class, so #4 shouldn't be allowed.
@jbroni I'll have this fixed and published before end of day today, and most likely much sooner
@JKillian Thank you, I appreciate it!
Fixed in the just published v3.7.4
Most helpful comment
Fixed in the just published
v3.7.4