Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
private getJsDocs(node: ts.Node, sourceFile: ts.SourceFile) {
const jsDocs = utilGetJsDocs(node)
const result: JsDoc[] = []
for (const jsDoc of jsDocs) {
result.push({
...jsDoc,
type: jsDoc.type ? this.getType(jsDoc.type, sourceFile) : undefined
})
}
return result
}
export async function lint(project: string, options?: Partial) {
const lintOptions = { ...defaultLintOptions, ...options }
const { rootNames, compilerOptions } = await getProjectRootNamesAndCompilerOptions(project)
const program = ts.createProgram(rootNames, compilerOptions, undefined, lintOptions.oldProgram)
const checker = program.getTypeChecker()
const allFiles = new Set()
const sourceFileInfos: SourceFileInfo[] = []
const typeCheckResult = await readCache(lintOptions.enableCache)
const ignoreFileGlobs = lintOptions.ignoreFiles
? (typeof lintOptions.ignoreFiles === 'string'
? [lintOptions.ignoreFiles]
: lintOptions.ignoreFiles)
: undefined
for (const sourceFile of program.getSourceFiles()) {
let file = sourceFile.fileName
if (!file.includes('node_modules') && (!lintOptions.files || lintOptions.files.includes(file))) {
file = path.relative(process.cwd(), file)