Luca Reghellin
Luca Reghellin

Reputation: 8125

how to permanently stop jshint 'read only' warning/error?

I tried to find a solution but it seems I can't use any flag for this. If I declare a global variable initially null like this:

close = null;

I then get an error of 'read only'. It's useless in my case. How can I stop it?

Upvotes: 1

Views: 765

Answers (1)

doldt
doldt

Reputation: 4506

When you define globals for jshint, you have to also declare whether you allow re-assigning them or not.

/* global close:false */

or the equivalent of

"globals": { "close": false }

in your .jshintrc file will allow the close global to be used, but not to be reassigned.

/* global close:true */

will allow redefining, and close = null will not throw a jshint warning anymore.

Upvotes: 3

Related Questions