Skip to content

Commit

Permalink
Make .jshintrc more strict
Browse files Browse the repository at this point in the history
When I originally added this file to the project, I simply copied
another project's settings. This commit removes most of the relaxing
options and adds most of the enforcing options. If we had these lints
enabled, we would have avoided the previous bug. Descriptions of these
options can be found at:

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

At the same time I made some adjustments to the code to satisfy the new
lints.

Change-Id: I1b83b8c439812bac843f1705f9bff3d54e5fdfc0
Reviewed-on: http://gerrit.causes.com/37022
Tested-by: Joe Lencioni <[email protected]>
Reviewed-by: Hao Su <[email protected]>
  • Loading branch information
lencioni committed Apr 8, 2014
1 parent 94d35f1 commit 287a239
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 29 deletions.
32 changes: 20 additions & 12 deletions .jshintrc
Original file line number Diff line number Diff line change
@@ -1,16 +1,24 @@
{
"asi" : true,
"bitwise" : true,
"boss" : true,
"browser" : true,
"curly" : false,
"debug" : true,
"devel" : true,
"eqeqeq" : false,
"eqnull" : true,
"expr" : true,
"laxbreak" : true,
"laxcomma" : true,
"multistr" : true,
"supernew" : true,
"validthis" : true
"camelcase" : true,
"curly" : true,
"eqeqeq" : true,
"es3" : true,
"forin" : true,
"freeze" : true,
"immed" : true,
"indent" : 2,
"latedef" : true,
"newcap" : true,
"noarg" : true,
"noempty" : true,
"nonbsp" : true,
"nonew" : true,
"quotmark" : "single",
"undef" : true,
"unused" : true,
"strict" : true,
"trailing" : true
}
30 changes: 15 additions & 15 deletions Gruntfile.js
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
/* jshint node: true */

module.exports = function(grunt) {
"use strict";
'use strict';

grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
jshint: {
all: [
"*.js",
"spec/*.js"
],
options: {
jshintrc: '.jshintrc'
}
},
jasmine: {
src: "method-proxy.js",
options: {
specs: "spec/**/*.js"
pkg: grunt.file.readJSON('package.json'),
jshint: {
all: [
'*.js',
'spec/*.js'
],
options: {
jshintrc: '.jshintrc'
}
},
jasmine: {
src: 'method-proxy.js',
options: {
specs: 'spec/**/*.js'
}
}
});
Expand Down
4 changes: 3 additions & 1 deletion method-proxy.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
var MethodProxy = function(object, queue) {
window.MethodProxy = function(object, queue) {
'use strict';

this.init = function(object, queue) {
var item;

Expand Down
12 changes: 11 additions & 1 deletion spec/method-proxy.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
/* global MethodProxy:false */
/* global describe:false */
/* global it:false */
/* global beforeEach:false */
/* global spyOn:false */
/* global expect:false */
describe('MethodProxy', function() {
'use strict';

var FB, FBMethodProxy;

beforeEach(function() {
FB = {
aMethod : function() {},
Expand Down Expand Up @@ -54,7 +64,7 @@ describe('MethodProxy', function() {
spyOn(FB, 'aMethod');
spyOn(FB.anObject, 'anotherMethod');

new MethodProxy(FB, queue);
queue = new MethodProxy(FB, queue);
expect(FB.aMethod).toHaveBeenCalledWith('my argument');
expect(FB.anObject.anotherMethod)
.toHaveBeenCalledWith('my other argument', 'one more');
Expand Down

0 comments on commit 287a239

Please sign in to comment.