Sidebar

Can I disable inspections in QIE?

+1 vote
1.2K views
asked Jul 9, 2013 by rich-c-2789 (16,180 points)

Can I disable inspections in QIE?  

For example with this code:

importPackage(java.util);
var javaArray = new ArrayList();

The editer display a warning like:

'ArrayList' is not defined.

even though it runs fine.

 

2 Answers

+3 votes
 
Best answer

Yes, there are 2 different ways you can disable this particular warning:

One way to disable it would be to declare ArrayList as a variable before calling new ArrayList()

var ArrayList = java.util.ArrayList;
var javaArray = new ArrayList();
...

QIE leverages JSHint to perform syntax validation so the other way to disable this warning is using a JSHint Directive.

importPackage(java.util);
/*jshint undef:false*/
var javaArray = new ArrayList();
/*jshint undef:true*/
...

Note that you can disable the warning for just a single line or block of code.  Line 2 in the example above disables the "undefined" warning message and line 4 re-enables it.  This ensures that other valid "undefined" warnings will be correctly reported in other sections of the code.

answered Jul 9, 2013 by sam-s-1510 (2,820 points)
selected Jul 11, 2013 by ron-s-6919
commented Jul 9, 2013 by rich-c-2789 (16,180 points)
I like the first option even though it seems a bit strange, but I can't seem to get it to work.  Maybe I am missing something.
commented Jul 9, 2013 by sam-s-1510 (2,820 points)
My example wasn't quite right.  When declaring ArrayList as a variable you have to initialize it to the ArrayList class.  I've update the example to one that should work now...
commented Jul 9, 2013 by rich-c-2789 (16,180 points)
Awesome.  I like the first one even more, at least for my needs.
0 votes
I found that some of the options are not listed on the link for jsHint but found this list for jsLint that is also available in the editor.  

http://www.jslint.com/lint.html

For example regexp works as in this related question:

https://www.qvera.com/kb/index.php/456/how-get-around-insecure-warning-when-using-character-regex
answered Apr 11, 2014 by rich-c-2789 (16,180 points)
...