aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/pronto/eslint_npm.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/pronto/eslint_npm.rb')
-rw-r--r--lib/pronto/eslint_npm.rb10
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/pronto/eslint_npm.rb b/lib/pronto/eslint_npm.rb
index 63a215b..6a9c00c 100644
--- a/lib/pronto/eslint_npm.rb
+++ b/lib/pronto/eslint_npm.rb
@@ -6,9 +6,9 @@ require 'shellwords'
6module Pronto 6module Pronto
7 class ESLintNpm < Runner 7 class ESLintNpm < Runner
8 CONFIG_FILE = '.pronto_eslint_npm.yml'.freeze 8 CONFIG_FILE = '.pronto_eslint_npm.yml'.freeze
9 CONFIG_KEYS = %w[eslint_executable files_to_lint].freeze 9 CONFIG_KEYS = %w[eslint_executable files_to_lint cmd_line_opts].freeze
10 10
11 attr_writer :eslint_executable 11 attr_writer :eslint_executable, :cmd_line_opts
12 12
13 def eslint_executable 13 def eslint_executable
14 @eslint_executable || 'eslint' 14 @eslint_executable || 'eslint'
@@ -18,6 +18,10 @@ module Pronto
18 @files_to_lint || /(\.js|\.es6)$/ 18 @files_to_lint || /(\.js|\.es6)$/
19 end 19 end
20 20
21 def cmd_line_opts
22 @cmd_line_opts || ''
23 end
24
21 def files_to_lint=(regexp) 25 def files_to_lint=(regexp)
22 @files_to_lint = regexp.is_a?(Regexp) && regexp || Regexp.new(regexp) 26 @files_to_lint = regexp.is_a?(Regexp) && regexp || Regexp.new(regexp)
23 end 27 end
@@ -84,7 +88,7 @@ module Pronto
84 end 88 end
85 89
86 def eslint_command_line(path) 90 def eslint_command_line(path)
87 "#{eslint_executable} #{Shellwords.escape(path)} -f json" 91 "#{eslint_executable} #{cmd_line_opts} #{Shellwords.escape(path)} -f json"
88 end 92 end
89 93
90 def clean_up_eslint_output(output) 94 def clean_up_eslint_output(output)