-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Add noImplicitReexport Config Option #11290
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
815b391
f1075f0
72afd1a
bb1dd82
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| /// <reference path="typings/fourslash.d.ts" /> | ||
|
|
||
| // @filename: pyrightconfig.json | ||
| //// { | ||
| //// "typeCheckingMode": "basic", | ||
| //// "noImplicitReexport": false | ||
| //// } | ||
|
|
||
| // @filename: testLib/py.typed | ||
| // @library: true | ||
| //// | ||
|
|
||
| // @filename: testLib/__init__.py | ||
| // @library: true | ||
| //// from .module1 import one as one, two, three | ||
|
|
||
| // @filename: testLib/module1.py | ||
| // @library: true | ||
| //// one: int = 1 | ||
| //// two: int = 2 | ||
| //// three: int = 3 | ||
|
|
||
| // @filename: .src/test1.py | ||
| //// # pyright: reportPrivateImportUsage=true | ||
| //// from testLib import one # explicit re-export (as-alias) — always ok | ||
| //// from testLib import two # plain import, public name — ok with noImplicitReexport=false | ||
| //// from testLib import three # plain import, public name — ok with noImplicitReexport=false | ||
| //// import testLib | ||
| //// testLib.one | ||
| //// testLib.two # ok with noImplicitReexport=false | ||
| //// testLib.three # ok with noImplicitReexport=false | ||
|
|
||
| // Verify that no reportPrivateImportUsage errors are raised for public names | ||
| // when noImplicitReexport=false. Private-name behavior is tested in privateImportUsage.test.ts. | ||
| // @ts-ignore | ||
| await helper.verifyDiagnostics(); |
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
|
|
@@ -99,6 +99,11 @@ | |||
| "title": "Treat typing-specific aliases to standard types as deprecated", | ||||
| "default": false | ||||
| }, | ||||
| "noImplicitReexport": { | ||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think you need a setting for this in the vscode-pyright package.json. Like the example here: pyright/packages/vscode-pyright/package.json Line 194 in c971180
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. added in 1e6d878
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Shouldn't the title be the same for both?
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes, sorry--fixed now (and i've simplified the failing tests b/c I couldn't figure out why the strings weren't matching, they looked exactly the same) |
||||
| "type": "boolean", | ||||
| "title": "When true, imported symbols in py.typed packages require explicit re-export (via __all__ or 'as' alias). Set to false to allow plain imports as re-exports for public names.", | ||||
| "default": true | ||||
| }, | ||||
| "reportGeneralTypeIssues": { | ||||
| "$ref": "#/definitions/diagnostic", | ||||
| "title": "Controls reporting of general type issues", | ||||
|
|
@@ -618,6 +623,9 @@ | |||
| "deprecateTypingAliases": { | ||||
| "$ref": "#/definitions/deprecateTypingAliases" | ||||
| }, | ||||
| "noImplicitReexport": { | ||||
| "$ref": "#/definitions/noImplicitReexport" | ||||
| }, | ||||
| "reportGeneralTypeIssues": { | ||||
| "$ref": "#/definitions/reportGeneralTypeIssues" | ||||
| }, | ||||
|
|
@@ -936,6 +944,9 @@ | |||
| "deprecateTypingAliases": { | ||||
| "$ref": "#/definitions/deprecateTypingAliases" | ||||
| }, | ||||
| "noImplicitReexport": { | ||||
| "$ref": "#/definitions/noImplicitReexport" | ||||
| }, | ||||
| "reportGeneralTypeIssues": { | ||||
| "$ref": "#/definitions/reportGeneralTypeIssues" | ||||
| }, | ||||
|
|
||||
Uh oh!
There was an error while loading. Please reload this page.