Hi everyone,

I've read the docs for exported, specifically the part about how exported 
doesn't work in node/commonjs env and I believe I'm doing things correctly 
according to the instructions there. My ESLint env is set to browser/jquery 
and each of my functions has an /* exported functionName */ comment, but I 
keep getting caught by no-unused-vars rule. Can anyone take a look and let 
me know what I'm doing wrong?

You can see the full source at  
https://github.com/watson-developer-cloud/visual-recognition-nodejs/tree/eslint-exported
 (just run npm install; npm test) but I'll try and include the relevant 
bits below:

Here's my .eslintrc (it extends this one 
<https://github.com/watson-developer-cloud/visual-recognition-nodejs/blob/eslint-exported/.eslintrc>,
 
although I get the same behavior without the extends):

{
  "extends": "../../.eslintrc",
  "env": {
    "browser": true,
    "jquery": true
  }}

This is one of the functions (here's the second 
<https://github.com/watson-developer-cloud/visual-recognition-nodejs/blob/eslint-exported/public/js/use.js#L19>
 and third 
<https://github.com/watson-developer-cloud/visual-recognition-nodejs/blob/eslint-exported/public/js/demo.js#L30>
):

/**
 * Returns the next hour as Date
 * @return {Date} the next hour
 *//* exported nextHour */function nextHour() {
  var oneHour = new Date();
  oneHour.setHours(oneHour.getHours() + 1);
  return oneHour;}

Finally, this is the output I get from ESLint:

/Users/nfriedly/visual-recognition-nodejs/public/js/demo.js
  24:10  error  'nextHour' is defined but never used  no-unused-vars
  37:10  error  'resize' is defined but never used    no-unused-vars
/Users/nfriedly/visual-recognition-nodejs/public/js/use.js
  26:10  error  'setupUse' is defined but never used  no-unused-vars

It works if I replace the /* exported... comment with an // 
eslint-disable-next-line no-unused-vars but I know that's not the correct 
solution.


Thanks in advance,

-Nathan

-- 
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