diff --git a/spec/result.txt b/spec/result.txt index ee98ed6..86c4766 100644 --- a/spec/result.txt +++ b/spec/result.txt @@ -1,6 +1,6 @@ src/tsconfig.ts:35:31: config -src/core.ts:30:45: intrinsicName -src/core.ts:39:159: intrinsicName +src/core.ts:31:45: intrinsicName +src/core.ts:40:159: intrinsicName src/index.ts:15:37: v src/index.ts:15:47: version src/index.ts:21:24: suppressError @@ -11,5 +11,5 @@ src/index.ts:23:106: debug src/index.ts:44:4: error src/index.ts:45:7: error src/index.ts:48:17: error -3167 / 3180 99.59% +3178 / 3191 99.59% type-coverage success. diff --git a/src/core.ts b/src/core.ts index 058f248..f00c43b 100644 --- a/src/core.ts +++ b/src/core.ts @@ -4,7 +4,7 @@ import * as path from 'path' import { getTsConfigFilePath, getTsConfig, getRootNames } from './tsconfig' // tslint:disable-next-line:no-big-function -export async function lint(project: string, detail: boolean, debug: boolean, files?: string[]) { +export async function lint(project: string, detail: boolean, debug: boolean, rootPath: string, files?: string[]) { const { configFilePath, dirname } = getTsConfigFilePath(project) const config = getTsConfig(configFilePath, dirname) @@ -13,7 +13,8 @@ export async function lint(project: string, detail: boolean, debug: boolean, fil throw errors } - const rootNames = await getRootNames(config, dirname) + let rootNames = await getRootNames(config, dirname) + rootNames = rootNames.map((r) => path.resolve(rootPath, r)) const program = ts.createProgram(rootNames, compilerOptions) const checker = program.getTypeChecker() diff --git a/src/index.ts b/src/index.ts index a1c28fc..145925b 100644 --- a/src/index.ts +++ b/src/index.ts @@ -20,7 +20,7 @@ async function executeCommandLine() { suppressError = argv.suppressError - const { correctCount, totalCount, anys } = await lint(argv.p || argv.project || '.', argv.detail, argv.debug) + const { correctCount, totalCount, anys } = await lint(argv.p || argv.project || '.', argv.detail, argv.debug, process.cwd()) for (const { file, line, character, text } of anys) { console.log(`${file}:${line + 1}:${character + 1}: ${text}`) }