I'm running TSLint (v5.3.2) with my typescript project. I'm getting Forbidden 'var' keyword, use 'let' or 'const' instead but I'm not using 'var' and it points to my use of 'let' or 'const'.
For example, here's a codeFrame format of the error to show I'm using 'const' and not 'var':
Forbidden 'var' keyword, use 'let' or 'const' instead (no-var-keyword)
58 | .map((response) => {
59 | // update the login status
> 60 | const tokensValid = response['isvalid'] === true;
| ^
61 | if (tokensValid) {
62 | this.loggedIn$.next(true);
63 | return true;
So far I haven't been able to figure out why I'm getting this error. Any ideas?
Thanks.
Turns out to be an issue with yarn 1.1.0. Downgraded to yarn 1.0.1 and tslint started passing again. Have not determine exactly what changed between the two versions that caused the issue.
Just encountered this problem with webpack
, tslint-loader
and awesome-typescript-loader
. I solved it by doing this (simplified):
module: {
rules: [
{
test: /\.tsx?$/,
enforce: 'pre', // this little bugger
loader: 'tslint-loader',
},
{
test: /\.tsx?$/,
use: ['awesome-typescript-loader'],
},
],
},
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With