From b88e69a3ccb163309b6746b46f2f4df821d17824 Mon Sep 17 00:00:00 2001 From: Jacob Gable Date: Tue, 14 May 2013 10:04:22 -0500 Subject: [PATCH] Switch to grunt-jslint --- Gruntfile.js | 84 +++++++++++++++++++++++++---------------------- core/ghost.js | 2 +- core/lang/i18n.js | 3 ++ package.json | 4 +-- 4 files changed, 51 insertions(+), 42 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index a1affdd06d..4da53bbd65 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -1,47 +1,53 @@ +(function () { + "use strict"; -var configureGrunt = function (grunt) { + var configureGrunt = function (grunt) { - var cfg = { - // JSHint all the things! - jshint2: { - options: { - jshintrc: ".jshintrc" + var cfg = { + // JSLint all the things! + jslint: { + directives: { + nomen: true, + todo: true, + predef: ["__dirname", "module", "exports", "require", "process", "document", "console"] + }, + files: [ + // Lint files in the root, including Gruntfile.js + "*.js", + // Lint core files, but not libs + ["core/**/*.js", "!**/assets/lib/**/*.js"] + ] }, - all: [ - // Lint files in the root, including Gruntfile.js - "*.js", - // Lint core files, but not libs - ["core/**/*.js", "!**/assets/lib/**/*.js"] - ] - }, - // Unit test all the things! - nodeunit: { - all: ['core/test/ghost/**/test-*.js'] - }, - - // Compile all the SASS! - compass: { - options: { - config: "config.rb" + // Unit test all the things! + nodeunit: { + all: ['core/test/ghost/**/test-*.js'] }, - // No need for config, but separated for future options - admin: {} - } + + // Compile all the SASS! + compass: { + options: { + config: "config.rb" + }, + // No need for config, but separated for future options + admin: {} + } + }; + + grunt.initConfig(cfg); + + grunt.loadNpmTasks("grunt-jslint"); + grunt.loadNpmTasks("grunt-contrib-nodeunit"); + grunt.loadNpmTasks("grunt-contrib-compass"); + + // Prepare the project for development + // TODO: Git submodule init/update (https://github.com/jaubourg/grunt-update-submodules)? + grunt.registerTask("init", ["compass:admin"]); + + // Run tests and lint code + grunt.registerTask("validate", ["jslint", "nodeunit:all"]); }; - grunt.initConfig(cfg); + module.exports = configureGrunt; - grunt.loadNpmTasks("grunt-jshint2"); - grunt.loadNpmTasks("grunt-contrib-nodeunit"); - grunt.loadNpmTasks("grunt-contrib-compass"); - - // Prepare the project for development - // TODO: Git submodule init/update (https://github.com/jaubourg/grunt-update-submodules)? - grunt.registerTask("init", ["compass:admin"]); - - // Run tests and lint code - grunt.registerTask("validate", ["jshint2:all", "nodeunit:all"]); -}; - -module.exports = configureGrunt; \ No newline at end of file +}()); \ No newline at end of file diff --git a/core/ghost.js b/core/ghost.js index b1de1a4148..d227f84a0d 100644 --- a/core/ghost.js +++ b/core/ghost.js @@ -75,7 +75,7 @@ polyglot: function () { return polyglot; }, paths: function () { return { - 'activeTheme': path.resolve(__dirname + '/../content/' + config.themeDir + '/' + config.activeTheme + '/'), + 'activeTheme': __dirname + '/../content/' + config.themeDir + '/' + config.activeTheme + '/', 'adminViews': __dirname + '/admin/views/', 'lang': __dirname + '/lang/' }; diff --git a/core/lang/i18n.js b/core/lang/i18n.js index 07c9bba35f..7c173875c4 100644 --- a/core/lang/i18n.js +++ b/core/lang/i18n.js @@ -19,6 +19,9 @@ if (lang === 'en') { // TODO: do stuff here to optimise for en + + // Make jslint empty block error go away + lang = 'en'; } /** TODO potentially use req.acceptedLanguages rather than the default diff --git a/package.json b/package.json index 07951e159d..dfbc2bdea3 100644 --- a/package.json +++ b/package.json @@ -22,8 +22,8 @@ "devDependencies": { "grunt": "~0.4.1", "grunt-contrib-nodeunit": "~0.1.2", - "grunt-jshint2": "~0.1.1", "grunt-contrib-compass": "~0.2.0", - "nodeunit": "*" + "nodeunit": "*", + "grunt-jslint": "~0.2.5a" } }