My application is running requireJS and is set up using two files:
main.js sets everything and app.js “runs” the application.
main.js looks like this:
/*jslint browser: true, indent : 2, nomen : true, sloppy : true */
/*global requirejs: false */
(function () {
"use strict";
requirejs.config({
baseUrl: "../js"
, paths: {
app: 'app'
, text: 'text'
...
}
, shim: {
'overrides': { deps: ['jquery'] }
...
}
});
// init
requirejs([ 'overrides',..., 'app'],
function( $, overrides, ..., App){
App.start( $, overrides );
});
}());
And my app.js:
define([], function () {
'use strict';
var start = function () {
require([ 'i18next'... ],
function (i18n) {
// stuff
}
);
}
return {"start": start};
});
My problem is that jslint complains about the return {"start": start}; as unexpected return. However, omitting it will cause my application to not start because of App being undefined.
Any idea how to remove the return-statement and still trigger the application? Or how to tweak to please JSLint? I don’t want to use JSHINT, so please don’t suggest it.
I’d start by adding the missing semicolon:
I suspect that’s the real reason jslint is unhappy. (I’m surprised that’s not what it’s complaining about…)