Skip to content

Commit

Permalink
Updated jshintrc to allow 'supernew' (aka 'weird' constructions). Ref…
Browse files Browse the repository at this point in the history
…actored res.locals in interpreter.
  • Loading branch information
mikermcneil committed Sep 26, 2013
1 parent 4bb1966 commit 1a37d7d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
7 changes: 6 additions & 1 deletion .jshintrc
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,12 @@
"loopfunc": true,

// Suppress warnings about using assignments where conditionals are expected
"boss": true
"boss": true,

// Suppress warnings about "weird constructions"
// i.e. allow code like:
// (new (function OneTimeUsePrototype () { } ))
"supernew": true

// "bitwise": true,
// "camelcase": true,
Expand Down
6 changes: 2 additions & 4 deletions lib/hooks/sockets/interpreter/interpret.js
Original file line number Diff line number Diff line change
Expand Up @@ -314,12 +314,11 @@ module.exports = function (sails) {
* Scoped local variables accesible from views
* see also: http://expressjs.com/api.html#res.locals
*/
function Locals (){
res.locals = (new function Locals (){
this.partial = function renderPartial () {
return sendError('View partials not implemented over socket.io.');
};
}
res.locals = new Locals();
}());

/**
* Set the value of a local variable in the view
Expand All @@ -334,7 +333,6 @@ module.exports = function (sails) {
};



/**
* http://expressjs.com/api.html#res.format
*
Expand Down

0 comments on commit 1a37d7d

Please sign in to comment.