Andi N. Dirgantara
Andi N. Dirgantara

Reputation: 2051

Working with Sails.JS and JsHint

Assume if I'm working with Sails.JS let's call it Sails and using Brackets IDE that implement JsHint as code validator. Is there any best practices how to validate Sails's services and models? Not ignoring them.

Because by default, JsHint force (actually it is help) us to define variable before we use them, even global variable. I don't know why, if I define my models like var model = sails.models.model or var Model = global.Model for example, the application got an error instead.

I want to implement JsHint as neat as possible, because I'm working in team that still don't have any code standard guideline.

Upvotes: 4

Views: 987

Answers (1)

Meeker
Meeker

Reputation: 5979

If you check out JShint docs, it will tell you how to define your global variables in an config file or at the top of your script so that it will ignore them.

http://www.jshint.com/docs/

Add to the top of your .js file

/*global sails*/

Look under the section globals

Upvotes: 4

Related Questions