lib/coffeelint.rb in coffeelint-1.8.1 vs lib/coffeelint.rb in coffeelint-1.9.1

- old
+ new

@@ -1,10 +1,10 @@ require "coffeelint/version" +require 'coffeelint/config' require 'coffeelint/cmd' require 'execjs' require 'coffee-script' -require 'json' module Coffeelint require 'coffeelint/railtie' if defined?(Rails::Railtie) def self.set_path(custom_path) @@ -42,13 +42,11 @@ coffeelintSource = File.read(Coffeelint.path) ExecJS.compile(coffeescriptSource + bootstrap + coffeelintSource) end def self.lint(script, config = {}) - if !config[:config_file].nil? - fname = config.delete(:config_file) - config.merge!(JSON.parse(File.read(fname))) - end + fname = config.fetch(:config_file, CoffeeLint::Config.locate) + config.merge!(CoffeeLint::Config.parse(fname)) unless fname.nil? Coffeelint.context.call('window.coffeelint.lint', script, config) end def self.lint_file(filename, config = {}) Coffeelint.lint(File.read(filename), config)