It's a much easier a problem than squiggly bracket placement. You have a particular type of block -- an empty block -- and JSLint doesn't like empty blocks. It wants statements.
Note that a function without a return value returns undefined
anyway, so you can kludge this without changing function like this:
/*jslint sloppy:true, white:true */
/*global Sessions, $http, baseURL */
Sessions.getVars = function()
{
return $http.get(baseURL)
.then(function(response) { return response.data; },
function(response) { return undefined; });
};
I think that's all you're seeing.
Note that JSLint is not necessarily quite as bad about where you put the squigglies as these other answers would have you believe! ;^) It's not a dealbreaker, anyhow, if you use JSLint directives.
I'm using two directives:
sloppy
-- allows you to skip using "use strict";
white
-- allows for any whitespace you want. Without this, you'd see the error I think other answers here are anticipating, but that error would be Expected exactly one space between ')' and '{'.
I'd say you can just run the snippet on JSLint.com to check, but it looks like Crockford is in the middle of his warned move to a new JSLint that's much more draconian than the old one. For now, I'd suggest testing snippets at old.jslint.com.
If you do, you'll see that, to make JSLint "fully happy", you'll need to remove response
from that second function as well: function() { return "Something"; });
. It doesn't like unused parameters either.
If you want to keep the TODO comment, you'll need to add the todo
directive too.
Adding both of those changes gives us:
/*jslint sloppy:true, white:true, todo:true */
/*global Sessions, $http, baseURL */
Sessions.getVars = function()
{
return $http.get(baseURL)
.then(function(response) { return response.data; },
function() {
/* TODO Error handling; add `err` to parameters */
return undefined;
});
};