Skip to content
This repository has been archived by the owner on Aug 7, 2023. It is now read-only.

Commit

Permalink
feat(onlyConfig): option to disable validation if there is no config …
Browse files Browse the repository at this point in the history
…file
  • Loading branch information
Maxime Tyler committed Feb 18, 2015
1 parent 566c491 commit ff78305
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
4 changes: 4 additions & 0 deletions lib/init.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -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'
8 changes: 5 additions & 3 deletions lib/linter-jscs.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit ff78305

Please sign in to comment.