diff --git a/Gemfile b/Gemfile index 403e3432a..108f6eadb 100644 --- a/Gemfile +++ b/Gemfile @@ -59,6 +59,9 @@ group :development do gem "binding_of_caller", ">= 0.7.1", :platforms => [:mri_19, :rbx] gem "metric_fu" gem "letter_opener" # for mocking emails for sending + + # For linting JS with `rake jshint`. + gem 'jshintrb', '>= 0.2.4' end group :test do diff --git a/Gemfile.lock b/Gemfile.lock index 1adae1609..618f66161 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -142,6 +142,10 @@ GEM railties (>= 3.2.0, < 5.0) i18n (0.6.9) journey (1.0.4) + jshintrb (0.2.4) + execjs + multi_json (>= 1.3) + rake json (1.8.1) json_pure (1.8.1) jwt (0.1.11) @@ -338,6 +342,7 @@ DEPENDENCIES google-api-client haml-rails html5shiv-rails + jshintrb (>= 0.2.4) json kgio letter_opener diff --git a/lib/tasks/jshint.rake b/lib/tasks/jshint.rake new file mode 100644 index 000000000..3a58acf34 --- /dev/null +++ b/lib/tasks/jshint.rake @@ -0,0 +1,41 @@ +# Load JSHint when jshintrb gem is available +begin + require "jshintrb/jshinttask" + Jshintrb::JshintTask.new :jshint do |t| + t.pattern = "app/assets/javascripts/**/*.js" + #t.options = :defaults + # Custom options are below, uncomment the line + # above for the default set of options. + t.options = { + :bitwise => true, + :curly => false, + :eqeqeq => true, + :forin => true, + :immed => true, + :indent => 2, + :latedef => true, + :newcap => true, + :noarg => true, + :noempty => true, + :nonew => true, + :plusplus => false, + :regexp => true, + :undef => true, + :strict => true, + :trailing => true, + :sub => true, + :browser => true, + :devel => true, + :expr => true, + :predef => { + "requirejs" => false, + "require" => false, + "define" => false, + "Modernizr" => false, + "selectorSupported" => false, + "google" => false + } + } + end +rescue LoadError +end \ No newline at end of file