-
Notifications
You must be signed in to change notification settings - Fork 361
chore: Fix on flow type signature to pass type checking on flow >= v0.132.0 #2054
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
Merged
rpl
merged 3 commits into
mozilla:master
from
rpl:fix/flow-type-signature-flow-ge-0.132.0
Nov 4, 2020
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
dist/ | ||
coverage/ | ||
artifacts/ | ||
flow-typed/ | ||
commitlint.config.js |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
[include] | ||
|
||
[libs] | ||
flow-typed/ | ||
|
||
[options] | ||
module.system=node | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
This directory contains flowtyped declarations for the npm modules that do need | ||
valid flow signatures to be able to flow check the modules part of this project. | ||
|
||
The declarations in this directory are not complete definitions of the type defined | ||
in the related modules source code, this declaration files define just as much as | ||
needed for the purpose of flow checking this project source code. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// flow-typed signatures for 'chrome-launcher' module. | ||
|
||
declare module "chrome-launcher" { | ||
declare type LaunchOptions = { | ||
enableExtensions: boolean, | ||
chromePath: ?string, | ||
chromeFlags: Array<string>, | ||
startingUrl: ?string, | ||
userDataDir: ?string, | ||
ignoreDefaultFlags: boolean, | ||
}; | ||
|
||
declare class Launcher { | ||
static defaultFlags: () => Array<string>, | ||
process: child_process$ChildProcess, | ||
kill(): Promise<void>, | ||
} | ||
|
||
declare module.exports: { | ||
Launcher: Class<Launcher>, | ||
launch(options?: LaunchOptions): Promise<Launcher>, | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
// flow-typed signatures for 'firefox-client' module. | ||
|
||
declare module "@cliqz-oss/firefox-client" { | ||
declare class FirefoxClient extends event$EventEmitter {} | ||
declare module.exports: Class<FirefoxClient>; | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
// flow-typed signatures for 'firefox-profile' module. | ||
|
||
declare module "firefox-profile" { | ||
declare type ProfileOptions = { | ||
destinationDirectory: string, | ||
} | ||
|
||
declare type ProfileCallback = | ||
(err: ?Error, profile: Profile) => void; | ||
|
||
declare class Finder { | ||
constructor(baseDir: ?string): Finder, | ||
readProfiles(cb: Function): void, | ||
getPath(name: string, cb: (err: ?Error, profilePath: string) => void): void, | ||
|
||
profiles: Array<{ [key:string]: string }>, | ||
|
||
static locateUserDirectory(): string, | ||
} | ||
|
||
declare class FirefoxProfile { | ||
constructor(opts: ?ProfileOptions): FirefoxProfile, | ||
|
||
extensionsDir: string, | ||
profileDir: string, | ||
userPrefs: string, | ||
defaultPreferences: { [key: string]: any }, | ||
|
||
path(): string, | ||
setPreference(pref: string, value: any): void, | ||
updatePreferences(): void, | ||
|
||
static copy({profileDirectory: string}, cb: ProfileCallback): void, | ||
static copyFromUserProfile({name: string}, cb: ProfileCallback): void, | ||
static Finder: Class<Finder>, | ||
} | ||
|
||
declare module.exports: Class<FirefoxProfile>; | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
// flow-typed signatures for 'watchpack' module. | ||
|
||
declare module "watchpack" { | ||
declare class Watchpack extends event$EventEmitter { | ||
close(): void, | ||
} | ||
|
||
declare module.exports: Class<Watchpack>; | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// flow-typed signatures for 'ws' module. | ||
|
||
declare module "ws" { | ||
declare type ServerOptions = { | ||
host: string, | ||
port: number, | ||
} | ||
|
||
declare type ServerAddressInfo = { | ||
address: string, | ||
port: number, | ||
} | ||
|
||
declare class WebSocket extends events$EventEmitter { | ||
constructor(url: string): WebSocket, | ||
removeEventListener(eventName: string, cb: Function): void, | ||
readyState: "CONNECTING" | "OPEN" | "CLOSING" | "CLOSED", | ||
send(msg: string): void, | ||
close(): void, | ||
|
||
static OPEN: "OPEN", | ||
static CLOSED: "CLOSED", | ||
static CONNECTING: "CONNECTING", | ||
static CLOSING: "CLOSING", | ||
static Server: Class<Server>, | ||
} | ||
|
||
declare class Server extends net$Server { | ||
constructor(opts?: ServerOptions, listenCb: Function): Server, | ||
address(): ServerAddressInfo, | ||
clients: Set<WebSocket>, | ||
close(closedCb: Function): void, | ||
} | ||
|
||
declare module.exports: Class<WebSocket>; | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is Flow really that dumb to not be able to infer the type from this declaration?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as discussed in the triage meeting: I didn't dig too much, but I got the feeling that flow did enforce explicitly type annotations (instead of just trust what type did flow infer) on what it is being exported explicitly from a module (which to me does make kind of sense: "infer the type used internally as much as possible, enforce explicit type annotation of what is exported outside of a module").