@react-native/eslint-plugin-specs 0.72.1 → 0.72.3
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
CHANGED
package/react-native-modules.js
CHANGED
|
@@ -23,9 +23,18 @@ const ERRORS = {
|
|
|
23
23
|
|
|
24
24
|
let RNModuleParser;
|
|
25
25
|
let RNParserUtils;
|
|
26
|
+
let RNFlowParser;
|
|
27
|
+
let RNParserCommons;
|
|
28
|
+
let RNFlowParserUtils;
|
|
26
29
|
|
|
27
30
|
function requireModuleParser() {
|
|
28
|
-
if (
|
|
31
|
+
if (
|
|
32
|
+
RNModuleParser == null ||
|
|
33
|
+
RNParserUtils == null ||
|
|
34
|
+
RNFlowParser == null ||
|
|
35
|
+
RNParserCommons == null ||
|
|
36
|
+
RNFlowParserUtils == null
|
|
37
|
+
) {
|
|
29
38
|
// If using this externally, we leverage @react-native/codegen as published form
|
|
30
39
|
if (!PACKAGE_USAGE) {
|
|
31
40
|
const config = {
|
|
@@ -36,6 +45,9 @@ function requireModuleParser() {
|
|
|
36
45
|
withBabelRegister(config, () => {
|
|
37
46
|
RNModuleParser = require('@react-native/codegen/src/parsers/flow/modules');
|
|
38
47
|
RNParserUtils = require('@react-native/codegen/src/parsers/utils');
|
|
48
|
+
RNFlowParser = require('@react-native/codegen/src/parsers/flow/parser');
|
|
49
|
+
RNParserCommons = require('@react-native/codegen/src/parsers/parsers-commons');
|
|
50
|
+
RNFlowParserUtils = require('@react-native/codegen/src/parsers/flow/utils');
|
|
39
51
|
});
|
|
40
52
|
} else {
|
|
41
53
|
const config = {
|
|
@@ -45,14 +57,20 @@ function requireModuleParser() {
|
|
|
45
57
|
|
|
46
58
|
withBabelRegister(config, () => {
|
|
47
59
|
RNModuleParser = require('@react-native/codegen/lib/parsers/flow/modules');
|
|
48
|
-
RNParserUtils = require('@react-native/codegen/lib/parsers/
|
|
60
|
+
RNParserUtils = require('@react-native/codegen/lib/parsers/utils');
|
|
61
|
+
RNFlowParser = require('@react-native/codegen/lib/parsers/flow/parser');
|
|
62
|
+
RNParserCommons = require('@react-native/codegen/lib/parsers/parsers-commons');
|
|
63
|
+
RNFlowParserUtils = require('@react-native/codegen/lib/parsers/flow/utils');
|
|
49
64
|
});
|
|
50
65
|
}
|
|
51
66
|
}
|
|
52
67
|
|
|
53
68
|
return {
|
|
54
|
-
buildModuleSchema:
|
|
69
|
+
buildModuleSchema: RNParserCommons.buildModuleSchema,
|
|
55
70
|
createParserErrorCapturer: RNParserUtils.createParserErrorCapturer,
|
|
71
|
+
parser: new RNFlowParser.FlowParser(),
|
|
72
|
+
resolveTypeAnnotation: RNFlowParserUtils.resolveTypeAnnotation,
|
|
73
|
+
translateTypeAnnotation: RNModuleParser.flowTranslateTypeAnnotation,
|
|
56
74
|
};
|
|
57
75
|
}
|
|
58
76
|
|
|
@@ -127,17 +145,28 @@ function rule(context) {
|
|
|
127
145
|
});
|
|
128
146
|
}
|
|
129
147
|
|
|
130
|
-
const {
|
|
131
|
-
|
|
132
|
-
|
|
148
|
+
const {
|
|
149
|
+
buildModuleSchema,
|
|
150
|
+
createParserErrorCapturer,
|
|
151
|
+
parser,
|
|
152
|
+
resolveTypeAnnotation,
|
|
153
|
+
translateTypeAnnotation,
|
|
154
|
+
} = requireModuleParser();
|
|
133
155
|
|
|
134
156
|
const [parsingErrors, tryParse] = createParserErrorCapturer();
|
|
135
157
|
|
|
136
158
|
const sourceCode = context.getSourceCode().getText();
|
|
137
|
-
const ast =
|
|
159
|
+
const ast = parser.getAst(sourceCode);
|
|
138
160
|
|
|
139
161
|
tryParse(() => {
|
|
140
|
-
buildModuleSchema(
|
|
162
|
+
buildModuleSchema(
|
|
163
|
+
hasteModuleName,
|
|
164
|
+
ast,
|
|
165
|
+
tryParse,
|
|
166
|
+
parser,
|
|
167
|
+
resolveTypeAnnotation,
|
|
168
|
+
translateTypeAnnotation,
|
|
169
|
+
);
|
|
141
170
|
});
|
|
142
171
|
|
|
143
172
|
parsingErrors.forEach(error => {
|
|
@@ -61,9 +61,6 @@ function save() {
|
|
|
61
61
|
fs.writeFileSync(FILENAME, serialised);
|
|
62
62
|
} catch (e) {
|
|
63
63
|
switch (e.code) {
|
|
64
|
-
// workaround https://github.com/nodejs/node/issues/31481
|
|
65
|
-
// todo: remove the ENOENT error check when we drop node.js 13 support
|
|
66
|
-
case 'ENOENT':
|
|
67
64
|
case 'EACCES':
|
|
68
65
|
case 'EPERM':
|
|
69
66
|
console.warn(
|