Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
)
}
const files = args._ && args._.length
? args._
: ['src/**/*.ts', 'src/**/*.tsx', 'tests/**/*.ts', 'tests/**/*.tsx']
// respect linterOptions.exclude from tslint.json
if (config && config.linterOptions && config.linterOptions.exclude) {
// use the raw tslint.json data because config contains absolute paths
const rawTslintConfig = JSON.parse(fs.readFileSync(tslintConfigPath, 'utf-8'))
const excludedGlobs = rawTslintConfig.linterOptions.exclude
excludedGlobs.forEach((g) => files.push('!' + g))
}
return globby(files, { cwd }).then(files => {
files.forEach(lint)
if (silent) return
const result = linter.getResult()
if (!result) {
console.log(`No result.\n`)
} else if (result.output.trim()) {
process.stdout.write(result.output)
} else if (result.fixes && result.fixes.length) {
// some formatters do not report fixes.
const f = new tslint.Formatters.ProseFormatter()
process.stdout.write(f.format(result.failures, result.fixes))
} else if (!result.failures.length) {
console.log(`No lint errors found.\n`)
}
if (result.failures.length && !args.force) {