Ash
Ash

Reputation: 444

abode brackets how to take external JS files into account when linting js file

Just started using brackets, really like it but im struggling to figure out how to blend my JS files so I can use linting features properly (currently using JShint rather than the default JSlint).

So my structure is, i've got a HTML file, a CSS file and a JS file. Ive loaded a couple of JS libraries through CDN into the head of the HTML file.

My issue is that when using JShint on my own JS file im getting loads of irrelevant errors as it doesnt have access to the external libraries.

Id really rather not load all the libraries into the same JS file as it will be a mission to manage.

Any other ways to sort this?

Upvotes: 0

Views: 447

Answers (1)

hirse
hirse

Reputation: 2412

I am assuming your are getting "<variable> not defined" errors for your libraries.

You can fix that by tilling JsHint that those are globally defined variables. You can either do that in the .jshintrc file like this:

"globals": {
    "jQuery": false,
    "$": false
}

or specific for your file:

/* global jQuery, $ */

Upvotes: 1

Related Questions