Skip to content

Commit 3a01dc4

Browse files
charlesbdudleyfacebook-github-bot
authored andcommitted
Flow parser cleanup
Summary: This diff stack enables codegen to parse TypeScript spec files and generate an identical schema to our current Flow parser. This first diff is a small cleanup of our current flow parser. Changelog: [General][Fixed] - Fix typo in error string and improve consistency in Codegen's flow parser tests Reviewed By: sota000 Differential Revision: D33080423 fbshipit-source-id: 7bf817761a7704d807a0b809c9f2270354b5c6fa
1 parent b5ba4ac commit 3a01dc4

File tree

7 files changed

+10
-5
lines changed

7 files changed

+10
-5
lines changed

packages/react-native-codegen/src/parsers/flow/components/__test_fixtures__/failures.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
*
77
* @flow strict-local
88
* @format
9+
* @lint-ignore-every LICENSELINT
910
*/
1011

1112
'use strict';

packages/react-native-codegen/src/parsers/flow/components/__test_fixtures__/fixtures.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
*
77
* @flow strict-local
88
* @format
9+
* @lint-ignore-every LICENSELINT
910
*/
1011

1112
'use strict';

packages/react-native-codegen/src/parsers/flow/components/__tests__/__snapshots__/component-parser-test.js.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ exports[`RN Codegen Flow Parser Fails with error message NON_OPTIONAL_KEY_WITH_D
1616

1717
exports[`RN Codegen Flow Parser Fails with error message NULLABLE_WITH_DEFAULT 1`] = `"WithDefault<> is optional and does not need to be marked as optional. Please remove the ? annotation in front of it."`;
1818

19-
exports[`RN Codegen Flow Parser Fails with error message PROP_ARRAY_ENUM_BOOLEAN 1`] = `"Unsupported union type for \\"someProp\\", recieved \\"BooleanLiteralTypeAnnotation\\""`;
19+
exports[`RN Codegen Flow Parser Fails with error message PROP_ARRAY_ENUM_BOOLEAN 1`] = `"Unsupported union type for \\"someProp\\", received \\"BooleanLiteralTypeAnnotation\\""`;
2020

2121
exports[`RN Codegen Flow Parser Fails with error message PROP_ARRAY_ENUM_INT 1`] = `"Arrays of int enums are not supported (see: \\"someProp\\")"`;
2222

packages/react-native-codegen/src/parsers/flow/components/props.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ function getTypeAnnotationForArray(
166166
);
167167
} else {
168168
throw new Error(
169-
`Unsupported union type for "${name}", recieved "${unionType}"`,
169+
`Unsupported union type for "${name}", received "${unionType}"`,
170170
);
171171
}
172172
default:

packages/react-native-codegen/src/parsers/flow/modules/__test_fixtures__/failures.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
*
77
* @flow strict-local
88
* @format
9+
* @lint-ignore-every LICENSELINT
910
*/
1011

1112
'use strict';

packages/react-native-codegen/src/parsers/flow/modules/__test_fixtures__/fixtures.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
*
77
* @flow strict-local
88
* @format
9+
* @lint-ignore-every LICENSELINT
910
*/
1011

1112
'use strict';
@@ -101,7 +102,7 @@ export interface Spec extends TurboModule {
101102
|};
102103
}
103104
104-
export default TurboModuleRegistry.getEnforcing<Spec>('PlatformConstants');
105+
export default TurboModuleRegistry.getEnforcing<Spec>('SampleTurboModule');
105106
106107
`;
107108

@@ -467,7 +468,8 @@ export default TurboModuleRegistry.getEnforcing<Spec>('SampleTurboModule');
467468
468469
`;
469470

470-
const NATIVE_MODULE_WITH_PROMISE = `/**
471+
const NATIVE_MODULE_WITH_PROMISE = `
472+
/**
471473
* Copyright (c) Facebook, Inc. and its affiliates.
472474
*
473475
* This source code is licensed under the MIT license found in the

packages/react-native-codegen/src/parsers/flow/modules/__tests__/__snapshots__/module-parser-snapshot-test.js.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -884,7 +884,7 @@ exports[`RN Codegen Flow Parser can generate fixture NATIVE_MODULE_WITH_COMPLEX_
884884
]
885885
},
886886
'moduleNames': [
887-
'PlatformConstants'
887+
'SampleTurboModule'
888888
]
889889
}
890890
}

0 commit comments

Comments
 (0)