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/classes/D.js | tests/format/flow-repo/classes/D.js | class D { }
class E { }
new E().x
| javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/classes/C.js | tests/format/flow-repo/classes/C.js | var B = require('./B');
class C extends B {
foo(x:string):void { }
}
let c = new C();
(c.foo: number); // error, number !~> function
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/classes/expr.js | tests/format/flow-repo/classes/expr.js | var Bar = class Foo {
static factory(): Foo { // OK: Foo is a type in this scope
return new Foo() // OK: Foo is a runtime binding in this scope
}
};
var bar1: Bar = new Bar() // OK
var bar2: Bar = Bar.factory() // OK
// NB: Don't write expected errors using Foo to avoid error collapse hiding an
// unexpe... | javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/classes/B.js | tests/format/flow-repo/classes/B.js | var A = require('./A');
class B extends A { }
let b = new B();
(b.foo: number); // error, number !~> function
module.exports = B;
| javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/classes/extends_any.js | tests/format/flow-repo/classes/extends_any.js | const Base: any = class {}
class Derived1 extends Base {}
class Derived2 extends Derived1 {
m() {}
}
| javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/classes/loc.js | tests/format/flow-repo/classes/loc.js | /* @flow */
type Foo = number
class Foo {} // error, shadows type Foo
| javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/classes/class_shapes.js | tests/format/flow-repo/classes/class_shapes.js | /* @flow */
type Foo = {
a: string; // exists in TestClass
b: string; // doesn't exist
c?: ?string; // exists in TestClass, optional
d?: number; // doesn't exist
}
class TestClass {
a: string;
c: ?string;
}
var x = new TestClass();
x.a; // ok
x.b; // error, TestClass has no b
x.c; // ok
x.d; //... | javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/classes/format.test.js | tests/format/flow-repo/classes/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/require/E.js | tests/format/flow-repo/require/E.js | /* @flow */
// Local `exports` var is just a ref to module.exports, so mutating the original
// value will affect the exports object but re-binding it makes it useless and
// does not affect the exports value.
module.exports = {
numberValue: 42
};
exports = {stringValue: ''};
| javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/require/not_builtin_require.js | tests/format/flow-repo/require/not_builtin_require.js | // @flow
function require(x: string) {}
require("not a module name");
| javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/require/ProvidesModuleD.js | tests/format/flow-repo/require/ProvidesModuleD.js | /**
* @providesModule D
* @flow
*/
| javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/require/not_builtin_require2.js | tests/format/flow-repo/require/not_builtin_require2.js | // @flow
type require = number;
var a: require = 42;
| javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/require/C.js | tests/format/flow-repo/require/C.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/require/require.js | tests/format/flow-repo/require/require.js | /* @flow */
function takesANumber(num: number): void {}
function takesAString(str: string): void {}
// @providesModule
var A = require("A");
takesANumber(A.numberValue);
takesAString(A.numberValue);
// File path
var B = require("./B");
takesANumber(B.numberValue);
takesAString(B.numberValue);
// C.js exists, but no... | javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/require/ProvidesModuleA.js | tests/format/flow-repo/require/ProvidesModuleA.js | /**
* @providesModule A
* @flow
*/
exports.numberValue = 42;
| javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/require/B.js | tests/format/flow-repo/require/B.js | /* @flow */
exports.numberValue = 42;
| javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/require/format.test.js | tests/format/flow-repo/require/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/path/while.js | tests/format/flow-repo/path/while.js | var x = 1;
while(typeof x == "number" || typeof x == "string") {
x = x + 1;
if (true) x = "";
}
var z:number = x;
| javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/path/format.test.js | tests/format/flow-repo/path/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/refi/undef_tests.js | tests/format/flow-repo/refi/undef_tests.js | var undef_tests =
[
// NOTE: not (yet?) supporting non-strict eq test for undefined
// expr !== undefined
function() {
var x : ?string = "xxx";
if (x !== undefined && x !== null) {
var y : string = x; // ok
}
},
function() {
var x : ?string = "xxx";
if (undefined !== x && x !== nu... | javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/refi/switch.js | tests/format/flow-repo/refi/switch.js | // @flow
function foo(a,b,c) {
switch (c) {
case a.x.y: // OK
case b.x.y: // OK
return;
default:
return;
}
}
// test refis out of switches that are exhaustive without default case
function exhaustion1(x): number {
var foo;
switch (x) {
case 0: // falls through
case 1:
foo = 3;
break;... | javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/refi/heap.js | tests/format/flow-repo/refi/heap.js | var tests =
[
function() {
var x : {p:?string} = {p:"xxx"};
var y : string = x.p; // not ok
},
function() {
var x : {p:?string} = {p:"xxx"};
if (x.p != null) {
var y : string = x.p; // ok
}
},
function() {
var x : {p:?string} = {p:"xxx"};
if (x.p == null) {} else {
... | javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/refi/typeof_tests.js | tests/format/flow-repo/refi/typeof_tests.js | var null_tests =
[
// typeof expr == typename
function() {
var x : ?string = "xxx";
if (typeof x == "string") {
var y : string = x; // ok
}
},
function() {
var x : ?string = "xxx";
if ("string" == typeof x) {
var y : string = x; // ok
}
},
function() {
var x : {p:... | javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/refi/lex.js | tests/format/flow-repo/refi/lex.js | function block_scope(x: string | number) {
{
let x;
x = ""; // doesn't refine outer x
}
(x : string); // error: number ~> string
}
function switch_scope(x: string | number) {
switch (x) {
default:
let x;
x = ""; // doesn't refine outer x
}
(x : string); // error: number ~> string
}
... | javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/refi/local.js | tests/format/flow-repo/refi/local.js | var paths =
[
function() {
var x : ?string = "xxx";
var y : string = x; // not ok
},
function() {
var x : ?string = "xxx";
if (x != null) {
var y : string = x; // ok
}
},
function() {
var x : ?string = "xxx";
if (x == null) {} else {
var y : string = x; // ok
}... | javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/refi/void_tests.js | tests/format/flow-repo/refi/void_tests.js | var void_tests =
[
// NOTE: not (yet?) supporting non-strict eq test for undefined
// expr !== void(...)
function() {
var x : ?string = "xxx";
if (x !== void(0) && x !== null) {
var y : string = x; // ok
}
},
function() {
var x : ?string = "xxx";
if (void(0) !== x && x !== null) {... | javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/refi/bound.js | tests/format/flow-repo/refi/bound.js | // refinements of bound vars (closed-over locals)
// should have the same lifetimes as heap objects.
var x : ?string = "xxx";
var tests =
[
function() {
var y : string = x; // not ok
},
function() {
if (x != null) {
var y : string = x; // ok
}
},
function() {
if (x == null) {} else... | javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/refi/format.test.js | tests/format/flow-repo/refi/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/refi/null_tests.js | tests/format/flow-repo/refi/null_tests.js | var null_tests =
[
// expr != null
function() {
var x : ?string = "xxx";
if (x != null) {
var y : string = x; // ok
}
},
function() {
var x : ?string = "xxx";
if (null != x) {
var y : string = x; // ok
}
},
function() {
var x : {p:?string} = {p:"xxx"};
if (x.p... | javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/iterable/variance.js | tests/format/flow-repo/iterable/variance.js | /* @flow */
(([]: Array<string>): Iterable<?string>); // ok, Iterable<+T>
(([]: Array<string>).values(): Iterable<?string>); // ok, Iterator<+T>
| javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/iterable/string.js | tests/format/flow-repo/iterable/string.js | /* @flow */
("hi": Iterable<string>);
("hi": Iterable<*>);
("hi": Iterable<number>); // Error - string is a Iterable<string>
| javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/iterable/map.js | tests/format/flow-repo/iterable/map.js | /* @flow */
function mapTest1(map: Map<string, number>): Iterable<[string, number]> {
return map;
}
function mapTest2<K, V>(map: Map<K, V>): Iterable<[K, V]> {
return map;
};
function mapTest3(map: Map<string, number>): Iterable<*> {
return map;
}
// Error - Map is an Iterable<[K, V]>
function mapTest4(map: Map<... | javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/iterable/iterator_result.js | tests/format/flow-repo/iterable/iterator_result.js | /* @flow */
function makeIterator(coin_flip: () => boolean ): Iterator<string> {
return {
"@@iterator"() { return makeIterator(coin_flip); },
next(): IteratorResult<string, void> {
var done = coin_flip();
if (!done) {
return { done, value: "still going..." };
} else {
return... | javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/iterable/array.js | tests/format/flow-repo/iterable/array.js | /* @flow */
(([1, 2]: Array<number>): Iterable<number>);
([1,2,"hi"]: Iterable<number | string>);
([1,2,3]: Iterable<*>);
(["hi"]: Iterable<number>); // Error string ~> number
(["hi", 1]: Iterable<string>); // Error number ~> string
| javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/iterable/set.js | tests/format/flow-repo/iterable/set.js | /* @flow */
function setTest1(set: Set<string>): Iterable<string> {
return set;
}
function setTest2<T>(set: Set<T>): Iterable<T> {
return set;
};
function setTest3(set: Set<string>): Iterable<*> {
return set;
}
// Error string ~> number
function setTest4(set: Set<string>): Iterable<number> {
return set;
}
| javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/iterable/iter.js | tests/format/flow-repo/iterable/iter.js | /* @flow */
function foo(strs: Iterable<string>): void {
for (var s: string of strs) {
console.log(s);
}
}
var m: Map<string, number> = new Map();
foo(m.keys());
| javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/iterable/caching_bug.js | tests/format/flow-repo/iterable/caching_bug.js | /* @flow */
/**
* I've hit a bug with the caching in flow_js.ml. Avik is removing that caching
* so it should be fixed soon. The basic idea is I flow something like
*
* Array<any | any> ~> Iterable<string>
*
* then Flow won't notice when I try to flow
*
* Array<string | number> ~> Iterable<string>
*
* We sho... | javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/iterable/format.test.js | tests/format/flow-repo/iterable/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_name_mapper_PROJECT_ROOT-1.0/main.js | tests/format/flow-repo/config_module_name_mapper_PROJECT_ROOT-1.0/main.js | // @flow
import {test} from 'testmodule';
var a: number = test;
var b: string = test; // Error: number ~> string
| 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_name_mapper_PROJECT_ROOT-1.0/format.test.js | tests/format/flow-repo/config_module_name_mapper_PROJECT_ROOT-1.0/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_name_mapper_PROJECT_ROOT-1.0/src/testmodule.js | tests/format/flow-repo/config_module_name_mapper_PROJECT_ROOT-1.0/src/testmodule.js | // @flow
export let test = 42;
| 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_name_mapper_PROJECT_ROOT-1.0/src/format.test.js | tests/format/flow-repo/config_module_name_mapper_PROJECT_ROOT-1.0/src/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/init/nullable-init.js | tests/format/flow-repo/init/nullable-init.js | var o: {x: ?number} = { x: null };
var a: Array<?number> = [null,null];
| javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/init/hoisted2.js | tests/format/flow-repo/init/hoisted2.js | /**
* test initialization tracking for vars
* note: for try/catch/finally, see tests/try/init.js
* @flow
*/
// deferred init on annotated vars is ok
function linear_deferred_init() {
var x:number;
x = 0;
var y:number = x;
}
// ...but use of var before init gives undefined
function linear_pre_init() {
var ... | javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/init/hoisted.js | tests/format/flow-repo/init/hoisted.js | /**
* test initialization tracking in the presence of hoisting
* @flow
*/
function _if(b: () => boolean) {
if (b()) {
var f = function () {};
}
f(); // error, possibly undefined
}
function _while(b: () => boolean) {
while (b()) {
var f = function () {};
}
f(); // error, possibly undefined
}
fu... | javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/init/let.js | tests/format/flow-repo/init/let.js | /**
* test initialization tracking for lets
* @flow
*/
// deferred init on annotated lets is ok
function linear_deferred_init() {
let x:number;
x = 0;
let y:number = x;
}
// use of let before init gives undefined
function linear_pre_init() {
let x:number;
let y:?number = x; // ok
let z:number = x; /... | javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/init/format.test.js | tests/format/flow-repo/init/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/export_default/test.js | tests/format/flow-repo/export_default/test.js | var M = require('M');
var N = require('N');
N.x = M(N.x);
var P = require('./P'); // implementation of P redirects to module M
N.y = P(N.y);
var Q = require('Q'); // declaration of Q redirects to module M
N.z = Q(N.z);
| javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/export_default/P.js | tests/format/flow-repo/export_default/P.js | module.exports = require('M');
| javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/export_default/format.test.js | tests/format/flow-repo/export_default/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/export_default/lib/lib.js | tests/format/flow-repo/export_default/lib/lib.js | declare module M {
declare function exports(x:string): string;
}
declare module N {
declare var x: number;
declare var y: number;
declare var z: number;
}
declare module Q {
declare var exports: $Exports<'M'>;
}
| javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/export_default/lib/format.test.js | tests/format/flow-repo/export_default/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/function/call.js | tests/format/flow-repo/function/call.js | // @flow
function test(a: string, b: number): number {
return this.length; // expect []/"" this
}
// args flow correctly into params
test.call("", "", 0);
// wrong this is an error
test.call(0, "", 0); // error: lookup `length` on Number
// not enough arguments is an error
test.call("", ""); // error: void ~> num... | javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/function/function.js | tests/format/flow-repo/function/function.js | /**
* @flow
*/
// Previously we represented Function as (...rest: any) => any
// This means the following wouldn't pass, because that arrow function
// can only be called with 3 arguments.
var a: Function = (a, b, c) => 123;
var b: Function = function(a: number, b: number): number { return a + b; };
class C {}
va... | javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/function/rest.js | tests/format/flow-repo/function/rest.js | /* regression tests */
function rest_array<T>(...xs: Array<T>): T { // Ok, arrays can be rest params
return xs[0];
}
function rest_tuple<T>(...xs: [T]): T { // Ok, tuples can be rest params
return xs[0];
}
function rest_ro_array<T>(...xs: $ReadOnlyArray<T>): T { // Ok
return xs[0];
}
function rest_any(...xs: ... | javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/function/apply.js | tests/format/flow-repo/function/apply.js | function test(a: string, b: number): number {
return this.length; // expect []/"" this
}
// tuples flow correctly into params
test.apply("", ["", 0]);
// wrong this is an error
test.apply(0, ["", 0]); // error: lookup `length` on Number
// not enough arguments is an error
test.apply("", [""]); // error: void ~> nu... | javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/function/rest_type.js | tests/format/flow-repo/function/rest_type.js | /* regression tests */
type rest_array = <T>(...xs: Array<T>) => T; // Ok, arrays can be rest params
type rest_tuple = <T>(...xs: [T]) => T; // Ok, tuples can be rest params
type rest_ro_array = <T>(...xs: $ReadOnlyArray<T>) => T; // Ok
type rest_any = (...xs: any) => any; // Ok, any can be a rest param
type rest... | javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/function/bind.js | tests/format/flow-repo/function/bind.js | // @flow
let tests = [
function(x: (a: string, b: string) => void) {
let y = x.bind(x, 'foo');
y('bar'); // ok
y(123); // error, number !~> string
},
// callable objects
function(x: { (a: string, b: string): void }) {
let y = x.bind(x, 'foo');
y('bar'); // ok
y(123); // error, number !... | javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/function/format.test.js | tests/format/flow-repo/function/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/symbol/symbol.js | tests/format/flow-repo/symbol/symbol.js | declare var s: symbol;
// Creation
{
const x: symbol = Symbol(); // OK
const y: symbol = Symbol('bar'); // OK
Symbol('foo', 'bar'); // Error: unused argument
}
// Properties and methods
{
const x: string = s.toString(); // OK
const y: ?symbol = s.valueOf(); // OK
const z: string | void = s.description; /... | javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/symbol/format.test.js | tests/format/flow-repo/symbol/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/locals/locals.js | tests/format/flow-repo/locals/locals.js | var x:string = 0;
var x:number = 1;
//declare var T: $Type<number | Array<T>>;
function foo(p: bool) {}
function sorry(really: bool) {
if (really) {
var x: number | string = 1337;
} else {
var x: bool = true;
}
foo(x);
}
function foo0(b: bool): number {
var x = 0;
if (b) {
va... | javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/locals/lex.js | tests/format/flow-repo/locals/lex.js | function switch_scope(x: mixed) {
let a = "";
let b = "";
switch (x) {
case "foo":
let a;
a = 0; // doesn't add lower bound to outer a
b = 0;
}
(a : string); // OK
(b : string); // error: number ~> string
}
function try_scope_finally() {
let a;
let b;
try {
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/locals/format.test.js | tests/format/flow-repo/locals/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/import_type/issue-359.js | tests/format/flow-repo/import_type/issue-359.js | /* @flow */
class ClassFoo6 {};
export default ClassFoo6;
| javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/import_type/import_type.js | tests/format/flow-repo/import_type/import_type.js | /**
* @flow
*/
/////////////////////////////////////////////////
// == Importing Class Type (Default Export) == //
/////////////////////////////////////////////////
import type ClassFoo1 from "./ExportDefault_Class";
import {foo1Inst} from "./ExportDefault_Class";
var a1: ClassFoo1 = foo1Inst;
var a2: number = foo... | javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/import_type/ExportCJSNamed_Class.js | tests/format/flow-repo/import_type/ExportCJSNamed_Class.js | /**
* @flow
*/
class ClassFoo4 {
returnsANumber(): number { return 42; }
}
class ClassFoo5 {}
function givesAFoo4(): ClassFoo4 {
return new ClassFoo4();
}
function givesAFoo5(): ClassFoo5 {
return new ClassFoo5();
}
exports.ClassFoo4 = ClassFoo4;
exports.ClassFoo5 = ClassFoo5
exports.foo4Inst = new ClassFo... | javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/import_type/ExportCJSDefault_Class.js | tests/format/flow-repo/import_type/ExportCJSDefault_Class.js | /**
* @flow
*/
class ClassFoo3 {
givesANum(): number { return 42; }
static givesAFoo3(): ClassFoo3 {
return new ClassFoo3();
}
}
module.exports = ClassFoo3;
| javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/import_type/ExportNamed_Alias.js | tests/format/flow-repo/import_type/ExportNamed_Alias.js | /**
* @flow
*/
export type AliasFoo3 = {
givesANum(): number
};
export function givesAFoo3Obj(): AliasFoo3 {
return {
givesANum(): 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/import_type/ExportsANumber.js | tests/format/flow-repo/import_type/ExportsANumber.js | /* @ flow */
export var numValue = 42;
| javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/import_type/ExportDefault_Class.js | tests/format/flow-repo/import_type/ExportDefault_Class.js | /**
* @flow
*/
class ClassFoo1 {
returnsANumber(): number { return 42; }
}
export default ClassFoo1;
export var foo1Inst = new ClassFoo1();
| javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/import_type/ExportNamed_Class.js | tests/format/flow-repo/import_type/ExportNamed_Class.js | /**
* @flow
*/
class ClassFoo2 {
returnsANumber(): number { return 42; }
}
export {ClassFoo2};
export var foo2Inst = new ClassFoo2();
| javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/import_type/format.test.js | tests/format/flow-repo/import_type/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/any/any.js | tests/format/flow-repo/any/any.js | // @flow
function foo(x:any):any { return x; }
function bar(x:any):mixed { return x; }
function qux(x:mixed):any { return x; }
var x:string = foo(0);
var y:string = bar(0);
var z:string = qux(0);
| javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/any/anyexportflowfile.js | tests/format/flow-repo/any/anyexportflowfile.js | // @flow
module.exports = ((x: any) => x: any);
| javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/any/propagate.js | tests/format/flow-repo/any/propagate.js | // @flow
declare class C {
bar(n1: number, n2: number): number;
bar(s1: string, s2: string): string;
}
function foo(c: C, x: any): string {
let y = x.y;
return c.bar(0, y); // should be able to select first case and error
}
var any_fun1 = require('./nonflowfile');
function bar1(x: mixed) {
if (any_fun1(x))... | javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/any/reach.js | tests/format/flow-repo/any/reach.js | /**
* like class and function values, any-typed values may be used in
* type annotations. Here we test propagation of any through the
* annotation - without it, the body of the if will be unreachable
*/
type AsyncRequest = any;
function foo(o: ?AsyncRequest) {
if (o) {
var n: number = o;
}
}
| javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/any/flowissue.js | tests/format/flow-repo/any/flowissue.js | /*
$FlowIssue is a synonym for any, used by JS devs to signal
a potential typechecker bug to the Flow team.
@flow
*/
// no param
function foo(x:$FlowIssue):$FlowIssue { return x; }
function bar(x:$FlowIssue):mixed { return x; }
// param (info only)
function qux(x:$FlowIssue<number>):$FlowIssue<number> { return... | javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/any/nonflowfile.js | tests/format/flow-repo/any/nonflowfile.js | // @noflow
module.exports = (x) => x;
| javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/any/format.test.js | tests/format/flow-repo/any/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/any/flowfixme.js | tests/format/flow-repo/any/flowfixme.js | /*
FlowFixMe is a synonym for any, used by the Flow team to
signal a needed mod to JS devs.
@flow
*/
// no param
function foo(x:$FlowFixMe):$FlowFixMe { return x; }
function bar(x:$FlowFixMe):mixed { return x; }
// param (info only)
function qux(x:$FlowFixMe<number>):$FlowFixMe<number> { return x; }
// ...para... | javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/replace/test.js | tests/format/flow-repo/replace/test.js | var a = 0;
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/replace/format.test.js | tests/format/flow-repo/replace/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/keys/keys.js | tests/format/flow-repo/keys/keys.js | /* @flow */
function testKeysOfObject(str: string, lit: 'hi') {
(str: $Keys<Object>); // Any string should be fine
if (str) {
(str: $Keys<Object>); // No error, truthy string should be fine
}
('hi': $Keys<Object>); // String literal should be fine
(123: $Keys<Object>); // Error: number -> keys of Object... | javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/keys/format.test.js | tests/format/flow-repo/keys/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/missing_annotation/async_return.js | tests/format/flow-repo/missing_annotation/async_return.js | // @flow
export async function foo() {
return 123;
}
| javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/missing_annotation/array.js | tests/format/flow-repo/missing_annotation/array.js | // @flow
type Foo = {};
var f: Foo = {};
export var arr = [f];
| javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/missing_annotation/infer.js | tests/format/flow-repo/missing_annotation/infer.js | /* @flow */
var Foo = {
a: function(arg) { // missing arg annotation
return arg;
},
b: function(arg) { // missing arg annotation
return {
bar: arg
};
},
c: function(arg: string) { // no return annotation required
return {
bar: arg
};
},
d: function(arg: string): {
... | javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/missing_annotation/format.test.js | tests/format/flow-repo/missing_annotation/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/funrec/funrec.js | tests/format/flow-repo/funrec/funrec.js | function bar(x) { return x; }
function foo() {
return function bound() {
return bar(bound);
};
}
| javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/funrec/format.test.js | tests/format/flow-repo/funrec/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/ignore_package/foo.js | tests/format/flow-repo/ignore_package/foo.js | /** @flow */
/* this require routes to nothing, because
our node_modules/underscore directory
has been excluded. If package.json files
are being excluded properly, we'll get
'Required module not found'.
*/
var _ = require('underscore');
function foo(): string {
return _.foo();
}
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/ignore_package/format.test.js | tests/format/flow-repo/ignore_package/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/esproposal_class_static_fields.warn/test.js | tests/format/flow-repo/esproposal_class_static_fields.warn/test.js | /* @flow */
class Foo {
static annotationOnly: string;
static initOnly = 'asdf';
static initWithAnnotation: string = 'asdf';
}
| javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/esproposal_class_static_fields.warn/format.test.js | tests/format/flow-repo/esproposal_class_static_fields.warn/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/binding/rebinding.js | tests/format/flow-repo/binding/rebinding.js | /* @flow
* test errors on illegal rebinding/reassignment
*
* type class let const var (reassign)
* type x x x x x x
* class x x x x x
* let x x x x x
* const x x x x x x
* var x x x x
*/
// type x *
function type_type() {
type... | javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/binding/tdz.js | tests/format/flow-repo/binding/tdz.js | /** @flow */
// -- types ---
// type aliases are hoisted and always available
type T1 = T2; // ok
type T2 = number;
// --- lets ---
// to be correct, we would
// - not allow forward refs to lets from value positions,
// while let is in TDZ.
// - allow forward refs to lets from type positions.
//
// currently we'... | javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/binding/scope.js | tests/format/flow-repo/binding/scope.js | function block_scope() {
let a: number = 0;
var b: number = 0;
{
let a = ""; // ok: local to block
var b = ""; // error: string ~> number
}
}
function switch_scope(x: string) {
let a: number = 0;
var b: number = 0;
switch (x) {
case "foo":
let a = ""; // ok: local to switch
var b ... | javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/binding/const.js | tests/format/flow-repo/binding/const.js | const x = 0;
// errors: const cannot be reassigned
x++;
x--;
x += 0;
x -= 0;
x /= 0;
x %= 0;
x <<= 0
x >>= 0;
x >>>= 0;
x |= 0;
x ^= 0;
x &= 0;
// regression tests -- OK to assign consts like this:
const { foo } = { foo: "foo" }
const [ bar ] = ["bar"];
(foo: number); // error: string ~> number
(bar: number); // err... | javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/binding/format.test.js | tests/format/flow-repo/binding/format.test.js | runFormatTest(import.meta, ["flow"], {
errors: { hermes: ["const.js", "rebinding.js", "scope.js"] },
});
| 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.