diff --git a/Gruntfile.js b/Gruntfile.js index 08d16575b8..1c8fd01d3a 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -21,20 +21,52 @@ pkg: grunt.file.readJSON('package.json'), // JSLint all the things! - jslint: { - directives: { - node: true, - browser: true, - nomen: true, - todo: true, - unparam: true + jslintm: { + node: { + directives: { + // node environment + node: true, + // browser environment + browser: false, + // allow dangling underscores in var names + nomen: true, + // allow to do statements + todo: true, + // allow unused parameters + unparam: true, + // don't require use strict pragma + sloppy: true + }, + files: { + src: [ + "*.js", + "core/**/*.js" + ] + }, + // Lint core files, but not libs, frontend or hbs files + exclude: [ + "**/assets/lib/**/*.js", + "**/assets/js/**/*.js", + "**/assets/tpl/*.js" + ] }, - files: [ - // Lint files in the root, including Gruntfile.js - "*.js", - // Lint core files, but not libs - ["core/**/*.js", "!**/assets/lib/**/*.js", "!**/assets/tpl/*.js"] - ] + frontend: { + directives: { + // node environment + node: false, + // browser environment + browser: true, + // allow dangling underscores in var names + nomen: true, + // allow to do statements + todo: true, + // allow unused parameters + unparam: true + }, + files: { + src: "**/assets/js/**/*.js" + } + } }, mochaTest: { @@ -212,6 +244,9 @@ cfg.pkg = grunt.file.readJSON('package.json'); }); + // jslintm aliased to jslint + grunt.registerTask("jslint", ["jslintm"]); + // Prepare the project for development // TODO: Git submodule init/update (https://github.com/jaubourg/grunt-update-submodules)? grunt.registerTask("init", ["shell:bourbon", "sass:admin", 'handlebars']); diff --git a/core/admin/assets/js/router.js b/core/admin/assets/js/router.js index ef0d33dad1..3a5a86ee78 100644 --- a/core/admin/assets/js/router.js +++ b/core/admin/assets/js/router.js @@ -12,7 +12,7 @@ 'settings(/:pane)' : 'settings', 'editor/' : 'editor', 'editor(/:id)' : 'editor', - 'debug/' : 'debug', + 'debug/' : 'debug' }, blog: function () { diff --git a/core/admin/assets/js/views/base.js b/core/admin/assets/js/views/base.js index 77490d343d..c7654de1b9 100644 --- a/core/admin/assets/js/views/base.js +++ b/core/admin/assets/js/views/base.js @@ -1,5 +1,5 @@ /*global window, document, Ghost, Backbone, $, JST, _ */ -(function (_, undefined) { +(function (_) { "use strict"; Ghost.View = Backbone.View.extend({ diff --git a/core/admin/assets/js/views/dashboard.js b/core/admin/assets/js/views/dashboard.js index 1700401814..3f35ca3e01 100644 --- a/core/admin/assets/js/views/dashboard.js +++ b/core/admin/assets/js/views/dashboard.js @@ -89,15 +89,11 @@ tagName: 'article', attributes: function () { - var size = (this.model.get('size')) - ? " widget-" + this.model.get('size') - : "", - settings = (this.model.attributes.settings.enabled) - ? " widget-settings" - : ""; + var size = (this.model.get('size')) ? " widget-" + this.model.get('size') : "", + settings = (this.model.attributes.settings.enabled) ? " widget-settings" : ""; return { - class: 'widget-' + this.model.get('name') + size + settings + ' js-widget', + 'class': 'widget-' + this.model.get('name') + size + settings + ' js-widget', 'data-widget-id': this.model.get('applicationID') }; }, diff --git a/core/admin/assets/js/views/debug.js b/core/admin/assets/js/views/debug.js index ce1a69b079..9fb6f52766 100644 --- a/core/admin/assets/js/views/debug.js +++ b/core/admin/assets/js/views/debug.js @@ -1,5 +1,5 @@ /*global jQuery, window, document, Ghost, Backbone, $, _, alert */ -(function ($, _, Backbone, Ghost, undefined) { +(function ($, _, Backbone, Ghost) { "use strict"; Ghost.Views.Debug = Ghost.View.extend({ diff --git a/package.json b/package.json index 5614d07fb1..f123bd903d 100644 --- a/package.json +++ b/package.json @@ -24,7 +24,7 @@ }, "devDependencies": { "grunt": "~0.4.1", - "grunt-jslint": "~0.2.6", + "grunt-jslint": "git+https://github.com/ErisDS/grunt-jslint.git#custom", "should": "~1.2.2", "grunt-mocha-test": "~0.4.0", "grunt-shell": "~0.2.2",