JS inspection for undeclared variable in global code?


I cannot find a 'JavaScript' inspection setting to detect unqualified properties that are added to the global object in global code (aka 'undeclared variables').

Under _General_ there is an option _Implicitly declared JavaScript variable_, but that works for function bodies only.

Am I missing something, or is this basic feature really missing from the inspection options?


This might not be the best place to bring it up, but 'JavaScript' is a bad inspection heading; firstly, 'JavaScript' is just one implementation of ECMAScript, and secondly, there are also inspections that refer to browser DOM features, not ECMAScript implementations.
Also, variables cannot be 'implicitly declared'. Assigning a value to an identifier that wasn't declared as a variable results in a property of the global object being created (i.e. without the DontDelete attribute).

1 comment
Comment actions Permalink

Unqualified properties added to global object flagged (as error)  when using "use strict";
We will add an option to highlight them via  _Implicitly declared JavaScript variable_ inspection.
As to inspection naming we are open for better reasonable naming, please just note that citing ECMAScript standard is not adequate for that :)
As to the using JavaScript instead of EcmaScript, this is intentional (albeit not technical) given we support ActionScript too.


Please sign in to leave a comment.