javascript - How to require new for Error with command-line jshint -
entering code on www.jshint.com produces validation message "missing 'new' prefix when invoking constructor":
/*jshint globalstrict: true*/ /*jshint newcap:true*/ 'use strict'; function main() { var x = error('x'); return x; } main();
but same code when validated command-line jshint not produce warning:
fernando@fernando-i7-mint /tmp1050 $ ls -la total 12 drwxr-xr-x 2 fernando fernando 4096 jun 27 11:23 . drwxr-xr-x 28 root root 4096 jun 27 11:23 .. -rw-rw-rw- 1 fernando fernando 132 jun 27 11:06 test.js fernando@fernando-i7-mint /tmp1050 $ cat test.js /*jshint globalstrict: true*/ /*jshint newcap:true*/ 'use strict'; function main() { var x = error('x'); return x; } main(); fernando@fernando-i7-mint /tmp1050 $ jshint --version jshint v2.5.1 fernando@fernando-i7-mint /tmp1050 $ jshint test.js fernando@fernando-i7-mint /tmp1050 $
how ensure validating via command-line produce expected warnings?
update: validation works custom constructors, not built-in error
function. question is: configuration options necessary violation (calling error
without new
) shown via command line?
Comments
Post a Comment