Skip to content

Commit

Permalink
further improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
LucianBuzzo committed Dec 22, 2017
1 parent 10a0374 commit 7c75951
Showing 1 changed file with 18 additions and 22 deletions.
40 changes: 18 additions & 22 deletions lib/resin-lint.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,14 @@ lintCoffeeFiles = (files, config) ->
for file in files
source = read(file)
errorReport.lint(file, source, config)
return errorReport
errorReport

report = new reporter errorReport,
colorize: process.stdout.isTTY
quiet: false
report.publish()

return errorReport.getExitCode()

lintTsFiles = (files, config) ->
parsedConfig = tslint.Configuration.parseConfigFile(config)
Expand All @@ -80,35 +87,24 @@ lintTsFiles = (files, config) ->
for file in files
source = read(file)
linter.lint(file, source, parsedConfig)
return linter.getResult()

runLint = (resinLintConfig, paths, config) ->
scripts = findFiles(resinLintConfig.extensions, paths)
errorReport = linter.getResult()

if resinLintConfig.lang is 'typescript'
errorReport = lintTsFiles(scripts, config)
console.log(linter.getResult().output)

console.log(errorReport.output)
return if errorReport.errorCount is 0 then 0 else 1

process.on 'exit', ->
process.exit(errorReport.errorCount > 0 : 1 : 0)
runLint = (resinLintConfig, paths, config) ->
scripts = findFiles(resinLintConfig.extensions, paths)

return
if resinLintConfig.lang is 'typescript'
linterExitCode = lintTsFiles(scripts, config)

if resinLintConfig.lang is 'coffeescript'
errorReport = lintCoffeeFiles(scripts, config)

report = new reporter errorReport,
colorize: process.stdout.isTTY
quiet: false
report.publish()

process.on 'exit', ->
process.exit(errorReport.getExitCode())

return
linterExitCode = lintCoffeeFiles(scripts, config)

throw new Error("Language #{resinlintConfig.language} is not supported by resin-lint.")
process.on 'exit', ->
process.exit(linterExitCode)

module.exports = (passed_params) ->
try
Expand Down

0 comments on commit 7c75951

Please sign in to comment.