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

Add configuration pathfinding #8

Merged
merged 1 commit into from
Mar 5, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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