Skip to content

Commit f796b60

Browse files
Andre Kuhlenschmidtfacebook-github-bot
authored andcommitted
[autofix][insert-type] add passing annotate exports tests
Summary: This commit adds all the tests from annotate exports that can be performed with insert-type. Reviewed By: panagosg7 Differential Revision: D16035039 fbshipit-source-id: 016b5723c0f275148085d2c9ebc0e042767297e2
1 parent de679c5 commit f796b60

File tree

98 files changed

+1114
-62
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

98 files changed

+1114
-62
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
[ignore]
2+
3+
[include]
4+
5+
[libs]
6+
7+
[lints]
8+
9+
[options]
10+
experimental.types_first=true
11+
experimental.well_formed_exports=true
12+
13+
[strict]
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
shell: test.sh
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
// @flow
2+
3+
declare var cond: boolean;
4+
5+
module.exports = () => (cond ? true : false);
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
> cat a.js
2+
// @flow
3+
4+
declare var cond: boolean;
5+
6+
module.exports = (): boolean => (cond ? true : false);
7+
> flow status
8+
No errors!
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/bin/bash
2+
3+
assert_ok "$FLOW" autofix insert-type --in-place a.js 5 20
4+
assert_ok "$FLOW" force-recheck a.js
5+
6+
echo "> cat a.js"
7+
cat a.js
8+
9+
echo "> flow status"
10+
assert_ok "$FLOW" status

tests/autofix-class/.flowconfig

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
[ignore]
2+
3+
[include]
4+
5+
[libs]
6+
7+
[lints]
8+
9+
[options]
10+
experimental.types_first=true
11+
experimental.well_formed_exports=true
12+
13+
[strict]

tests/autofix-class/.testconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
shell: test.sh

tests/autofix-class/a.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// @flow
2+
3+
class C {}
4+
// XYZXYZ
5+
export default class {
6+
array = [];
7+
num = 1;
8+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
> cat a.js
2+
// @flow
3+
4+
class C {}
5+
// XYZXYZ
6+
export default class {
7+
array: Array<empty> = [];
8+
num: number = 1;
9+
}
10+
> cat b.js
11+
// @flow
12+
13+
class C {
14+
m(): number {
15+
return 1;
16+
}
17+
}
18+
module.exports = C;
19+
> cat c.js
20+
// @flow
21+
22+
class A {
23+
f: ((x: string) => string) = (x: string) => x;
24+
}
25+
26+
module.exports = {
27+
a: A,
28+
b: (x: string): string => x,
29+
};
30+
> flow status
31+
No errors!

tests/autofix-class/b.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// @flow
2+
3+
class C {
4+
m() {
5+
return 1;
6+
}
7+
}
8+
module.exports = C;

0 commit comments

Comments
 (0)