@react-native/eslint-plugin-specs 0.72.2 → 0.72.4
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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-native/eslint-plugin-specs",
|
|
3
|
-
"version": "0.72.
|
|
3
|
+
"version": "0.72.4",
|
|
4
4
|
"description": "ESLint rules to validate NativeModule and Component Specs",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"repository": {
|
|
@@ -14,11 +14,11 @@
|
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
16
|
"@babel/core": "^7.20.0",
|
|
17
|
-
"@babel/eslint-parser": "^7.
|
|
18
|
-
"@babel/plugin-transform-flow-strip-types": "^7.
|
|
19
|
-
"@babel/preset-flow": "^7.
|
|
17
|
+
"@babel/eslint-parser": "^7.20.0",
|
|
18
|
+
"@babel/plugin-transform-flow-strip-types": "^7.20.0",
|
|
19
|
+
"@babel/preset-flow": "^7.20.0",
|
|
20
20
|
"@react-native/codegen": "*",
|
|
21
|
-
"flow-parser": "^0.
|
|
21
|
+
"flow-parser": "^0.206.0",
|
|
22
22
|
"make-dir": "^2.1.0",
|
|
23
23
|
"pirates": "^4.0.1",
|
|
24
24
|
"source-map-support": "0.5.0"
|
package/react-native-modules.js
CHANGED
|
@@ -24,9 +24,17 @@ const ERRORS = {
|
|
|
24
24
|
let RNModuleParser;
|
|
25
25
|
let RNParserUtils;
|
|
26
26
|
let RNFlowParser;
|
|
27
|
+
let RNParserCommons;
|
|
28
|
+
let RNFlowParserUtils;
|
|
27
29
|
|
|
28
30
|
function requireModuleParser() {
|
|
29
|
-
if (
|
|
31
|
+
if (
|
|
32
|
+
RNModuleParser == null ||
|
|
33
|
+
RNParserUtils == null ||
|
|
34
|
+
RNFlowParser == null ||
|
|
35
|
+
RNParserCommons == null ||
|
|
36
|
+
RNFlowParserUtils == null
|
|
37
|
+
) {
|
|
30
38
|
// If using this externally, we leverage @react-native/codegen as published form
|
|
31
39
|
if (!PACKAGE_USAGE) {
|
|
32
40
|
const config = {
|
|
@@ -38,6 +46,8 @@ function requireModuleParser() {
|
|
|
38
46
|
RNModuleParser = require('@react-native/codegen/src/parsers/flow/modules');
|
|
39
47
|
RNParserUtils = require('@react-native/codegen/src/parsers/utils');
|
|
40
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');
|
|
41
51
|
});
|
|
42
52
|
} else {
|
|
43
53
|
const config = {
|
|
@@ -47,16 +57,20 @@ function requireModuleParser() {
|
|
|
47
57
|
|
|
48
58
|
withBabelRegister(config, () => {
|
|
49
59
|
RNModuleParser = require('@react-native/codegen/lib/parsers/flow/modules');
|
|
50
|
-
RNParserUtils = require('@react-native/codegen/lib/parsers/
|
|
60
|
+
RNParserUtils = require('@react-native/codegen/lib/parsers/utils');
|
|
51
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');
|
|
52
64
|
});
|
|
53
65
|
}
|
|
54
66
|
}
|
|
55
67
|
|
|
56
68
|
return {
|
|
57
|
-
buildModuleSchema:
|
|
69
|
+
buildModuleSchema: RNParserCommons.buildModuleSchema,
|
|
58
70
|
createParserErrorCapturer: RNParserUtils.createParserErrorCapturer,
|
|
59
71
|
parser: new RNFlowParser.FlowParser(),
|
|
72
|
+
resolveTypeAnnotation: RNFlowParserUtils.resolveTypeAnnotation,
|
|
73
|
+
translateTypeAnnotation: RNModuleParser.flowTranslateTypeAnnotation,
|
|
60
74
|
};
|
|
61
75
|
}
|
|
62
76
|
|
|
@@ -131,8 +145,13 @@ function rule(context) {
|
|
|
131
145
|
});
|
|
132
146
|
}
|
|
133
147
|
|
|
134
|
-
const {
|
|
135
|
-
|
|
148
|
+
const {
|
|
149
|
+
buildModuleSchema,
|
|
150
|
+
createParserErrorCapturer,
|
|
151
|
+
parser,
|
|
152
|
+
resolveTypeAnnotation,
|
|
153
|
+
translateTypeAnnotation,
|
|
154
|
+
} = requireModuleParser();
|
|
136
155
|
|
|
137
156
|
const [parsingErrors, tryParse] = createParserErrorCapturer();
|
|
138
157
|
|
|
@@ -140,7 +159,14 @@ function rule(context) {
|
|
|
140
159
|
const ast = parser.getAst(sourceCode);
|
|
141
160
|
|
|
142
161
|
tryParse(() => {
|
|
143
|
-
buildModuleSchema(
|
|
162
|
+
buildModuleSchema(
|
|
163
|
+
hasteModuleName,
|
|
164
|
+
ast,
|
|
165
|
+
tryParse,
|
|
166
|
+
parser,
|
|
167
|
+
resolveTypeAnnotation,
|
|
168
|
+
translateTypeAnnotation,
|
|
169
|
+
);
|
|
144
170
|
});
|
|
145
171
|
|
|
146
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(
|