JSDoc to suppress a single "Unused local variable" Follow
I have a variable that I declare as an enum so that I can use it to documentation variables and parameters that take on a restricted set of values. Something like this:
/**
* Possible values for the position of a widget.
* This object exists solely for documentation.
* @enum {string}
*/
var POSITION = {
"left": "left",
"right": "right",
"center": "center"
};
/**
* Return the position that is the mirror opposite of specified position
* @param {POSITION} pos
*/
function mirrorPosition(pos) {
return pos === 'left' ? 'right' :
pos === 'right' ? 'left' :
pos; // center
}
Webstorm flags the variable POSITION as unused. Is there a way to suppress the inspection for just this variable? If not, should WebStorm be smart enough to consider usages in JSDoc to be usages?
Please sign in to leave a comment.
WebStorm 10.0.4 seems to correctly resolve POSITION usages - no warnings are reported:

Anyway, you can suppress such warcings by adding
above declaration, like:
You're correct that my standalone example generates no warning. However, I'm using the require.js framework, and this slightly more complicated example still has the warning:
Fortunately, the noinspection comment works.
Should I file a bug report?
Yes, please!