@react-native/eslint-plugin-specs 0.72.1 → 0.72.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/react-native-modules.js +8 -5
package/package.json
CHANGED
package/react-native-modules.js
CHANGED
|
@@ -23,9 +23,10 @@ const ERRORS = {
|
|
|
23
23
|
|
|
24
24
|
let RNModuleParser;
|
|
25
25
|
let RNParserUtils;
|
|
26
|
+
let RNFlowParser;
|
|
26
27
|
|
|
27
28
|
function requireModuleParser() {
|
|
28
|
-
if (RNModuleParser == null || RNParserUtils == null) {
|
|
29
|
+
if (RNModuleParser == null || RNParserUtils == null || RNFlowParser == null) {
|
|
29
30
|
// If using this externally, we leverage @react-native/codegen as published form
|
|
30
31
|
if (!PACKAGE_USAGE) {
|
|
31
32
|
const config = {
|
|
@@ -36,6 +37,7 @@ function requireModuleParser() {
|
|
|
36
37
|
withBabelRegister(config, () => {
|
|
37
38
|
RNModuleParser = require('@react-native/codegen/src/parsers/flow/modules');
|
|
38
39
|
RNParserUtils = require('@react-native/codegen/src/parsers/utils');
|
|
40
|
+
RNFlowParser = require('@react-native/codegen/src/parsers/flow/parser');
|
|
39
41
|
});
|
|
40
42
|
} else {
|
|
41
43
|
const config = {
|
|
@@ -46,6 +48,7 @@ function requireModuleParser() {
|
|
|
46
48
|
withBabelRegister(config, () => {
|
|
47
49
|
RNModuleParser = require('@react-native/codegen/lib/parsers/flow/modules');
|
|
48
50
|
RNParserUtils = require('@react-native/codegen/lib/parsers/flow/utils');
|
|
51
|
+
RNFlowParser = require('@react-native/codegen/lib/parsers/flow/parser');
|
|
49
52
|
});
|
|
50
53
|
}
|
|
51
54
|
}
|
|
@@ -53,6 +56,7 @@ function requireModuleParser() {
|
|
|
53
56
|
return {
|
|
54
57
|
buildModuleSchema: RNModuleParser.buildModuleSchema,
|
|
55
58
|
createParserErrorCapturer: RNParserUtils.createParserErrorCapturer,
|
|
59
|
+
parser: new RNFlowParser.FlowParser(),
|
|
56
60
|
};
|
|
57
61
|
}
|
|
58
62
|
|
|
@@ -127,17 +131,16 @@ function rule(context) {
|
|
|
127
131
|
});
|
|
128
132
|
}
|
|
129
133
|
|
|
130
|
-
const {buildModuleSchema, createParserErrorCapturer} =
|
|
134
|
+
const {buildModuleSchema, createParserErrorCapturer, parser} =
|
|
131
135
|
requireModuleParser();
|
|
132
|
-
const flowParser = require('flow-parser');
|
|
133
136
|
|
|
134
137
|
const [parsingErrors, tryParse] = createParserErrorCapturer();
|
|
135
138
|
|
|
136
139
|
const sourceCode = context.getSourceCode().getText();
|
|
137
|
-
const ast =
|
|
140
|
+
const ast = parser.getAst(sourceCode);
|
|
138
141
|
|
|
139
142
|
tryParse(() => {
|
|
140
|
-
buildModuleSchema(hasteModuleName, ast, tryParse);
|
|
143
|
+
buildModuleSchema(hasteModuleName, ast, tryParse, parser);
|
|
141
144
|
});
|
|
142
145
|
|
|
143
146
|
parsingErrors.forEach(error => {
|