wlingke
wlingke

Reputation: 4799

JSHint Inline Configuration issue

I am using jshint with grunt and using some inline configuration. I am confused at the following. If I run jshint on just the below code.

/* jshint undef: false */
var app = foo;
/* jshint undef: true */

I would expect this to NOT return the error code W117 stating foo is undefined, but it does for some reason. It works if I leave out the last statement like so:

/* jshint undef: false */
var app = foo;

Though this is not the behavior I want. I only want jshint to ignore the undef warning for that one line.

My options are below:

options:{
    curly: true,
    eqeqeq: true,
    eqnull: true,
    browser: true,
    undef: true,
    unused: 'vars',
    globals: {
        jQuery: false,
        $: false
    }
},

What am I doing wrong?

Upvotes: 0

Views: 553

Answers (1)

wlingke
wlingke

Reputation: 4799

Per ruffin's comment, I was calling foo elsewhere and causing the issue. I decided to set foo to a global.

Upvotes: 1

Related Questions