From 491c5c94592af2131cc9dcfbc0c4978e51d0ccf0 Mon Sep 17 00:00:00 2001 From: Kevin Dew Date: Fri, 8 Jan 2021 20:19:26 +0000 Subject: [PATCH] Run yarn linting as part of default rake task This also updates the Rakefile to be more consistent with the other ones on GOV.UK apps, by clearing a default task if it exists and re-defining default as all lint and test tasks. --- Rakefile | 11 ++--------- lib/tasks/lint.rake | 5 +++++ 2 files changed, 7 insertions(+), 9 deletions(-) create mode 100644 lib/tasks/lint.rake diff --git a/Rakefile b/Rakefile index f89509581..fe82e8c68 100644 --- a/Rakefile +++ b/Rakefile @@ -5,12 +5,5 @@ require File.expand_path("config/application", __dir__) Rails.application.load_tasks -unless Rails.env.production? - require "rubocop/rake_task" - - RuboCop::RakeTask.new(:rubocop) do |t| - t.patterns = %w[app config test Gemfile] - end - - task default: %i[spec rubocop] -end +Rake::Task[:default].clear if Rake::Task.task_defined?(:default) +task default: %i[lint test jasmine:ci] diff --git a/lib/tasks/lint.rake b/lib/tasks/lint.rake new file mode 100644 index 000000000..3817bfb01 --- /dev/null +++ b/lib/tasks/lint.rake @@ -0,0 +1,5 @@ +desc "Run all linters" +task lint: :environment do + sh "bundle exec rubocop" + sh "yarn run lint" +end