Class: ESLintRails::Runner
- Inherits:
-
Object
- Object
- ESLintRails::Runner
- Includes:
- ActionView::Helpers::JavaScriptHelper
- Defined in:
- lib/eslint-rails-ee/runner.rb
Constant Summary collapse
- JAVASCRIPT_EXTENSIONS =
%w[.js .jsx .es6].freeze
Instance Method Summary collapse
-
#initialize(file) ⇒ Runner
constructor
A new instance of Runner.
- #run(should_autocorrect = false) ⇒ Object
Constructor Details
#initialize(file) ⇒ Runner
Returns a new instance of Runner.
10 11 12 13 14 15 |
# File 'lib/eslint-rails-ee/runner.rb', line 10 def initialize(file) @file = normalize_infile(file) @assets = assets puts "Running ESLint | [#{@assets.size } file(s)]".white.on_black.italic print 'Progress: ['.white.on_black end |
Instance Method Details
#run(should_autocorrect = false) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/eslint-rails-ee/runner.rb', line 17 def run(should_autocorrect=false) warnings = @assets.map do |asset| generate_warnings(asset, should_autocorrect).tap { |warnings| output_progress(warnings) } end print "]".white.on_black puts puts warnings.flatten end |