we could do a batch reformat using: https://github.com/rdio/jsfmt
On Tue, Jun 17, 2014 at 1:28 PM, Mark Koudritsky <kam...@google.com> wrote: > JSHint is awesome and I'm slowly adding the JSHint config lines to almost > every file I touch in cordova-lib. > But as Shazron mentioned back in April in this thread, JSHint doesn't > really focus on formatting. (he also suggested to look at jscs > <https://github.com/mdevils/node-jscs> as additional tool). > > > Anyway, lets start with using JSHint properly. > Based on my experience so far, for the existing cordova-lib code I would > recommend to start with this config: > > /* jshint node:true, bitwise:true, undef:true, trailing:true, > quotmark:true, > indent:4, unused:vars, latedef:nofunc > */ > > With the following optional tweaks for some files > - laxcomma:true // If the file has comma-first formatted parts > - sub:true // for files that parse XML and want to use node['prop'] where > JSHint prefers node.prop. > - expr:true // when you want to use variable && someFuncOn(variable); > (which you shouldn't, but some of the existing code does). > > I've just pushed a change > < > https://git-wip-us.apache.org/repos/asf?p=cordova-lib.git;a=commit;h=8f880f5d3128e17c8a8f5a4c68798e11f9342172 > > > with > this config added to several files to try it out. Works great, I encourage > people to try it out too. > Once we get close to passing JSHint check for all the files, we should to > add a JSHint stage to "npm test". > > > As a reference - some stats from other projects: > Below are the top 5 most popular .jshintrc files from 619 random* Node.js > oriented projects on GitHub (lists of flags explicitly set to truthy values > in .jshintrc). > > 1. bitwise, browser, camelcase, curly, eqeqeq, esnext, immed, indent, > latedef, newcap, noarg, node, quotmark, regexp, smarttabs, strict, > trailing, undef, unused > 2. bitwise, browser, camelcase, curly, eqeqeq, es5, esnext, immed, > indent, latedef, newcap, noarg, node, quotmark, regexp, smarttabs, > strict, > trailing, undef, unused > 3. bitwise, browser, camelcase, curly, eqeqeq, esnext, immed, indent, > jquery, latedef, newcap, noarg, node, quotmark, regexp, smarttabs, > strict, > trailing, undef, unused > 4. bitwise, browser, camelcase, curly, eqeqeq, es5, esnext, globals, > immed, indent, latedef, newcap, noarg, node, quotmark, regexp, > smarttabs, > strict, trailing, undef, unused > 5. boss, curly, eqeqeq, eqnull, es5, immed, latedef, newcap, noarg, > node, sub, undef >