0
votes

I have two different js files one is called alert.js

alert.js

function alerts(){
alert('HI');
}

Another one is called draw.js

function call_alert(){
 alerts();
}
Functionally its working well, but in validation using jslint or eslint shows me these errors:
  • 'alerts' is defined but never used. (no-unused-vars) (this error for alert.js file)
  • 'call_alert' is defined but never used. (no-unused-vars) (this error for draw.js file)
1
Well call call_alert() then.Jeremy Thille
alerts() method in alert.js file, call_alert() in draw.js fileSai Rajesh
scope of the code should be in a single file. Try to cocat using gulp and validate it.NiRUS
You already answered your own question.Gerardo Furtado
no i m not able to use single file..here i have sent small script..but my js function have above 1000 lines @NirusSai Rajesh

1 Answers

1
votes

When you have functions or variables that are defined in the global scope in one file but used in another, you can use exported comments to tell ESLint that they're intended to be used elsewhere. (Note that this doesn't apply to Node.js or ES modules, which don't have global scope.)

/* exported alerts */
function alerts() {
    alert('HI');
}