The reason you are getting “never used” message is because you actually haven’t 
used foo anywhere. You declared it, and you set a value for it, but you haven’t 
read it anywhere or done anything with it. Try the following code in a demo and 
it’s not going to throw any errors:

 

/*global foo: true */

/*eslint no-console: 0*/

/*eslint-env browser*/

foo = 5;

console.log(foo);

 

Thanks,

 

                                Ilya Volodin

 

From: [email protected] [mailto:[email protected]] On Behalf Of 
Brian Craft
Sent: Thursday, April 30, 2015 3:11 PM
To: [email protected]
Subject: [ESLint] "never used" error on used global

 

Reproducible in the demo, at http://eslint.org/demo/

 

Enter this:

 

/*global foo: true */
foo = 5;

 

 

w/o the global directive, eslint throws "foo undefined". With global true, it 
throws "never used". With global false it throws "foo is read only".

 

Is this a bug?

 

 

 

-- 
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] 
<mailto:[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