coffeelint
coffeelint copied to clipboard
A rule to forbid using undefined in the code
Feature request.
A rule to forbid using undefined
in the code. null
should be used instead.
I don't think this one is a good idea. Even though the two are often interchangeable they aren't always. I don't have an example off the top of my head, but I know I've run into a situation where I had to one and couldn't use the other.
You can always temporary turn off the coffeelint for that line, no? And explain the rationale for doing so? But I prefer using null
and _.isUndefined
everywhere in our code, while undefined
is something which comes from 3rd party libraries and JavaScript.
I think it is at the same level as missing_fat_arrows
, where for some codebases it works, and for some it does not (like if you are using AngularJS or jQuery). But this really depends on the use case.
Can you reopen this so that I can have it for my TODO. :-)
I agree that this one isn't great. Sometimes you actually want to know if its undefined vs null and in less code.
Then you do not have to use it. :-)
I completely agree it should be enabled by default. This is really for special codebases like API providers.
is there any update on this? been over a year or so. otherwise the issue will be closed.
So if it is OK for me to add this rule, then I can add it. There was no clear agreement on that.