Closed juhangsin closed 4 years ago
Currently this won't pass Travis CI build
I think not having the type is OK: let status = 303;
It's a bit of an aggressive rule though, so either changing that line or removing the rule from our default ruleset works for me.
If we do remove it, we should also bring that change back to new-package
.
t having the type is OK:
let status = 303;
i'd definitely would like to have that rule applied since that defeats the purpose for using TS. I'll look into this and apply to everything we've done so far.
Very interesting, we even have the rule for ignoring this case
"@typescript-eslint/no-inferrable-types": ["error",
{
"ignoreParameters": true
}
],
but the rule is being ignored for numbers.
I think that rule says we only ignore parameters/arguments.
since that defeats the purpose for using TS
When you define let status = 303
typescript internally does track that it can only ever be a number, that's why the rule to disable this is called no-inferrable-types
. You could argue that the type information is a bit redundant... but disabling the rule still works for me. Either way
Ran eslint with fixes. There's one case i wasn't sure and didn't add to this PR which is
before change:
let status: number = 303;
after change:let status = 303;
type should be there, but not sure how to fix that yet.