mirror of
https://github.com/microsoft/pyright.git
synced 2024-08-17 03:40:44 +03:00
Renamed "--ignore-external" to "--ignoreexternal" for consistency. Removed undocuemented "!" mechanism for invoking this functionality.
This commit is contained in:
parent
dc7382d52f
commit
a192486099
@ -9,6 +9,7 @@ Pyright can be run as either a VS Code extension or as a node-based command-line
|
||||
| --createstub IMPORT | Create type stub file(s) for import |
|
||||
| --dependencies | Emit import dependency information |
|
||||
| -h, --help | Show help message |
|
||||
| --ignoreexternal | Ignore external imports for --verifytypes |
|
||||
| --lib | Use library code for types when stubs are missing |
|
||||
| --outputjson | Output results in JSON format |
|
||||
| -p, --project FILE OR DIRECTORY | Use the configuration file at this location |
|
||||
@ -21,7 +22,6 @@ Pyright can be run as either a VS Code extension or as a node-based command-line
|
||||
| --verifytypes IMPORT | Verify completeness of types in py.typed package |
|
||||
| --version | Print pyright version |
|
||||
| -w, --watch | Continue to run and watch for changes (4) |
|
||||
| --ignore-external | Ignore external imports for --verifytypes |
|
||||
|
||||
(1) If specific files are specified on the command line, the pyrightconfig.json file is ignored.
|
||||
|
||||
|
@ -192,6 +192,8 @@ The `--verifytypes` option can be combined with `--outputjson` to emit the resul
|
||||
|
||||
The `--verifytypes` feature can be integrated into a continuous integration (CI) system to verify that a library remains “type complete”.
|
||||
|
||||
If the `--verifytypes` option is combined with `--ignoreexternal`, any incomplete types that are imported from other external packages are ignored. This allows library authors to focus on adding type annotations for the code that is directly under their control.
|
||||
|
||||
|
||||
### Improving Type Completeness
|
||||
|
||||
|
@ -113,6 +113,7 @@ function processArgs() {
|
||||
{ name: 'dependencies', type: Boolean },
|
||||
{ name: 'files', type: String, multiple: true, defaultOption: true },
|
||||
{ name: 'help', alias: 'h', type: Boolean },
|
||||
{ name: 'ignoreexternal', type: Boolean },
|
||||
{ name: 'lib', type: Boolean },
|
||||
{ name: 'outputjson', type: Boolean },
|
||||
{ name: 'project', alias: 'p', type: String },
|
||||
@ -125,7 +126,6 @@ function processArgs() {
|
||||
{ name: 'verbose', type: Boolean },
|
||||
{ name: 'version', type: Boolean },
|
||||
{ name: 'watch', alias: 'w', type: Boolean },
|
||||
{ name: 'ignore-external', type: Boolean },
|
||||
];
|
||||
|
||||
let args: CommandLineOptions;
|
||||
@ -248,8 +248,10 @@ function processArgs() {
|
||||
args['verifytypes'] || '',
|
||||
!!args.verbose,
|
||||
!!args.outputjson,
|
||||
args['ignore-external']
|
||||
args['ignoreexternal']
|
||||
);
|
||||
} else if (args['ignoreexternal'] !== undefined) {
|
||||
console.error(`'--ignoreexternal' is valid only when used with '--verifytypes'`);
|
||||
}
|
||||
|
||||
const watch = args.watch !== undefined;
|
||||
@ -342,14 +344,6 @@ function verifyPackageTypes(
|
||||
try {
|
||||
const verifier = new PackageTypeVerifier(realFileSystem);
|
||||
|
||||
// If the package name ends with a bang, we'll take that
|
||||
// to mean that the caller wants to ignore unknown types from imports
|
||||
// outside of the package.
|
||||
if (packageName.endsWith('!')) {
|
||||
ignoreUnknownTypesFromImports = true;
|
||||
packageName = packageName.substr(0, packageName.length - 1);
|
||||
}
|
||||
|
||||
const report = verifier.verify(packageName, ignoreUnknownTypesFromImports);
|
||||
const jsonReport = buildTypeCompletenessReport(packageName, report);
|
||||
|
||||
@ -514,6 +508,7 @@ function printUsage() {
|
||||
' --createstub IMPORT Create type stub file(s) for import\n' +
|
||||
' --dependencies Emit import dependency information\n' +
|
||||
' -h,--help Show this help message\n' +
|
||||
' --ignoreexternal Ignore external imports for --verifytypes\n' +
|
||||
' --lib Use library code to infer types when stubs are missing\n' +
|
||||
' --outputjson Output results in JSON format\n' +
|
||||
' -p,--project FILE OR DIRECTORY Use the configuration file at this location\n' +
|
||||
@ -525,8 +520,7 @@ function printUsage() {
|
||||
' --verbose Emit verbose diagnostics\n' +
|
||||
' --verifytypes PACKAGE Verify type completeness of a py.typed package\n' +
|
||||
' --version Print Pyright version\n' +
|
||||
' -w,--watch Continue to run and watch for changes\n' +
|
||||
' --ignore-external Ignore external imports for --verifytypes\n'
|
||||
' -w,--watch Continue to run and watch for changes\n'
|
||||
);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user