From 24a950629a56934481aabb5c3086547df60b9bb5 Mon Sep 17 00:00:00 2001 From: William Chargin Date: Fri, 27 Jul 2018 17:23:24 -0700 Subject: [PATCH] Add all available flow-typed libdefs (#548) Summary: Generated with `flow-typed install --skip --overwrite`. Test Plan: Amazingly, `yarn flow` passes. Go team. wchargin-branch: add-libdefs --- flow-typed/npm/chalk_v1.x.x.js | 114 ++++++++++++++ flow-typed/npm/dotenv_v4.x.x.js | 17 +++ flow-typed/npm/enzyme_v3.x.x.js | 128 ++++++++++++++++ flow-typed/npm/isomorphic-fetch_v2.x.x.js | 7 + flow-typed/npm/mkdirp_v0.5.x.js | 13 ++ flow-typed/npm/object-assign_v4.x.x.js | 6 + flow-typed/npm/prettier_v1.x.x.js | 178 ++++++++++++++++++++++ 7 files changed, 463 insertions(+) create mode 100644 flow-typed/npm/chalk_v1.x.x.js create mode 100644 flow-typed/npm/dotenv_v4.x.x.js create mode 100644 flow-typed/npm/enzyme_v3.x.x.js create mode 100644 flow-typed/npm/isomorphic-fetch_v2.x.x.js create mode 100644 flow-typed/npm/mkdirp_v0.5.x.js create mode 100644 flow-typed/npm/object-assign_v4.x.x.js create mode 100644 flow-typed/npm/prettier_v1.x.x.js diff --git a/flow-typed/npm/chalk_v1.x.x.js b/flow-typed/npm/chalk_v1.x.x.js new file mode 100644 index 0000000..45cddd3 --- /dev/null +++ b/flow-typed/npm/chalk_v1.x.x.js @@ -0,0 +1,114 @@ +// flow-typed signature: f965116cdb881170be8c42b10554e195 +// flow-typed version: da30fe6876/chalk_v1.x.x/flow_>=v0.25.x + +type $npm$chalk$StyleElement = { + open: string, + close: string +}; + +type $npm$chalk$Chain = $npm$chalk$Style & ((...text: any[]) => string); + +type $npm$chalk$Style = { + // General + reset: $npm$chalk$Chain, + bold: $npm$chalk$Chain, + dim: $npm$chalk$Chain, + italic: $npm$chalk$Chain, + underline: $npm$chalk$Chain, + inverse: $npm$chalk$Chain, + strikethrough: $npm$chalk$Chain, + + // Text colors + black: $npm$chalk$Chain, + red: $npm$chalk$Chain, + green: $npm$chalk$Chain, + yellow: $npm$chalk$Chain, + blue: $npm$chalk$Chain, + magenta: $npm$chalk$Chain, + cyan: $npm$chalk$Chain, + white: $npm$chalk$Chain, + gray: $npm$chalk$Chain, + grey: $npm$chalk$Chain, + + // Background colors + bgBlack: $npm$chalk$Chain, + bgRed: $npm$chalk$Chain, + bgGreen: $npm$chalk$Chain, + bgYellow: $npm$chalk$Chain, + bgBlue: $npm$chalk$Chain, + bgMagenta: $npm$chalk$Chain, + bgCyan: $npm$chalk$Chain, + bgWhite: $npm$chalk$Chain +}; + +type $npm$chalk$StyleMap = { + // General + reset: $npm$chalk$StyleElement, + bold: $npm$chalk$StyleElement, + dim: $npm$chalk$StyleElement, + italic: $npm$chalk$StyleElement, + underline: $npm$chalk$StyleElement, + inverse: $npm$chalk$StyleElement, + strikethrough: $npm$chalk$StyleElement, + + // Text colors + black: $npm$chalk$StyleElement, + red: $npm$chalk$StyleElement, + green: $npm$chalk$StyleElement, + yellow: $npm$chalk$StyleElement, + blue: $npm$chalk$StyleElement, + magenta: $npm$chalk$StyleElement, + cyan: $npm$chalk$StyleElement, + white: $npm$chalk$StyleElement, + gray: $npm$chalk$StyleElement, + + // Background colors + bgBlack: $npm$chalk$StyleElement, + bgRed: $npm$chalk$StyleElement, + bgGreen: $npm$chalk$StyleElement, + bgYellow: $npm$chalk$StyleElement, + bgBlue: $npm$chalk$StyleElement, + bgMagenta: $npm$chalk$StyleElement, + bgCyan: $npm$chalk$StyleElement, + bgWhite: $npm$chalk$StyleElement +}; + +declare module "chalk" { + declare var enabled: boolean; + declare var supportsColor: boolean; + declare var styles: $npm$chalk$StyleMap; + + declare function stripColor(value: string): any; + declare function hasColor(str: string): boolean; + + // General + declare var reset: $npm$chalk$Chain; + declare var bold: $npm$chalk$Chain; + declare var dim: $npm$chalk$Chain; + declare var italic: $npm$chalk$Chain; + declare var underline: $npm$chalk$Chain; + declare var inverse: $npm$chalk$Chain; + declare var strikethrough: $npm$chalk$Chain; + + // Text colors + declare var black: $npm$chalk$Chain; + declare var red: $npm$chalk$Chain; + declare var green: $npm$chalk$Chain; + declare var yellow: $npm$chalk$Chain; + declare var blue: $npm$chalk$Chain; + declare var magenta: $npm$chalk$Chain; + declare var cyan: $npm$chalk$Chain; + declare var white: $npm$chalk$Chain; + declare var gray: $npm$chalk$Chain; + declare var grey: $npm$chalk$Chain; + + // Background colors + declare var bgBlack: $npm$chalk$Chain; + declare var bgRed: $npm$chalk$Chain; + declare var bgGreen: $npm$chalk$Chain; + declare var bgYellow: $npm$chalk$Chain; + declare var bgBlue: $npm$chalk$Chain; + declare var bgMagenta: $npm$chalk$Chain; + declare var bgCyan: $npm$chalk$Chain; + declare var bgWhite: $npm$chalk$Chain; +} diff --git a/flow-typed/npm/dotenv_v4.x.x.js b/flow-typed/npm/dotenv_v4.x.x.js new file mode 100644 index 0000000..7bfe16c --- /dev/null +++ b/flow-typed/npm/dotenv_v4.x.x.js @@ -0,0 +1,17 @@ +// flow-typed signature: cf11c66b2c3d752c24fdf3eae1b44e1c +// flow-typed version: 21e1db763b/dotenv_v4.x.x/flow_>=v0.34.x + +declare module "dotenv" { + declare type DotenvOptions = { + encoding?: string, + path?: string + }; + + declare function config(options?: DotenvOptions): boolean; + + declare module.exports: { + config: typeof config, + load: typeof config, + parse: (src: string | Buffer) => { [string]: string } + } +} diff --git a/flow-typed/npm/enzyme_v3.x.x.js b/flow-typed/npm/enzyme_v3.x.x.js new file mode 100644 index 0000000..abf4330 --- /dev/null +++ b/flow-typed/npm/enzyme_v3.x.x.js @@ -0,0 +1,128 @@ +// flow-typed signature: 7be2af8800fdadaea6ac0404d256bafc +// flow-typed version: 6ce6a0467c/enzyme_v3.x.x/flow_>=v0.53.x + +import * as React from "react"; + +declare module "enzyme" { + declare type PredicateFunction = ( + wrapper: T, + index: number + ) => boolean; + declare type NodeOrNodes = React.Node | Array; + declare type EnzymeSelector = string | Class> | Object; + + // CheerioWrapper is a type alias for an actual cheerio instance + // TODO: Reference correct type from cheerio's type declarations + declare type CheerioWrapper = any; + + declare class Wrapper { + find(selector: EnzymeSelector): this, + findWhere(predicate: PredicateFunction): this, + filter(selector: EnzymeSelector): this, + filterWhere(predicate: PredicateFunction): this, + hostNodes(): this, + contains(nodeOrNodes: NodeOrNodes): boolean, + containsMatchingElement(node: React.Node): boolean, + containsAllMatchingElements(nodes: NodeOrNodes): boolean, + containsAnyMatchingElements(nodes: NodeOrNodes): boolean, + dive(option?: { context?: Object }): this, + exists(): boolean, + isEmptyRender(): boolean, + matchesElement(node: React.Node): boolean, + hasClass(className: string): boolean, + is(selector: EnzymeSelector): boolean, + isEmpty(): boolean, + not(selector: EnzymeSelector): this, + children(selector?: EnzymeSelector): this, + childAt(index: number): this, + parents(selector?: EnzymeSelector): this, + parent(): this, + closest(selector: EnzymeSelector): this, + render(): CheerioWrapper, + unmount(): this, + text(): string, + html(): string, + get(index: number): React.Node, + getDOMNode(): HTMLElement | HTMLInputElement, + at(index: number): this, + first(): this, + last(): this, + state(key?: string): any, + context(key?: string): any, + props(): Object, + prop(key: string): any, + key(): string, + simulate(event: string, ...args: Array): this, + setState(state: {}, callback?: Function): this, + setProps(props: {}): this, + setContext(context: Object): this, + instance(): React.Component<*, *>, + update(): this, + debug(options?: Object): string, + type(): string | Function | null, + name(): string, + forEach(fn: (node: this, index: number) => mixed): this, + map(fn: (node: this, index: number) => T): Array, + reduce( + fn: (value: T, node: this, index: number) => T, + initialValue?: T + ): Array, + reduceRight( + fn: (value: T, node: this, index: number) => T, + initialValue?: T + ): Array, + some(selector: EnzymeSelector): boolean, + someWhere(predicate: PredicateFunction): boolean, + every(selector: EnzymeSelector): boolean, + everyWhere(predicate: PredicateFunction): boolean, + length: number + } + + declare class ReactWrapper extends Wrapper { + constructor(nodes: NodeOrNodes, root: any, options?: ?Object): ReactWrapper, + mount(): this, + ref(refName: string): this, + detach(): void + } + + declare class ShallowWrapper extends Wrapper { + constructor( + nodes: NodeOrNodes, + root: any, + options?: ?Object + ): ShallowWrapper, + equals(node: React.Node): boolean, + shallow(options?: { context?: Object }): ShallowWrapper, + getElement(): React.Node, + getElements(): Array + } + + declare function shallow( + node: React.Node, + options?: { context?: Object, disableLifecycleMethods?: boolean } + ): ShallowWrapper; + declare function mount( + node: React.Node, + options?: { + context?: Object, + attachTo?: HTMLElement, + childContextTypes?: Object + } + ): ReactWrapper; + declare function render( + node: React.Node, + options?: { context?: Object } + ): CheerioWrapper; + + declare module.exports: { + configure(options: { + Adapter?: any, + disableLifecycleMethods?: boolean + }): void, + render: typeof render, + mount: typeof mount, + shallow: typeof shallow, + ShallowWrapper: typeof ShallowWrapper, + ReactWrapper: typeof ReactWrapper + }; +} diff --git a/flow-typed/npm/isomorphic-fetch_v2.x.x.js b/flow-typed/npm/isomorphic-fetch_v2.x.x.js new file mode 100644 index 0000000..4692d54 --- /dev/null +++ b/flow-typed/npm/isomorphic-fetch_v2.x.x.js @@ -0,0 +1,7 @@ +// flow-typed signature: 47370d221401bec823c43c3598266e26 +// flow-typed version: ec28077c25/isomorphic-fetch_v2.x.x/flow_>=v0.25.x + + +declare module 'isomorphic-fetch' { + declare module.exports: (input: string | Request | URL, init?: RequestOptions) => Promise; +} diff --git a/flow-typed/npm/mkdirp_v0.5.x.js b/flow-typed/npm/mkdirp_v0.5.x.js new file mode 100644 index 0000000..e26f9a4 --- /dev/null +++ b/flow-typed/npm/mkdirp_v0.5.x.js @@ -0,0 +1,13 @@ +// flow-typed signature: 82aa0feffc2bbd64dce3bec492f5d601 +// flow-typed version: 3315d89a00/mkdirp_v0.5.x/flow_>=v0.25.0 + +declare module 'mkdirp' { + declare type Options = number | { mode?: number; fs?: mixed }; + + declare type Callback = (err: ?Error, path: ?string) => void; + + declare module.exports: { + (path: string, options?: Options | Callback, callback?: Callback): void; + sync(path: string, options?: Options): void; + }; +} diff --git a/flow-typed/npm/object-assign_v4.x.x.js b/flow-typed/npm/object-assign_v4.x.x.js new file mode 100644 index 0000000..612e2b9 --- /dev/null +++ b/flow-typed/npm/object-assign_v4.x.x.js @@ -0,0 +1,6 @@ +// flow-typed signature: 6b26bd45f602f11945a41846caafb9a1 +// flow-typed version: da30fe6876/object-assign_v4.x.x/flow_>=v0.25.x + +declare module "object-assign" { + declare module.exports: (target: any, ...sources: Array) => Object; +} diff --git a/flow-typed/npm/prettier_v1.x.x.js b/flow-typed/npm/prettier_v1.x.x.js new file mode 100644 index 0000000..0c24491 --- /dev/null +++ b/flow-typed/npm/prettier_v1.x.x.js @@ -0,0 +1,178 @@ +// flow-typed signature: 4eed8da2dc730dc33e7710b465eaa44b +// flow-typed version: cc7a557b34/prettier_v1.x.x/flow_>=v0.56.x + +declare module "prettier" { + declare type AST = Object; + declare type Doc = Object; + declare type FastPath = Object; + + declare type PrettierParserName = + | "babylon" + | "flow" + | "typescript" + | "postcss" + | "css" + | "less" + | "scss" + | "json" + | "graphql" + | "markdown" + | "vue"; + + declare type PrettierParser = { + [name: PrettierParserName]: (text: string, options?: Object) => AST + }; + + declare type CustomParser = ( + text: string, + parsers: PrettierParser, + options: Options + ) => AST; + + declare type Options = {| + printWidth?: number, + tabWidth?: number, + useTabs?: boolean, + semi?: boolean, + singleQuote?: boolean, + trailingComma?: "none" | "es5" | "all", + bracketSpacing?: boolean, + jsxBracketSameLine?: boolean, + arrowParens?: "avoid" | "always", + rangeStart?: number, + rangeEnd?: number, + parser?: PrettierParserName | CustomParser, + filepath?: string, + requirePragma?: boolean, + insertPragma?: boolean, + proseWrap?: "always" | "never" | "preserve", + plugins?: Array + |}; + + declare type Plugin = { + languages: SupportLanguage, + parsers: { [parserName: string]: Parser }, + printers: { [astFormat: string]: Printer } + }; + + declare type Parser = { + parse: ( + text: string, + parsers: { [parserName: string]: Parser }, + options: Object + ) => AST, + astFormat: string + }; + + declare type Printer = { + print: ( + path: FastPath, + options: Object, + print: (path: FastPath) => Doc + ) => Doc, + embed: ( + path: FastPath, + print: (path: FastPath) => Doc, + textToDoc: (text: string, options: Object) => Doc, + options: Object + ) => ?Doc + }; + + declare type CursorOptions = {| + cursorOffset: number, + printWidth?: $PropertyType, + tabWidth?: $PropertyType, + useTabs?: $PropertyType, + semi?: $PropertyType, + singleQuote?: $PropertyType, + trailingComma?: $PropertyType, + bracketSpacing?: $PropertyType, + jsxBracketSameLine?: $PropertyType, + arrowParens?: $PropertyType, + parser?: $PropertyType, + filepath?: $PropertyType, + requirePragma?: $PropertyType, + insertPragma?: $PropertyType, + proseWrap?: $PropertyType, + plugins?: $PropertyType + |}; + + declare type CursorResult = {| + formatted: string, + cursorOffset: number + |}; + + declare type ResolveConfigOptions = {| + useCache?: boolean, + config?: string, + editorconfig?: boolean + |}; + + declare type SupportLanguage = { + name: string, + since: string, + parsers: Array, + group?: string, + tmScope: string, + aceMode: string, + codemirrorMode: string, + codemirrorMimeType: string, + aliases?: Array, + extensions: Array, + filenames?: Array, + linguistLanguageId: number, + vscodeLanguageIds: Array + }; + + declare type SupportOption = {| + since: string, + type: "int" | "boolean" | "choice" | "path", + deprecated?: string, + redirect?: SupportOptionRedirect, + description: string, + oppositeDescription?: string, + default: SupportOptionValue, + range?: SupportOptionRange, + choices?: SupportOptionChoice + |}; + + declare type SupportOptionRedirect = {| + options: string, + value: SupportOptionValue + |}; + + declare type SupportOptionRange = {| + start: number, + end: number, + step: number + |}; + + declare type SupportOptionChoice = {| + value: boolean | string, + description?: string, + since?: string, + deprecated?: string, + redirect?: SupportOptionValue + |}; + + declare type SupportOptionValue = number | boolean | string; + + declare type SupportInfo = {| + languages: Array, + options: Array + |}; + + declare type Prettier = {| + format: (source: string, options?: Options) => string, + check: (source: string, options?: Options) => boolean, + formatWithCursor: (source: string, options: CursorOptions) => CursorResult, + resolveConfig: { + (filePath: string, options?: ResolveConfigOptions): Promise, + sync(filePath: string, options?: ResolveConfigOptions): Promise + }, + clearConfigCache: () => void, + getSupportInfo: (version?: string) => SupportInfo + |}; + + declare export default Prettier; +}