Hi Saqib,

You probably want to mark that function as exported. See:
http://eslint.org/docs/rules/no-unused-vars#exported

-N
On Sun, Aug 7, 2016 at 10:14 PM Saqib Shamsi <[email protected]> wrote:

> I have a set of files in which some files load others. For example, the
> contents of a file main.js are as follows:
>
> load("helper.js");
> var stdin = new java.io.BufferedReader( new 
> java.io.InputStreamReader(java.lang.System['in']) );
> function readline() {
>     var line = stdin.readLine();
>     return line;
> }
> var N = parseInt(readline());
> for(var i = 0; i<  N; i++)
> {
>     print("fd630b881935b5d43180ff301525488a");
>     var num = parseInt(readline());
>     var ans = perfectNumberCheck(num);
>     print(ans);
>     print("dc29e6fa38016b00627b6e52956f3c64");
> }
>
>
> As it can be seen that it loads the source file "helper.js". The contents
> of helper.js are as below:
>
> function perfectNumberCheck(num) {
>     if(num == 1)
>     {
>         return 0;
>     }
>     var halfNum = (num/2) + 1;
>     var sum = 0;
>     var retVal = 0;
>     for(var i=1 ; i < halfNum; i++){
>         if(num % i === 0){
>             sum = sum + i;
>         }
>     }
>     if(sum == num){
>         retVal = 1;
>     }
>     else {
>         retVal = 0;
>     }
>     return retVal;
> }
>
>
> Now when I run ESLint using the command eslint *.js or eslint main.js
> helper.js, I get the error *'perfectNumberCheck' is defined but never
> used *even though the function is used in main.js script.
>
> I wish to keep this error in the configuration but don't want ESLint to
> give this error in such cases. Is there a way to do it without combining
> the source code into a single script file?
>
> --
> You received this message because you are subscribed to the Google Groups
> "ESLint" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"ESLint" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to