repo stringlengths 5 106 | file_url stringlengths 78 301 | file_path stringlengths 4 211 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 14:56:49 2026-01-05 02:23:25 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/get-def2/format.test.js | tests/format/flow-repo/get-def2/format.test.js | runFormatTest(import.meta, ["flow"]);
| javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/get-def2/lib/jsx.js | tests/format/flow-repo/get-def2/lib/jsx.js | declare var $React: $Exports<'react'>; // fake import
type $JSXIntrinsic<T> = Class<$React.Component<void,T,mixed>>;
type $JSXIntrinsics = {
div: $JSXIntrinsic<{id: string}>,
span: $JSXIntrinsic<{id: string, class: string}>,
};
| javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/get-def2/lib/format.test.js | tests/format/flow-repo/get-def2/lib/format.test.js | runFormatTest(import.meta, ["flow"]);
| javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/tagged-unions/classes.js | tests/format/flow-repo/tagged-unions/classes.js | // @flow
class Foo {
type: 'foo';
foo: string;
}
class Bar {
type: 'bar';
bar: string;
}
type Foobar = Foo | Bar;
function foobar(x: Foobar): string {
if (x.type === 'foo') {
return foo(x);
} else if (x.type === 'bar') {
return bar(x);
} else {
return 'unknown';
}
}
function foo(x: Foo)... | javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/tagged-unions/interfaces-neg.js | tests/format/flow-repo/tagged-unions/interfaces-neg.js | /* @flow */
declare interface IDataBase {
id: string,
name: string,
}
declare interface IUserData extends IDataBase {
kind: "user",
}
declare interface ISystemData extends IDataBase {
kind: "system",
}
declare type IData = IUserData | ISystemData;
const data: IData = {
id: "",
name: "",
kind: "system... | javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/tagged-unions/interfaces-pos.js | tests/format/flow-repo/tagged-unions/interfaces-pos.js | /* @flow */
declare interface IDataBase {
id: string,
name: string,
}
declare interface IUserData extends IDataBase {
kind: "user",
}
declare interface ISystemData extends IDataBase {
kind: "system",
}
declare type IData = IUserData | ISystemData;
const data: IData = {
id: "",
name: "",
kind: "system... | javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/tagged-unions/type-decls-neg.js | tests/format/flow-repo/tagged-unions/type-decls-neg.js | /* @flow */
type DataBase = {
id: string,
name: string,
};
type UserData = {
id: string,
name: string,
kind: "user",
}
type SystemData = {
id: string,
name: string,
kind: "system",
}
declare type Data = UserData | SystemData;
const data: Data = {
id: "",
name: "",
kind: "system",
}
if (data.... | javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/tagged-unions/type-decls-pos.js | tests/format/flow-repo/tagged-unions/type-decls-pos.js | /* @flow */
type DataBase = {
id: string,
name: string,
};
type UserData = {
id: string,
name: string,
kind: "user",
}
type SystemData = {
id: string,
name: string,
kind: "system",
}
declare type Data = UserData | SystemData;
const data: Data = {
id: "",
name: "",
kind: "system",
}
if (data.... | javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/tagged-unions/format.test.js | tests/format/flow-repo/tagged-unions/format.test.js | runFormatTest(import.meta, ["flow"]);
| javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/docblock_flow/without_flow.js | tests/format/flow-repo/docblock_flow/without_flow.js | /* some other comment */
("": void); // no error
| javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/docblock_flow/use_strict_with_flow.js | tests/format/flow-repo/docblock_flow/use_strict_with_flow.js | "use strict";
/* @flow */
("": void); // error
| javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/docblock_flow/multiple_providesModule_2.js | tests/format/flow-repo/docblock_flow/multiple_providesModule_2.js | /**
* @providesModule Foo
* @flow
*/
/**
* @providesModule Bar
*/
| javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/docblock_flow/max_header_tokens.js | tests/format/flow-repo/docblock_flow/max_header_tokens.js | /* @flow */
/* second token */
/* third token */
/**
* After max_header_tokens (in .flowconfig), we no longer care:
*
* @flow
*/
| javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/docblock_flow/multiple_flows_2.js | tests/format/flow-repo/docblock_flow/multiple_flows_2.js | /**
* @flow
* @noflow
*/
| javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/docblock_flow/multiple_flows_1.js | tests/format/flow-repo/docblock_flow/multiple_flows_1.js | /* @flow */
/* @flow */
| javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/docblock_flow/license_with_flow.js | tests/format/flow-repo/docblock_flow/license_with_flow.js | /* Copyright example */
/* @flow */
("": void); // error
| javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/docblock_flow/multiple_providesModule_1.js | tests/format/flow-repo/docblock_flow/multiple_providesModule_1.js | /**
* @providesModule Foo
* @providesModule Bar
* @flow
*/
| javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/docblock_flow/with_flow.js | tests/format/flow-repo/docblock_flow/with_flow.js | /* @flow */
("": void); // error
| javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/docblock_flow/format.test.js | tests/format/flow-repo/docblock_flow/format.test.js | runFormatTest(import.meta, ["flow"]);
| javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/parse/no_parse_error.js | tests/format/flow-repo/parse/no_parse_error.js | /*
@flow
*/
var x = 'Test';
var y = 5 / x;
var z: {
type: number,
y: string
} = {type: 1, y: 'hey'};
| javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/parse/format.test.js | tests/format/flow-repo/parse/format.test.js | runFormatTest(import.meta, ["flow"]);
| javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/config_module_system_node_resolve_dirname/toplevel.js | tests/format/flow-repo/config_module_system_node_resolve_dirname/toplevel.js | // @flow
import {name} from "testproj";
(name: "node_modules/testproj");
(name: "custom_resolve_dir/testproj"); // Error: Resolve from node_modules first!
| javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/config_module_system_node_resolve_dirname/format.test.js | tests/format/flow-repo/config_module_system_node_resolve_dirname/format.test.js | runFormatTest(import.meta, ["flow"]);
| javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/config_module_system_node_resolve_dirname/custom_resolve_dir/testproj/index.js | tests/format/flow-repo/config_module_system_node_resolve_dirname/custom_resolve_dir/testproj/index.js | // @flow
export var name: "otherdir/testproj" = "otherdir/testproj";
| javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/config_module_system_node_resolve_dirname/custom_resolve_dir/testproj/format.test.js | tests/format/flow-repo/config_module_system_node_resolve_dirname/custom_resolve_dir/testproj/format.test.js | runFormatTest(import.meta, ["flow"]);
| javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/config_module_system_node_resolve_dirname/custom_resolve_dir/testproj2/index.js | tests/format/flow-repo/config_module_system_node_resolve_dirname/custom_resolve_dir/testproj2/index.js | // @flow
export var name: "otherdir/testproj2" = "otherdir/testproj2";
| javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/config_module_system_node_resolve_dirname/custom_resolve_dir/testproj2/format.test.js | tests/format/flow-repo/config_module_system_node_resolve_dirname/custom_resolve_dir/testproj2/format.test.js | runFormatTest(import.meta, ["flow"]);
| javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/config_module_system_node_resolve_dirname/subdir/sublevel.js | tests/format/flow-repo/config_module_system_node_resolve_dirname/subdir/sublevel.js | // @flow
import {name} from "testproj2";
(name: "node_modules/testproj2"); // Error: Resolve from sibling 'custom_resolve_dir' first!
(name: "subdir/custom_resolve_dir/testproj2");
| javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/config_module_system_node_resolve_dirname/subdir/format.test.js | tests/format/flow-repo/config_module_system_node_resolve_dirname/subdir/format.test.js | runFormatTest(import.meta, ["flow"]);
| javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/config_module_system_node_resolve_dirname/subdir/custom_resolve_dir/testproj2/index.js | tests/format/flow-repo/config_module_system_node_resolve_dirname/subdir/custom_resolve_dir/testproj2/index.js | // @flow
export var name: "subdir/custom_resolve_dir/testproj2" = "subdir/custom_resolve_dir/testproj2";
| javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/config_module_system_node_resolve_dirname/subdir/custom_resolve_dir/testproj2/format.test.js | tests/format/flow-repo/config_module_system_node_resolve_dirname/subdir/custom_resolve_dir/testproj2/format.test.js | runFormatTest(import.meta, ["flow"]);
| javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/logical/logical.js | tests/format/flow-repo/logical/logical.js | /* @flow */
/**
* A falsy variable on the left side of &&
*/
function logical1a(): number { // expected `: boolean`
var x = false;
return x && '123';
}
/**
* A truthy variable on the left side of &&
*/
function logical1b(): string {
var x = true;
return x && '123';
}
/**
* A literal on the left ... | javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/logical/format.test.js | tests/format/flow-repo/logical/format.test.js | runFormatTest(import.meta, ["flow"]);
| javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/integration/bar.js | tests/format/flow-repo/integration/bar.js | // @flow
| javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/integration/foo.js | tests/format/flow-repo/integration/foo.js | // @flow
require('./bar');
| javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/integration/format.test.js | tests/format/flow-repo/integration/format.test.js | runFormatTest(import.meta, ["flow"]);
| javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/reflection/type.js | tests/format/flow-repo/reflection/type.js | declare var a: number;
var b: typeof a = "...";
var c: typeof a = "...";
type T = number;
var x:T = "...";
// what about recursive unions?
| javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/reflection/format.test.js | tests/format/flow-repo/reflection/format.test.js | runFormatTest(import.meta, ["flow"]);
| javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/get-def/library.js | tests/format/flow-repo/get-def/library.js | /* @flow */
module.exports = {
iTakeAString: function(name: string): number {
return 42;
},
bar: function(): number {
return 42;
},
};
| javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/get-def/imports.js | tests/format/flow-repo/get-def/imports.js | // @flow
import thing from "./helpers/exports_default.js";
thing;
import {foo, bar as baz} from "./helpers/exports_named.js";
foo;
baz;
import * as things from "./helpers/exports_named.js";
things;
| javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/get-def/class.js | tests/format/flow-repo/get-def/class.js | // @flow
class Foo {
prop: ?string;
#privateProp: number;
fun(): void {
this.#privateProp;
this.#privateProp = 4;
}
}
const foo = new Foo();
foo.prop;
foo.prop = null;
foo.fun();
if (foo.prop != null) {
foo.prop;
}
function f(x: ?Foo): void {
x.fun();
}
function f(x: Foo | null | void): void {
... | javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/get-def/example.js | tests/format/flow-repo/get-def/example.js | /* @flow */
var lib = require('./library');
function add(a: number, b: number): number {
return a + b;
}
var re = /^keynote (talk){2} (lightning){3,5} (talk){2} closing partytime!!!/
// t123456
add(lib.iTakeAString(42), 7);
// D123456
lib.bar();
| javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/get-def/format.test.js | tests/format/flow-repo/get-def/format.test.js | runFormatTest(import.meta, ["flow"]);
| javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/get-def/helpers/exports_default.js | tests/format/flow-repo/get-def/helpers/exports_default.js | // @flow
const x = "foo";
export default x;
| javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/get-def/helpers/exports_named.js | tests/format/flow-repo/get-def/helpers/exports_named.js | // @flow
export const foo = "foo";
export const bar = "bar";
| javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/get-def/helpers/format.test.js | tests/format/flow-repo/get-def/helpers/format.test.js | runFormatTest(import.meta, ["flow"]);
| javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/builtins/genericfoo.js | tests/format/flow-repo/builtins/genericfoo.js | class Foo<T> {
x:T;
self():Foo<T> { return this; }
map<U>(callbackfn: () => U): Foo<U> { return new Foo(); }
set(x:T): void { }
get(): T { return this.x; }
}
module.exports = Foo;
| javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/builtins/array.js | tests/format/flow-repo/builtins/array.js | var a = ["..."];
var b = a.map (function (x) { return 0; });
var c: string = b[0]; // error: number !~> string
var array = [];
function f() {
array = array.map (function () { return "..."; });
var x:number = array[0]; // error: string !~> number
}
var Foo = require('./genericfoo');
var foo = new Foo();
functi... | javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/builtins/format.test.js | tests/format/flow-repo/builtins/format.test.js | runFormatTest(import.meta, ["flow"]);
| javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/poly/annot.js | tests/format/flow-repo/poly/annot.js | class A<X> { }
new A; // OK, implicitly inferred type args
class B extends A { } // OK, same as above
function foo(b): A<any> { // ok but unsafe, caller may assume any type arg
return b ? (new A: A<number>): (new A: A<string>);
}
function bar(): A<*> { // error, * can't be {} and {x: string} at the same time
retu... | javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/poly/test.js | tests/format/flow-repo/poly/test.js | class C {
foo<X>(x: X): X { return x; }
foo_<X: number>(x: X): number { return x; }
bar<X>(x: X): X { return x; }
qux(x: number): number { return x; }
}
class D extends C {
foo(x: number): number { return x; } // error (specialization, see below)
foo_(x: number): number { return x; } // OK, but only because... | javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/poly/poly.js | tests/format/flow-repo/poly/poly.js | class Foo<T> {
x:T;
constructor(x:T) { this.x = x; }
}
function bar<S>(foo:Foo<S>,y:S):Foo<S> { return new Foo(y); }
var P = {
bar: bar
}
declare var Q: {
bar<S>(foo:Foo<S>,y:S):Foo<S>;
}
var foo = new Foo(0);
var x:string = foo.x;
var z:Foo<number> = Q.bar(foo,"");
| javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/poly/issue-1029.js | tests/format/flow-repo/poly/issue-1029.js | // @flow
// naive unification causes combinatorial explosion here,
// effectively hangs
declare type Box<T> = {
map1<U>(f: (x: T) => U): Box<U>;
map2<U>(f: (x: T) => U): Box<U>;
map3<U>(f: (x: T) => U): Box<U>;
map4<U>(f: (x: T) => U): Box<U>;
map5<U>(f: (x: T) => U): Box<U>;
}
declare var bool: Box<boolea... | javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/poly/implicit_bounded_instantiation.js | tests/format/flow-repo/poly/implicit_bounded_instantiation.js | // @flow
class Base {}
class Middle extends Base {}
class Child extends Middle {}
class C<T: Middle> {
meth(a: T): T {
return a;
}
}
// T is implicitly (bounded by) Middle in constructor call if not provided.
// Explicit type arg is required in annotation - here a wildcard captures it.
var a: C<*> = new C();... | javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/poly/format.test.js | tests/format/flow-repo/poly/format.test.js | runFormatTest(import.meta, ["flow"]);
| javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/covariance/test.js | tests/format/flow-repo/covariance/test.js | type CovArrayVerbose<X,Y:X> = Array<Y>;
var b: CovArrayVerbose<number,*> = [];
var y: CovArrayVerbose<mixed,*> = b;
y[0] = ""; // error
class NVerbose<E,I:E> {
x: CovArrayVerbose<E,I>;
foo(): CovArrayVerbose<mixed,I> { return this.x; }
}
var nv: NVerbose<number,*> = new NVerbose;
nv.x = [0];
(nv.x[0]: string)... | javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/covariance/format.test.js | tests/format/flow-repo/covariance/format.test.js | runFormatTest(import.meta, ["flow"]);
| javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/match/rules-of-hooks.js | tests/format/flow-repo/match/rules-of-hooks.js | declare const x: 1 | 2;
hook useHook() {}
component WithMatchStatement() {
match (x) {
1 => {
useHook(); // ERROR
}
2 => {}
}
return null
}
component WithMatchExpression() {
return match (x) {
1 => useHook(), // ERROR
2 => undefined,
};
}
match (x) {
1 => {
component Nested... | javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/match/expression.js | tests/format/flow-repo/match/expression.js | // Type of body and abnormal handling
{
declare const x: empty;
const out = match (x) {};
out as empty; // OK
}
declare const x: 1 | 2;
{
const out = match (x) {
1 => true,
2 => false,
};
out as boolean; // OK
out as empty; // ERROR
}
{
const out = match (x) {
1 => true,
2 => 's',
... | javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/match/statement.js | tests/format/flow-repo/match/statement.js | {
declare const x: empty;
match (x) {}; // OK
}
declare const x: 1 | 2;
match (x) {
1 => {}
2 => {}
}
function f1() {
match (x) {
1 => {
throw 0;
}
2 => {
throw 0;
}
};
x; // ERROR: unreachable
}
// Throws in guards
function f2() {
declare function invariant(boolean): emp... | javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/match/matching.js | tests/format/flow-repo/match/matching.js | // Primitive value union
{
declare const x: 1 | -2 | 3n | 's' | false | null;
const e1 = match (x) {
1 => 0,
-2 => 0,
3n => 0,
's' => 0,
false => 0,
null => 0,
};
const e2 = match (x) { // ERROR: not all members checked
1 => 0,
false => 0,
3n => 0,
null => 0,
};
}
//... | javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/match/pattern-errors.js | tests/format/flow-repo/match/pattern-errors.js | // Match expressions only allow `const` bindings
{
declare const x: 0 | 1 | [2] | {a: 3, b: 4};
const e1 = match (x) {
[...let a] => 0, // ERROR
{let a, ...let b} => 0, // ERROR
0 as let a => 0, // ERROR
let a => 0, // ERROR
};
const e2 = match (x) {
[...var a] => 0, // ERROR
{va... | javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/match/patterns.js | tests/format/flow-repo/match/patterns.js | // Top level binding with `const`
{
declare const x: number;
const out = match (x) {
const a => a,
};
out as number; // OK
out as empty; // ERROR
}
// Binding doesn't leak to outer scope
{
declare const x: number;
const out = match (x) {
const a => a,
};
a; // ERROR: cannot resolve name
}
... | javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/match/hints.js | tests/format/flow-repo/match/hints.js | // Annotation hint
type F = string => boolean;
{
declare const x: 'a';
const out: F = match (x) {
'a' => (y => true), // OK
};
}
// Sibling before
{
declare const x: 'a' | 'b';
const out = match (x) {
'a' => [1],
'b' => [], // Should be `Array<number>`
};
out as Array<number>; // OK
}... | javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/match/format.test.js | tests/format/flow-repo/match/format.test.js | runFormatTest(import.meta, ["flow"]);
| javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/malformed_code/format.test.js | tests/format/flow-repo/malformed_code/format.test.js | runFormatTest(import.meta, ["flow"]);
| javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/malformed_code/text.js | tests/format/flow-repo/malformed_code/text.js | // @flow
// Example found at
// https://github.com/sebmarkbage/art/blob/51ffce8164a555d652843241c2fdda52e186cbbd/parsers/svg/text.js#L137
const evil_regex_as_a_string = "/[\s�]*$/";
const error: string = 123; // Should be an error, but can't lex this file
| javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/pure_component/test.js | tests/format/flow-repo/pure_component/test.js | var React = require('react');
class C extends React.PureComponent {
props: { x: number };
}
(<C />); // error (`x` is a required prop)
| javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/pure_component/format.test.js | tests/format/flow-repo/pure_component/format.test.js | runFormatTest(import.meta, ["flow"]);
| javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/throw/test.js | tests/format/flow-repo/throw/test.js | /**
* @flow
*/
function f(): number {
throw new Error(); // OK to not return
}
function g(a: ?string) {
if (a == null) {
throw new Error();
}
return a*1; // a is not null
}
function h(x: number): string {
if (x) {
return 'foo';
} else {
throw new Error();
}
}
| javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/throw/format.test.js | tests/format/flow-repo/throw/format.test.js | runFormatTest(import.meta, ["flow"]);
| javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/class_subtyping/test3.js | tests/format/flow-repo/class_subtyping/test3.js | class A<X, Y, Z> {}
class B extends A<string, number, bool> {}
class C<X, Y, Z> extends B {}
var c: C<number, string, Array<bool>> = new C; // none of the type args matter
var a: A<string, number, Array<bool>> = c; // the third type arg is incorrect
| javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/class_subtyping/test.js | tests/format/flow-repo/class_subtyping/test.js | /* @flow */
class A {}
class B {}
module.exports = { A, B };
| javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/class_subtyping/test2.js | tests/format/flow-repo/class_subtyping/test2.js | /* @flow */
var I = require("./test.js");
class C extends I.A {}
var x: I.A = new C();
var y: I.B = new C();
| javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/class_subtyping/test4.js | tests/format/flow-repo/class_subtyping/test4.js | class C<X> { x: X; }
function foo<X>(c: C<X>, x: X) { }
type O = { f: number };
foo((new C: C<O>), { f_: 0 });
class D extends C<O> {
bar() { this.x; }
}
foo(new D, { f_: 0 });
| javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/class_subtyping/format.test.js | tests/format/flow-repo/class_subtyping/format.test.js | runFormatTest(import.meta, ["flow"]);
| javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/call_caching1/test3.js | tests/format/flow-repo/call_caching1/test3.js | // @flow
declare class ImmBox<T> {
static <U>(x: any): ImmBox<U>;
static (x: any): any;
}
declare class Box<T> {
constructor(x: T): void;
set(value: T): void;
get(): T;
}
const outer = new Box();
const inner = outer.get();
outer.set(ImmBox(inner));
| javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/call_caching1/test.js | tests/format/flow-repo/call_caching1/test.js | // @flow
const Immutable = require('immutable');
const tasksPerStatusMap = new Map(
[].map(taskStatus => [taskStatus, new Map()]),
);
for (let [taskStatus, tasksMap] of tasksPerStatusMap) {
tasksPerStatusMap.set(taskStatus, Immutable.Map(tasksMap));
}
| javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/call_caching1/test2.js | tests/format/flow-repo/call_caching1/test2.js | /* @flow */
declare class Bar<K> {
update<K_>(updater: (value: this) => Bar<K_>): Bar<K_>;
}
declare function foo<U>(
initialValue: U,
callbackfn: (previousValue: U) => U
): U;
declare var items: Bar<string>;
declare var updater: (value: Bar<string>) => Bar<string>;
foo(
items,
(acc) => acc.update(updater... | javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/call_caching1/format.test.js | tests/format/flow-repo/call_caching1/format.test.js | runFormatTest(import.meta, ["flow"]);
| javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/call_caching1/lib/core.js | tests/format/flow-repo/call_caching1/lib/core.js | declare class Array<T> {
@@iterator(): Iterator<T>;
map<U>(callbackfn: (value: T, index: number, array: Array<T>) => U, thisArg?: any): Array<U>;
}
type IteratorResult<Yield,Return> =
| { done: true, value?: Return }
| { done: false, value: Yield };
interface $Iterator<+Yield,+Return,-Next> {
@@iterat... | javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/call_caching1/lib/immutable.js | tests/format/flow-repo/call_caching1/lib/immutable.js | declare module "immutable" {
declare class Map<K,V> {
static <K,V>(iter: Iterator<[K,V]>): Map<K,V>;
static <K:string,V>(object: {+[k:K]:V}): Map<K,V>;
set(key: K, value: V): this;
}
}
| javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/call_caching1/lib/format.test.js | tests/format/flow-repo/call_caching1/lib/format.test.js | runFormatTest(import.meta, ["flow"]);
| javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/new_react/props3.js | tests/format/flow-repo/new_react/props3.js | var React = require('react');
var TestProps = React.createClass({
// Do something illegal inside of propTypes and make sure Flow notices
propTypes: {
arr: React.PropTypes.array,
arr_rec: React.PropTypes.array.isRequired,
bool: React.PropTypes.bool,
bool_rec: React.PropTypes.bool.isRequir... | javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/new_react/import-react.js | tests/format/flow-repo/new_react/import-react.js | /* @flow */
// Testing local binding of React in all kinds of ways. The only reason this
// might even be an issue is that internally, the use of JSX triggers an
// implicit require('react'), so any bugs in (1) interop of CJS require and ES6
// import (2) module re-export, as used to redirect the module name 'React' t... | javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/new_react/state4.js | tests/format/flow-repo/new_react/state4.js | var React = require('React');
var C = React.createClass({
getInitialState: function(): { x: number } {
return { x: 0 };
},
render() {
this.setState({ y: 0 });
return <div>{this.state.z}</div>
}
});
| javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/new_react/state5.js | tests/format/flow-repo/new_react/state5.js | var React = require('React');
class C extends React.Component {
foo(): number {
return this.state.x; // error: need to declare type of state
}
}
| javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/new_react/classes.js | tests/format/flow-repo/new_react/classes.js | var React = require('React');
type DefaultProps = { };
type Props = { x: number };
type State = { y: number };
class Foo extends React.Component {
props: Props;
state: State;
static defaultProps: DefaultProps;
is_mounted: boolean;
static bar(): void {}
qux(): void {
var _: string = this.props.x;
... | javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/new_react/state.js | tests/format/flow-repo/new_react/state.js | /* @flow */
var React = require('react');
type State = {
bar: ?{ qux: string; };
};
var ReactClass = React.createClass({
getInitialState: function():State {
return { bar: null };
},
render: function(): any {
// Any state access here seems to make state any
this.state;
... | javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/new_react/state3.js | tests/format/flow-repo/new_react/state3.js | var React = require('react');
var TestState = React.createClass({
getInitialState: function(): { x: string; } {
return {
x: ''
}
},
test: function() {
var a: number = this.state.x; // error
this.setState({
x: false // error
})
}
});
| javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/new_react/props.js | tests/format/flow-repo/new_react/props.js | var React = require('react');
var TestProps = React.createClass({
propTypes: {
x: React.PropTypes.string,
z: React.PropTypes.number
},
getDefaultProps: function() {
return {x: '', y: 0}
},
test: function() {
var a: number = this.props.x; // error
var b: str... | javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/new_react/UFILikeCount.react.js | tests/format/flow-repo/new_react/UFILikeCount.react.js | /**
* Copyright 2004-present Facebook. All Rights Reserved.
*
* @providesModule UFILikeCount.react
* @flow
*/
'use strict';
var React = require('react');
var UFILikeCount = React.createClass({
propTypes: {
permalink: React.PropTypes.string,
feedback: React.PropTypes.object.isRequired
},
render: f... | javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/new_react/props5.js | tests/format/flow-repo/new_react/props5.js | var React = require('React');
var C = React.createClass({
getDefaultProps: function() {
return { x: 0 };
}
});
module.exports = C;
| javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/new_react/Mixin.js | tests/format/flow-repo/new_react/Mixin.js | /* @providesModule Mixin */
module.exports = {
success: function() { }
};
| javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/new_react/new_react.js | tests/format/flow-repo/new_react/new_react.js | var React = require('react');
var Mixin = require('Mixin');
var C = React.createClass({
mixins: [Mixin],
propTypes: {
x: React.PropTypes.string.isRequired,
y: React.PropTypes.array,
z: React.PropTypes.number
},
replaceProps(props: { }) { },
getDefaultProps(): { z: number } {... | javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/new_react/props2.js | tests/format/flow-repo/new_react/props2.js | var React = require('react');
var C = React.createClass({
propTypes: {
foo: React.PropTypes.string.isRequired,
bar: React.PropTypes.string.isRequired,
}
});
var D = React.createClass({
getInitialState: function(): { bar: number } {
return { bar: 0 };
},
render: function() {
... | javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/new_react/FeedUFI.react.js | tests/format/flow-repo/new_react/FeedUFI.react.js | /**
* Copyright 2004-present Facebook. All Rights Reserved.
*
* @providesModule FeedUFI.react
* @flow
*/
'use strict';
var UFILikeCount = require('UFILikeCount.react');
var React = require('react');
var FeedUFI = React.createClass({
_renderLikeCount: function(
feedback: any
) {
var props = {
... | javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/new_react/props4.js | tests/format/flow-repo/new_react/props4.js | // @flow
import React from "React";
class JDiv extends React.Component {
// static defaultProps: { };
props: {
id: string
};
}
// Should be a type error ('id' takes a string, not a number..)
<JDiv id={42} />;
class Example extends React.Component {
props: { bar: string };
render() {
return <div>{... | javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/new_react/propTypes.js | tests/format/flow-repo/new_react/propTypes.js | var React = require('react');
var PropTypes = React.PropTypes;
var C = React.createClass({
propTypes: {
statistics: PropTypes.arrayOf(PropTypes.shape({
label: PropTypes.string.isRequired,
value: PropTypes.number,
})).isRequired,
}
});
<C statistics={[
{},
{label:"",value:undefined},
]}/>; ... | javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/new_react/bad_default_props.js | tests/format/flow-repo/new_react/bad_default_props.js | var React = require('React');
type T1 = { }
type T2 = { x: number }
type T3 = { x: number, y: number }
class C1 extends React.Component<T1, T2, any> { // error
}
class C2 extends React.Component<void, T2, any> { // OK
}
// no need to add type arguments to React.Component
class C3 extends React.Component { // OK
s... | javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.