Potential bug in JSHint support?

I'm running IntelliJ 13.1 Ultimate (Build 135.667) and JSHint 2.4.4 (bundled). I think this is actually 13.1.2 EAP but there's no version number other than 13.1 in the About dialog.

I don't understand why it's thinking this.normalFont and this.highFont are unresolved variables immediately after they have been assigned values. At least I would expect it to also complain about the original assignments as being unresolved as well in this case.

There are intention actions for fixing this, but "Create Field 'normalFont'" just inserts a line that says "this.normalFont = undefined" and then says that normalFont is an unresolved variable.

If I run this code through http://JSHint.com, I don't get this warning at all.

The documentation comment includes @constructor. I have noticed that if I change it to "@constructor universe", where "universe" is any word, phrase or punctuation mark, this problem goes away. However in that case the generated documentation includes the literal text "@constructor universe" in it and the function isn't flagged as a constructor. I discovered this when I thought that perhaps I could specify after the @constructor tag a list of member variables or something.

I can turn the inspection off entirely, or manually turn it off for every single statement like this, but both of those seem wrong to me.

Can anyone explain why it's doing this, or what stupid thing I'm doing wrong, or how to convince it that this is a field that actually exists, or something?

IntelliJ13_JSHint_badVar.png

2 comments

Hi,

Warnings "this.normalFont" and "this.highFont" are reported by own IntelliJ inspections, not JSHint.
Can you please file an issue in the http://youtrack.jetbrains.com/issues/WEB#newissue=yes ? Thanks.

0

Please sign in to leave a comment.