type-coverage
Advanced tools
Comparing version 1.4.0 to 1.4.1
@@ -1,2 +0,3 @@ | ||
export declare function lint(project: string, detail: boolean, debug: boolean, files?: string[]): Promise<{ | ||
import ts from 'typescript'; | ||
export declare function lint(project: string, detail: boolean, debug: boolean, files?: string[], oldProgram?: ts.Program): Promise<{ | ||
correctCount: number; | ||
@@ -10,2 +11,3 @@ totalCount: number; | ||
}[]; | ||
program: ts.Program; | ||
}>; |
@@ -8,3 +8,3 @@ "use strict"; | ||
// tslint:disable-next-line:no-big-function | ||
async function lint(project, detail, debug, files) { | ||
async function lint(project, detail, debug, files, oldProgram) { | ||
const { configFilePath, dirname } = tsconfig_1.getTsConfigFilePath(project); | ||
@@ -17,3 +17,3 @@ const config = tsconfig_1.getTsConfig(configFilePath, dirname); | ||
const rootNames = await tsconfig_1.getRootNames(config, dirname); | ||
const program = typescript_1.default.createProgram(rootNames, compilerOptions); | ||
const program = typescript_1.default.createProgram(rootNames, compilerOptions, undefined, oldProgram); | ||
const checker = program.getTypeChecker(); | ||
@@ -890,4 +890,4 @@ let correctCount = 0; | ||
} | ||
return { correctCount, totalCount, anys }; | ||
return { correctCount, totalCount, anys, program }; | ||
} | ||
exports.lint = lint; |
@@ -44,5 +44,5 @@ "use strict"; | ||
const include = config.include; | ||
const exclude = config.exclude || ['./node_modules/**']; | ||
const exclude = config.exclude || ['node_modules/**']; | ||
if (config.files) { | ||
return config.files.map(f => path.relative(process.cwd(), path.resolve(dirname, f))); | ||
return config.files.map(f => path.resolve(dirname, f)); | ||
} | ||
@@ -64,5 +64,6 @@ if (include && Array.isArray(include) && include.length > 0) { | ||
} | ||
return globAsync(rules.length === 1 ? rules[0] : `{${rules.join(',')}}`, exclude); | ||
return globAsync(rules.length === 1 ? rules[0] : `{${rules.join(',')}}`, exclude, dirname); | ||
} | ||
return globAsync(`${dirname}/**/*.{ts,tsx}`, exclude); | ||
const rootNames = await globAsync(`**/*.{ts,tsx}`, exclude, dirname); | ||
return rootNames.map((r) => path.resolve(process.cwd(), dirname, r)); | ||
} | ||
@@ -82,5 +83,5 @@ exports.getRootNames = getRootNames; | ||
} | ||
function globAsync(pattern, ignore) { | ||
function globAsync(pattern, ignore, cwd) { | ||
return new Promise((resolve, reject) => { | ||
glob_1.default(pattern, { ignore }, (error, matches) => { | ||
glob_1.default(pattern, { ignore, cwd }, (error, matches) => { | ||
if (error) { | ||
@@ -87,0 +88,0 @@ reject(error); |
{ | ||
"name": "type-coverage", | ||
"version": "1.4.0", | ||
"version": "1.4.1", | ||
"description": "A CLI tool to check type coverage for typescript code", | ||
@@ -5,0 +5,0 @@ "main": "dist/core.js", |
@@ -40,2 +40,6 @@ # type-coverage | ||
## vscode plugin | ||
<https://marketplace.visualstudio.com/items?itemName=york-yao.vscode-type-coverage> | ||
## add dynamic badges of type coverage | ||
@@ -42,0 +46,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
62550
1060
51