Skip to content
This repository was archived by the owner on Dec 5, 2024. It is now read-only.

Commit 3634724

Browse files
committed
fix: upgrade Flow and library types
1 parent 0c9fc24 commit 3634724

18 files changed

+79
-53
lines changed

.flowconfig

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,18 @@
11
[ignore]
2-
/lib/.*
2+
<PROJECT_ROOT>/lib/.*
33
.*/.cache
44

55
[include]
66

77
[libs]
88

99
[lints]
10+
sketchy-number=error
11+
sketchy-null=error
1012

1113
[options]
12-
types_first=false
14+
react.runtime=automatic
15+
exact_by_default=true
1316

1417
[strict]
1518

.prettierrc.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
module.exports = {
2+
parser: 'flow',
23
singleQuote: true,
34
trailingComma: 'es5',
45
proseWrap: 'always',

demo/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// @flow
1+
// @flow strict
22
import React, { useState } from 'react';
33
import ReactDOM from 'react-dom';
44
import { Global, css } from '@emotion/core';

jest.setup.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
// @flow
1+
// @flow strict
22
import '@babel/polyfill';

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-popper",
3-
"version": "2.2.3",
3+
"version": "2.2.5",
44
"description": "Official library to use Popper on React projects",
55
"license": "MIT",
66
"author": "Travis Arnold <travis@souporserious.com> (http://souporserious.com)",
@@ -93,7 +93,7 @@
9393
"eslint-plugin-promise": "^4.2.1",
9494
"eslint-plugin-react": "^7.19.0",
9595
"eslint-plugin-react-hooks": "^3.0.0",
96-
"flow-bin": "^0.139.0",
96+
"flow-bin": "^0.147.0",
9797
"flow-copy-source": "^2.0.9",
9898
"gh-pages": "^2.2.0",
9999
"git-branch-is": "^3.1.0",

src/Manager.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
// @flow
1+
// @flow strict
22
import * as React from 'react';
33

4-
export const ManagerReferenceNodeContext = React.createContext<?Element>();
5-
export const ManagerReferenceNodeSetterContext = React.createContext<
4+
export const ManagerReferenceNodeContext: React.Context<?Element> = React.createContext();
5+
export const ManagerReferenceNodeSetterContext: React.Context<
66
void | ((?Element) => void)
7-
>();
7+
> = React.createContext();
88

9-
export type ManagerProps = {
9+
export type ManagerProps = $ReadOnly<{
1010
children: React.Node,
11-
};
11+
}>;
1212

13-
export function Manager({ children }: ManagerProps) {
13+
export function Manager({ children }: ManagerProps): React.Node {
1414
const [referenceNode, setReferenceNode] = React.useState<?Element>(null);
1515

1616
const hasUnmounted = React.useRef(false);

src/Manager.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// @flow
1+
// @flow strict
22
import React from 'react';
33
import { render, waitFor } from '@testing-library/react';
44
import * as Popperjs from '@popperjs/core';

src/Popper.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// @flow
1+
// @flow strict
22
import * as React from 'react';
33
import {
44
type State,
@@ -34,15 +34,15 @@ export type PopperChildrenProps = {|
3434
|};
3535
export type PopperChildren = (PopperChildrenProps) => React.Node;
3636

37-
export type PopperProps = {|
37+
export type PopperProps = $ReadOnly<{|
3838
children: PopperChildren,
3939
innerRef?: Ref,
4040
modifiers?: Modifiers,
4141
placement?: Placement,
4242
strategy?: PositioningStrategy,
4343
referenceElement?: ReferenceElement,
4444
onFirstUpdate?: ($Shape<State>) => void,
45-
|};
45+
|}>;
4646

4747
const NOOP = () => void 0;
4848
const NOOP_PROMISE = () => Promise.resolve(null);
@@ -56,7 +56,7 @@ export function Popper({
5656
onFirstUpdate,
5757
innerRef,
5858
children,
59-
}: PopperProps) {
59+
}: PopperProps): React.Node {
6060
const referenceNode = React.useContext(ManagerReferenceNodeContext);
6161

6262
const [popperElement, setPopperElement] = React.useState(null);

src/Popper.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// @flow
1+
// @flow strict
22
import React from 'react';
33
import { render, waitFor, act } from '@testing-library/react';
44
import * as PopperJs from '@popperjs/core';

src/RefTypes.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// @flow
1+
// @flow strict
22
type RefHandler = (?HTMLElement) => void;
33
type RefObject = { current?: ?HTMLElement};
44

0 commit comments

Comments
 (0)