Class: ESLintWebpacker::Runner

Inherits:
Object
  • Object
show all
Includes:
ActionView::Helpers::JavaScriptHelper
Defined in:
lib/eslint-webpacker/runner.rb

Constant Summary collapse

JAVASCRIPT_EXTENSIONS =
%w[.js .jsx .es6].freeze

Instance Method Summary collapse

Constructor Details

#initialize(file) ⇒ Runner

Returns a new instance of Runner.



11
12
13
# File 'lib/eslint-webpacker/runner.rb', line 11

def initialize(file)
  @file = normalize_infile(file)
end

Instance Method Details

#runObject



15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/eslint-webpacker/runner.rb', line 15

def run
  javascripts = javascript_files

  puts "Inspecting #{javascripts.size} files"

  warnings = javascripts.map do |javascript|
    generate_warnings(javascript).tap { |warns| output_progress(warns) }
  end

  puts

  warnings.flatten
end