Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
81 changes: 51 additions & 30 deletions .flowconfig
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,36 @@
; We fork some components by platform
.*/*[.]android.js

; Ignore "BUCK" generated dirs
<PROJECT_ROOT>/\.buckd/

; Ignore unexpected extra "@providesModule"
.*/node_modules/.*/node_modules/fbjs/.*

; Ignore duplicate module providers
; For RN Apps installed via npm, "Libraries" folder is inside
; "node_modules/react-native" but in the source repo it is in the root
.*/Libraries/react-native/React.js
node_modules/react-native/Libraries/react-native/React.js

; Ignore polyfills
node_modules/react-native/Libraries/polyfills/.*

; These should not be required directly
; require from fbjs/lib instead: require('fbjs/lib/warning')
node_modules/warning/.*

; Flow doesn't support platforms
.*/Libraries/Utilities/HMRLoadingView.js

[untyped]
.*/node_modules/@react-native-community/cli/.*/.*
.*/node_modules/react-native/Libraries/Lists/SectionList.js

[include]

[libs]
node_modules/react-native/Libraries/react-native/react-native-interface.js
node_modules/react-native/flow/
node_modules/react-native/flow-github/
flow-typed

[options]
Expand All @@ -21,6 +40,10 @@ emoji=true
esproposal.optional_chaining=enable
esproposal.nullish_coalescing=enable

module.file_ext=.js
module.file_ext=.json
module.file_ext=.ios.js

module.system=haste
module.system.haste.use_name_reducers=true
# get basename
Expand All @@ -33,45 +56,43 @@ module.system.haste.name_reducers='^\(.*\)\.android$' -> '\1'
module.system.haste.name_reducers='^\(.*\)\.native$' -> '\1'
module.system.haste.paths.blacklist=.*/__tests__/.*
module.system.haste.paths.blacklist=.*/__mocks__/.*
module.system.haste.paths.blacklist=<PROJECT_ROOT>/node_modules/react-native/Libraries/Animated/src/polyfills/.*
module.system.haste.paths.whitelist=<PROJECT_ROOT>/node_modules/react-native/Libraries/.*
module.system.haste.paths.whitelist=<PROJECT_ROOT>/node_modules/react-native/RNTester/.*
module.system.haste.paths.whitelist=<PROJECT_ROOT>/node_modules/react-native/IntegrationTests/.*
module.system.haste.paths.blacklist=<PROJECT_ROOT>/node_modules/react-native/Libraries/react-native/react-native-implementation.js
module.system.haste.paths.blacklist=<PROJECT_ROOT>/node_modules/react-native/Libraries/Animated/src/polyfills/.*

munge_underscores=true

module.name_mapper='^[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\|pdf\)$' -> 'RelativeImageStub'

module.file_ext=.js
module.file_ext=.jsx
module.file_ext=.json
module.file_ext=.native.js

suppress_type=$FlowIssue
suppress_type=$FlowFixMe
suppress_type=$FlowFixMeProps
suppress_type=$FlowFixMeState

suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(<VERSION>\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)
suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(<VERSION>\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+
suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy
suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(<VERSION>\\)? *\\(site=[a-z,_]*react_native\\(_ios\\)?_\\(oss\\|fb\\)[a-z,_]*\\)?)\\)
suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(<VERSION>\\)? *\\(site=[a-z,_]*react_native\\(_ios\\)?_\\(oss\\|fb\\)[a-z,_]*\\)?)\\)?:? #[0-9]+
suppress_comment=\\(.\\|\n\\)*\\$FlowExpectedError

include_warnings=true
[lints]
sketchy-null-number=warn
sketchy-null-mixed=warn
sketchy-number=warn
untyped-type-import=warn
nonstrict-import=warn
deprecated-type=warn
unsafe-getters-setters=warn
inexact-spread=warn
unnecessary-invariant=warn
signature-verification-failure=warn
deprecated-utility=error

