linting our code
Justin Obara
obara.justin at gmail.com
Mon Mar 10 12:52:21 EDT 2014
I've filed a jira for implementing this change in Infusion.
http://issues.fluidproject.org/browse/FLUID-5284
I'd like to come up with a specific set of options that we will use with jshint.
http://jshint.com/docs/options/
I propose we use the following and replace our current use of "jslint:ok" with "jshint ignore"
{
// enforcing
"bitwise": true,
"camelcase": true, // new
"curly": true, // new
"eqeqeq": true, // new
"es3": true, // new - may not be necessary
"forin": true,
"freeze": true, // new
"immed": true, // new
"indent": 4,
"latedef": true // new
"newcap": true,
"noarg": true, // new
"noempty": true, // new
"nonbsp": true, // new
"nonew": true, // new
"plusplus": false, // new
"quotmark": "double", // new
"undef": true,
"unused": true, // new
"strict": true, // new
"trailing": true,
// maxparams, // not used
// maxdepth, // not used
// maxstatements, // not used
// maxcomplexity, // not used
// maxlen, // not used
// relaxing - false by default
"asi": false, // new
"boss": false // new
"debug": false,
"eqnull": false,
"esnext": false,
"evil": false, // new
"expr": false, // new
"funcscope": false, // new
"gcl": false,
"globalstrict": false,
"iterator": false,
"lastsemic": false,
"laxbreak": false,
"laxcomma": false,
"loopfunc": false,
"maxerr": 1000,
"moz": false,
"multistr": false,
"notypeof": false,
"proto": false,
"scripturl": false,
"smarttabs": false,
"shadow": false,
"sub": false,
"supernew": false,
"validthis": false,
"noyield": false,
// environments - false by default
"browser": true,
"couch": false,
"devel": false,
"dojo": false,
"jquery": true, // new
"mootools": false,
"node": false,
"nonstandard": false,
"phantom": false,
"prototypejs": false,
"rhino": false,
"worker": true, // new
"wsh": false,
"yui": false
}
Thanks
Justin
On Mar 7, 2014, at 6:30 PM, Colin Clark <colinbdclark at gmail.com> wrote:
> I think it’s a great idea. Let’s do it.
>
> In case it is helpful, here are some links to how I’ve configured JSHint in Flocking, which is a close relative of Infusion in many ways:
>
> I use a .jshintrc file that contains all the options that should be used when JSHinting the repository:
> https://github.com/colinbdclark/Flocking/blob/master/.jshintrc
>
> I used the grunt-jshint plugin to set up a task for it so that I can lint everything by running “grunt jshint:”
> https://github.com/colinbdclark/Flocking/blob/master/Gruntfile.js#L7-L12
>
> And I’m using the grunt-githook plugin to register a git pre commit hook that runs the linting every time I try to commit code:
> https://github.com/colinbdclark/Flocking/blob/master/Gruntfile.js#L93-L97
>
> Colin
>
> On Mar 7, 2014, at 1:00 PM, Justin Obara <obara.justin at gmail.com> wrote:
>
>> For several years, we've been hosting a forked version of the http://jslint.com at http://swarm.fluidproject.org/jslint/ . We did this so that we could remove some of the more aggressive linting requirements while maintaining our high code quality standards. Recently our swarm server was taken down, and along went our forked version of JSLint. However, in the time since we put up our version of JSLint, JSHint has grown quite a bit and can even be run as a node module. Perhaps now is the time to make the switch to JSHint.
>>
>> If we do make the switch we'll need to update our lint comments in each JS file and should consider adding JSHint to our grunt build scripts.
>>
>> Please let me know what you think.
>
More information about the fluid-work
mailing list