From 12df00b5e5ac8287afad0f2d52aa0f35a6e8a2ee Mon Sep 17 00:00:00 2001 From: bbsteventill Date: Sat, 31 Mar 2018 13:01:17 -0400 Subject: added ability to set config opts to eslint (#9) * added ability to set config opts to eslint * add spec for eslint command line --- lib/pronto/eslint_npm.rb | 10 +++++++--- lib/pronto/eslint_npm/version.rb | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-) (limited to 'lib') 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' module Pronto class ESLintNpm < Runner CONFIG_FILE = '.pronto_eslint_npm.yml'.freeze - CONFIG_KEYS = %w[eslint_executable files_to_lint].freeze + CONFIG_KEYS = %w[eslint_executable files_to_lint cmd_line_opts].freeze - attr_writer :eslint_executable + attr_writer :eslint_executable, :cmd_line_opts def eslint_executable @eslint_executable || 'eslint' @@ -18,6 +18,10 @@ module Pronto @files_to_lint || /(\.js|\.es6)$/ end + def cmd_line_opts + @cmd_line_opts || '' + end + def files_to_lint=(regexp) @files_to_lint = regexp.is_a?(Regexp) && regexp || Regexp.new(regexp) end @@ -84,7 +88,7 @@ module Pronto end def eslint_command_line(path) - "#{eslint_executable} #{Shellwords.escape(path)} -f json" + "#{eslint_executable} #{cmd_line_opts} #{Shellwords.escape(path)} -f json" end 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 @@ module Pronto module ESLintNpmVersion - VERSION = '0.9.0'.freeze + VERSION = '0.9.1'.freeze end end -- cgit v1.2.3