[untyped]
; bugs in react-native typings
.*/Libraries/Components/Navigation/NavigatorIOS.ios.js
.*/Libraries/Components/View/ViewPropTypes.js
.*/Libraries/Components/ActivityIndicator/ActivityIndicator.js
.*/Libraries/Components/Slider/Slider.js
.*/Libraries/Components/Touchable/TouchableHighlight.js
.*/Libraries/Components/Touchable/TouchableOpacity.js
.*/Libraries/Components/SegmentedControlIOS/SegmentedControlIOS.ios.js
.*/Libraries/Components/ProgressViewIOS/ProgressViewIOS.ios.js
.*/Libraries/Image/Image.ios.js
.*/Libraries/Text/Text.js
.*/Libraries/LayoutAnimation/LayoutAnimation.js
.*/Libraries/Lists/VirtualizedSectionList.js
.*/Libraries/StyleSheet/processTransform.js
.*/Libraries/StyleSheet/StyleSheetValidation.js
.*/Libraries/Text/TextAncestor.js
.*/Libraries/YellowBox/UI/YellowBoxList.js
[strict]
deprecated-type
nonstrict-import
sketchy-null
unclear-type
unsafe-getters-setters
untyped-import
untyped-type-import
14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,16 @@
"conventional-changelog-cli": "^2.0.11",
"dedent": "^0.7.0",
"eslint": "^5.15.2",
"flow-bin": "^0.102.0",
"flow-bin": "^0.98.0",
"flow-copy-source": "^2.0.6",
"jest": "^24.7.1",
"metro-react-native-babel-preset": "^0.52.0",
"react": "^16.8.3",
"react-native": "^0.59.8",
"react-test-renderer": "^16.8.3",
"release-it": "^12.1.0",
"strip-ansi": "^5.0.0",
"typescript": "^3.1.1"
"react": "16.8.6",
"react-native": "0.60.3",
"react-test-renderer": "16.8.6",
"release-it": "^12.3.3",
"strip-ansi": "^5.2.0",
"typescript": "^3.5.3"
},
"dependencies": {
"pretty-format": "^24.0.0"
Expand Down
4 changes: 4 additions & 0 deletions src/__tests__/__snapshots__/debug.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ exports[`debug 1`] = `
exports[`debug.deep 1`] = `
"<View
accessible={true}
clickable={true}
isTVSelectable={true}
onClick={[Function bound touchableHandlePress]}
onResponderGrant={[Function bound touchableHandleResponderGrant]}
onResponderMove={[Function bound touchableHandleResponderMove]}
onResponderRelease={[Function bound touchableHandleResponderRelease]}
Expand All @@ -36,7 +38,9 @@ exports[`debug.deep 1`] = `
exports[`debug.deep async test 1`] = `
"<View
accessible={true}
clickable={true}
isTVSelectable={true}
onClick={[Function bound touchableHandlePress]}
onResponderGrant={[Function bound touchableHandleResponderGrant]}
onResponderMove={[Function bound touchableHandleResponderMove]}
onResponderRelease={[Function bound touchableHandleResponderRelease]}
Expand Down
8 changes: 8 additions & 0 deletions src/__tests__/__snapshots__/render.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ exports[`debug 1`] = `
/>
<View
accessible={true}
clickable={true}
isTVSelectable={true}
onClick={[Function bound touchableHandlePress]}
onResponderGrant={[Function bound touchableHandleResponderGrant]}
onResponderMove={[Function bound touchableHandleResponderMove]}
onResponderRelease={[Function bound touchableHandleResponderRelease]}
Expand Down Expand Up @@ -86,7 +88,9 @@ exports[`debug changing component: bananaFresh button message should now be "fre
/>
<View
accessible={true}
clickable={true}
isTVSelectable={true}
onClick={[Function bound touchableHandlePress]}
onResponderGrant={[Function bound touchableHandleResponderGrant]}
onResponderMove={[Function bound touchableHandleResponderMove]}
onResponderRelease={[Function bound touchableHandleResponderRelease]}
Expand Down Expand Up @@ -238,7 +242,9 @@ exports[`debug: with message 1`] = `
/>
<View
accessible={true}
clickable={true}
isTVSelectable={true}
onClick={[Function bound touchableHandlePress]}
onResponderGrant={[Function bound touchableHandleResponderGrant]}
onResponderMove={[Function bound touchableHandleResponderMove]}
onResponderRelease={[Function bound touchableHandleResponderRelease]}
Expand Down Expand Up @@ -271,7 +277,9 @@ exports[`debug: with message 1`] = `
exports[`toJSON 1`] = `
<View
accessible={true}
clickable={false}
isTVSelectable={true}
onClick={[Function]}
onResponderGrant={[Function]}
onResponderMove={[Function]}
onResponderRelease={[Function]}
Expand Down
8 changes: 2 additions & 6 deletions src/__tests__/__snapshots__/shallow.test.js.snap
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`shallow rendering React Test Instance 1`] = `
<TouchableText
accessible={true}
allowFontScaling={true}
ellipsizeMode="tail"
forwardedRef={null}
<Text
testID="text-button"
>
Press me
</TouchableText>
</Text>
`;

exports[`shallow rendering React elements 1`] = `
Expand Down
10 changes: 5 additions & 5 deletions src/__tests__/debug.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@ test('debug', () => {
const component = <Button onPress={jest.fn} text="Press me" />;
debug(component);

const output = (console.log: ConsoleLogMock).mock.calls[0][0];
const output = ((console.log: any): ConsoleLogMock).mock.calls[0][0];

expect(stripAnsi(output)).not.toEqual(output);
expect(stripAnsi(output)).toMatchSnapshot();

(console.log: ConsoleLogMock).mockReset();
((console.log: any): ConsoleLogMock).mockReset();

debug(component, 'test message');

Expand All @@ -58,12 +58,12 @@ test('debug.deep', () => {
const component = <Button onPress={jest.fn} text="Press me" />;
debug.deep(component);

const output = (console.log: ConsoleLogMock).mock.calls[0][0];
const output = ((console.log: any): ConsoleLogMock).mock.calls[0][0];

expect(stripAnsi(output)).not.toEqual(output);
expect(stripAnsi(output)).toMatchSnapshot();

(console.log: ConsoleLogMock).mockReset();
((console.log: any): ConsoleLogMock).mockReset();

debug.deep(component, 'test message');

Expand All @@ -82,7 +82,7 @@ test('debug.deep async test', async () => {

debug.deep(toJSON());

const output = (console.log: ConsoleLogMock).mock.calls[0][0];
const output = ((console.log: any): ConsoleLogMock).mock.calls[0][0];

expect(stripAnsi(output)).toMatchSnapshot();
});
4 changes: 2 additions & 2 deletions src/__tests__/render.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ test('debug', () => {
debug.shallow('my other custom message');

// eslint-disable-next-line no-console
const mockCalls = (console.log: ConsoleLogMock).mock.calls;
const mockCalls = ((console.log: any): ConsoleLogMock).mock.calls;

expect(stripAnsi(mockCalls[0][0])).toMatchSnapshot();
expect(stripAnsi(mockCalls[1][0] + mockCalls[1][1])).toMatchSnapshot(
Expand All @@ -348,7 +348,7 @@ test('debug changing component', () => {
debug();

// eslint-disable-next-line no-console
const mockCalls = (console.log: ConsoleLogMock).mock.calls;
const mockCalls = ((console.log: any): ConsoleLogMock).mock.calls;

expect(stripAnsi(mockCalls[4][0])).toMatchSnapshot(
'bananaFresh button message should now be "fresh"'
Expand Down
4 changes: 1 addition & 3 deletions src/helpers/errors.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@ export class ErrorWithStack extends Error {

export const createLibraryNotSupportedError = (error: Error) =>
new Error(
`Currently the only supported library to search by text is "react-native".\n\n${
error.message
}`
`Currently the only supported library to search by text is "react-native".\n\n${error.message}`
);

const warned = {
Expand Down
Loading