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

Commit

Permalink
Add configuration pathfinding
Browse files Browse the repository at this point in the history
Fixes #7
  • Loading branch information
csnover committed Mar 5, 2015
1 parent 5bdc8f9 commit 2dabd51
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions lib/linter-tslint.coffee
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
linterPath = atom.packages.getLoadedPackage("linter").path
Linter = require "#{linterPath}/lib/linter"
{findFile} = require "#{linterPath}/lib/utils"
path = require "path"
exec = (require "child_process").exec
{Range} = require "atom"
Expand All @@ -11,7 +12,7 @@ class LinterTslint extends Linter

# A string, list, tuple or callable that returns a string, list or tuple,
# containing the command line (with arguments) used to lint.
cmd: 'tslint -t json -f'
cmd: ['tslint', '-t', 'json']

executablePath: null

Expand All @@ -23,7 +24,12 @@ class LinterTslint extends Linter

constructor: (editor) ->
super(editor)
@cwd = path.dirname(editor.getUri())

config = findFile @cwd, ['tslint.json']
if config
@cmd = @cmd.concat ['-c', config, '-f']
else
@cmd = @cmd.concat ['-f']

@subscriptions.add atom.config.observe 'linter-tslint.tslintExecutablePath', (tslintPath) =>
@executablePath = tslintPath
Expand Down

0 comments on commit 2dabd51

Please sign in to comment.