Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JSLint - problems importing packages

I am scripting java using rhino. I have few classes written in java that I am importing in javascript.

But, when I am validating javascript against JSLint, it invalidates javascript saying:

Problem at line 9 character 1: 'importPackage' was used before it was defined.

Here is the sample from my script:

importPackage(Packages.org.raj.test);
var test = "123";

I have selected the option: "Assume Rhino" as well but still, it shows up same error.

How should I deal with this problem?

Note that the ECMA standard doesn't cover communication with Java (or with any external object system for that matter).

like image 361
RAJ Avatar asked Aug 06 '26 19:08

RAJ


1 Answers

I have explicitly added following line on top of my script

/*global importPackage: true */

and it works!

like image 182
Paul Sweatte Avatar answered Aug 08 '26 08:08

Paul Sweatte



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!