From ff783059af77e79338354e88e95e7a05b67ca3dc Mon Sep 17 00:00:00 2001 From: Maxime Tyler <127086@supinfo.com> Date: Wed, 18 Feb 2015 16:36:16 +0100 Subject: [PATCH] feat(onlyConfig): option to disable validation if there is no config file --- lib/init.coffee | 4 ++++ lib/linter-jscs.coffee | 8 +++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/lib/init.coffee b/lib/init.coffee index c397c6c..c407656 100644 --- a/lib/init.coffee +++ b/lib/init.coffee @@ -18,6 +18,10 @@ module.exports = type: 'boolean' default: false description: 'Prepends the name of the offending rule to all error messages.' + onlyConfig: + type: 'boolean' + default: false + description: 'Disable linter if there is no config file found for the linter.' activate: -> console.log 'activate linter-jscs' diff --git a/lib/linter-jscs.coffee b/lib/linter-jscs.coffee index 8b5f24d..7100e69 100644 --- a/lib/linter-jscs.coffee +++ b/lib/linter-jscs.coffee @@ -25,7 +25,7 @@ class LinterJscs extends Linter isNodeExecutable: yes - options: ['executablePath', 'preset', 'harmony', 'verbose'] + options: ['executablePath', 'preset', 'harmony', 'verbose', 'onlyConfig'] constructor: (editor) -> super editor @@ -62,8 +62,10 @@ class LinterJscs extends Linter @cmd = "#{@cmd} -c #{@config}" if @config @cmd = "#{@cmd} -p #{@preset}" if @preset and not @config - formatMessage: (match) -> - match.message + lintFile: (path, next) => + condition = (@config and @onlyConfig) or !@onlyConfig + path = if condition then path else path: '' + super path, next destroy: -> for option in @options