type-coverage
Advanced tools
Comparing version 1.13.0 to 1.14.0
import ts from 'typescript'; | ||
import { AnyInfo } from './interfaces'; | ||
export declare function lint(project: string, detail: boolean, debug: boolean, files?: string[], oldProgram?: ts.Program, strict?: boolean, enableCache?: boolean, ignoreCatch?: boolean): Promise<{ | ||
export declare function lint(project: string, detail: boolean, debug: boolean, files?: string[], oldProgram?: ts.Program, strict?: boolean, enableCache?: boolean, ignoreCatch?: boolean, ignoreFiles?: string | string[]): Promise<{ | ||
correctCount: number; | ||
@@ -5,0 +5,0 @@ totalCount: number; |
@@ -6,2 +6,3 @@ "use strict"; | ||
const path = tslib_1.__importStar(require("path")); | ||
const minimatch_1 = tslib_1.__importDefault(require("minimatch")); | ||
const tsconfig_1 = require("./tsconfig"); | ||
@@ -13,3 +14,3 @@ const checker_1 = require("./checker"); | ||
// tslint:disable-next-line:no-big-function cognitive-complexity | ||
async function lint(project, detail, debug, files, oldProgram, strict = false, enableCache = false, ignoreCatch = false) { | ||
async function lint(project, detail, debug, files, oldProgram, strict = false, enableCache = false, ignoreCatch = false, ignoreFiles) { | ||
const { configFilePath, dirname } = tsconfig_1.getTsConfigFilePath(project); | ||
@@ -27,2 +28,7 @@ const config = tsconfig_1.getTsConfig(configFilePath, dirname); | ||
const typeCheckResult = await cache_1.readCache(enableCache); | ||
const ignoreFileGlobs = ignoreFiles | ||
? (typeof ignoreFiles === 'string' | ||
? [ignoreFiles] | ||
: ignoreFiles) | ||
: undefined; | ||
for (const sourceFile of program.getSourceFiles()) { | ||
@@ -32,2 +38,5 @@ let file = sourceFile.fileName; | ||
file = path.relative(process.cwd(), file); | ||
if (ignoreFileGlobs && ignoreFileGlobs.some((f) => minimatch_1.default(file, f))) { | ||
continue; | ||
} | ||
allFiles.add(file); | ||
@@ -34,0 +43,0 @@ const hash = await cache_1.getFileHash(file, enableCache); |
@@ -25,3 +25,3 @@ "use strict"; | ||
suppressError = argv.suppressError; | ||
const { correctCount, totalCount, anys } = await core_1.lint(argv.p || argv.project || '.', true, argv.debug, undefined, undefined, argv.strict, argv.cache, argv['ignore-catch']); | ||
const { correctCount, totalCount, anys } = await core_1.lint(argv.p || argv.project || '.', true, argv.debug, undefined, undefined, argv.strict, argv.cache, argv['ignore-catch'], argv['ignore-files']); | ||
const percent = Math.round(10000 * correctCount / totalCount) / 100; | ||
@@ -28,0 +28,0 @@ const atLeast = await getAtLeast(argv); |
{ | ||
"name": "type-coverage", | ||
"version": "1.13.0", | ||
"version": "1.14.0", | ||
"description": "A CLI tool to check type coverage for typescript code", | ||
@@ -16,3 +16,3 @@ "main": "dist/core.js", | ||
"@types/minimist": "1.2.0", | ||
"@types/node": "11.13.4", | ||
"@types/node": "11.13.5", | ||
"clean-release": "2.7.0", | ||
@@ -25,3 +25,3 @@ "clean-scripts": "1.9.2", | ||
"standard": "12.0.1", | ||
"tslint": "5.15.0", | ||
"tslint": "5.16.0", | ||
"tslint-config-standard": "8.0.1", | ||
@@ -28,0 +28,0 @@ "tslint-sonarts": "1.9.0" |
@@ -34,2 +34,3 @@ # type-coverage | ||
`--cache` | boolean? | [enable cache](#enable-cache) | ||
`--ignore-files` | string[]? | [ignore files](#ignore-files) | ||
@@ -66,2 +67,6 @@ ### strict mode | ||
### ignore files | ||
This tool will ignore the files, eg: `--ignore-files "demo1/*.ts" --ignore-files "demo2/foo.ts"` | ||
## config in package.json | ||
@@ -109,3 +114,4 @@ | ||
enableCache = false, | ||
ignoreCatch = false | ||
ignoreCatch = false, | ||
ignoreFiles?: string | string[] | ||
): Promise<{ | ||
@@ -112,0 +118,0 @@ correctCount: number |
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
72769
1428
132