Skip to content

Commit 7227bde

Browse files
gabrieldonadelfacebook-github-bot
authored andcommitted
chore: Extract codegen ParserError from flow and typescript into a common file (#34874)
Summary: This PR extracts the `ParserError` class from the `error.js` files from the flow and typescript folders into a single file in their parent folder in order to reduce the amount of duplicated code as requested on #34872 ## Changelog [Internal] [Changed] - Extract codegen `ParserError` from flow and typescript folders into a common file Pull Request resolved: #34874 Test Plan: Run `yarn jest react-native-codegen` and ensure CI is green ![image](https://user-images.githubusercontent.com/11707729/194135137-bf0fc82d-220b-4509-b1bb-1e7dae925efe.png) Reviewed By: cipolleschi Differential Revision: D40133301 Pulled By: cipolleschi fbshipit-source-id: 060571cf993672a9d03003e1a1a7c2aa2f381123
1 parent 24efebf commit 7227bde

File tree

6 files changed

+4
-40
lines changed

6 files changed

+4
-40
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
'use strict';
1212

1313
const invariant = require('invariant');
14-
const {ParserError} = require('../errors');
14+
const {ParserError} = require('../../errors');
1515

1616
class MisnamedModuleFlowInterfaceParserError extends ParserError {
1717
constructor(hasteModuleName: string, id: $FlowFixMe) {

packages/react-native-codegen/src/parsers/flow/utils.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
'use strict';
1212

13-
const {ParserError} = require('./errors');
13+
const {ParserError} = require('../errors');
1414

1515
/**
1616
* This FlowFixMe is supposed to refer to an InterfaceDeclaration or TypeAlias

packages/react-native-codegen/src/parsers/typescript/errors.js

Lines changed: 0 additions & 36 deletions
This file was deleted.

packages/react-native-codegen/src/parsers/typescript/modules/errors.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
'use strict';
1212

1313
const invariant = require('invariant');
14-
const {ParserError} = require('../errors');
14+
const {ParserError} = require('../../errors');
1515

1616
class MisnamedModuleTypeScriptInterfaceParserError extends ParserError {
1717
constructor(hasteModuleName: string, id: $FlowFixMe) {

packages/react-native-codegen/src/parsers/typescript/utils.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
'use strict';
1212

13-
const {ParserError} = require('./errors');
13+
const {ParserError} = require('../errors');
1414
const {parseTopLevelType} = require('./parseTopLevelType');
1515

1616
/**

0 commit comments

Comments
 (0)