Sha256: 8f671b682591b14a8e8c8546cd069f77303ae3cc7e9abdea79cd317e6ef3d808

Contents?: true

Size: 607 Bytes

Versions: 1

Compression:

Stored size: 607 Bytes

Contents

# frozen_string_literal: true

require 'eslint-webpacker'

namespace :eslint do
  def run_and_print_results(file)
    puts 'Running Eslint...'
    warnings = ESLintWebpacker::Runner.new(file).run

    if warnings.empty?
      puts 'All good! :)'.green
      exit 0
    else
      formatter = ESLintWebpacker::TextFormatter.new(warnings)
      formatter.format
      exit 1
    end
  end

  desc 'Run ESLint against the specified JavaScript file or the entire ' \
       'project and report warnings'
  task :run, [:filename] => :environment do |_, args|
    run_and_print_results(args[:filename])
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
eslint-webpacker-1.0.1 lib/tasks/eslint.rake