aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/pronto
diff options
context:
space:
mode:
authorbbsteventill <still3@bloomberg.net>2018-03-31 13:01:17 -0400
committerMarkus Doits <doits@users.noreply.github.com>2018-03-31 19:01:17 +0200
commit12df00b5e5ac8287afad0f2d52aa0f35a6e8a2ee (patch)
tree4e261ede9bd5e6f254aca842b3826b68eddaf1bf /lib/pronto
parentf411af6f829477af0bdca765eb5cc3d40c104294 (diff)
downloadpronto-hlint-12df00b5e5ac8287afad0f2d52aa0f35a6e8a2ee.tar.gz
pronto-hlint-12df00b5e5ac8287afad0f2d52aa0f35a6e8a2ee.tar.zst
pronto-hlint-12df00b5e5ac8287afad0f2d52aa0f35a6e8a2ee.zip
added ability to set config opts to eslint (#9)
* added ability to set config opts to eslint * add spec for eslint command line
Diffstat (limited to 'lib/pronto')
-rw-r--r--lib/pronto/eslint_npm.rb10
-rw-r--r--lib/pronto/eslint_npm/version.rb2
2 files changed, 8 insertions, 4 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)
diff --git a/lib/pronto/eslint_npm/version.rb b/lib/pronto/eslint_npm/version.rb
index 2d3f9d8..1fc96c9 100644
--- a/lib/pronto/eslint_npm/version.rb
+++ b/lib/pronto/eslint_npm/version.rb
@@ -2,6 +2,6 @@
2 2
3module Pronto 3module Pronto
4 module ESLintNpmVersion 4 module ESLintNpmVersion
5 VERSION = '0.9.0'.freeze 5 VERSION = '0.9.1'.freeze
6 end 6 end
7end 7end