@react-native/eslint-plugin-specs 0.70.0 → 0.71.1
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/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-native/eslint-plugin-specs",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.71.1",
|
|
4
4
|
"description": "ESLint rules to validate NativeModule and Component Specs",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"repository": {
|
|
@@ -9,14 +9,15 @@
|
|
|
9
9
|
"directory": "packages/eslint-plugin-specs"
|
|
10
10
|
},
|
|
11
11
|
"scripts": {
|
|
12
|
-
"prepack": "node prepack.js"
|
|
12
|
+
"prepack": "node prepack.js",
|
|
13
|
+
"postpack": "node postpack.js"
|
|
13
14
|
},
|
|
14
15
|
"dependencies": {
|
|
15
16
|
"@babel/core": "^7.14.0",
|
|
16
17
|
"@babel/eslint-parser": "^7.18.2",
|
|
17
18
|
"@babel/plugin-transform-flow-strip-types": "^7.0.0",
|
|
18
19
|
"@babel/preset-flow": "^7.17.12",
|
|
19
|
-
"flow-parser": "^0.
|
|
20
|
+
"flow-parser": "^0.185.0",
|
|
20
21
|
"make-dir": "^2.1.0",
|
|
21
22
|
"pirates": "^4.0.1",
|
|
22
23
|
"react-native-codegen": "*",
|
package/postpack.js
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
* @format
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
const fs = require('fs');
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* script to prepare package for publish.
|
|
14
|
+
*
|
|
15
|
+
* Due to differences to how we consume internal packages, update a flag
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
fs.readFile('./react-native-modules.js', 'utf8', function (readError, source) {
|
|
19
|
+
if (readError != null) {
|
|
20
|
+
return console.error(
|
|
21
|
+
'Failed to read react-native-modules.js for publish',
|
|
22
|
+
readError,
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const result = source.replace(
|
|
27
|
+
'const PACKAGE_USAGE = true;',
|
|
28
|
+
'const PACKAGE_USAGE = false;',
|
|
29
|
+
);
|
|
30
|
+
|
|
31
|
+
fs.writeFile(
|
|
32
|
+
'./react-native-modules.js',
|
|
33
|
+
result,
|
|
34
|
+
'utf8',
|
|
35
|
+
function (writeError) {
|
|
36
|
+
if (writeError != null) {
|
|
37
|
+
return console.error(
|
|
38
|
+
'Failed to update react-native-modules.js for publish',
|
|
39
|
+
writeError,
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
);
|
|
44
|
+
});
|
package/react-native-modules.js
CHANGED
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
* This source code is licensed under the MIT license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*
|
|
7
|
-
* @emails react_native
|
|
8
7
|
* @format
|
|
8
|
+
* @oncall react_native
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
'use strict';
|
|
@@ -35,7 +35,7 @@ function requireModuleParser() {
|
|
|
35
35
|
|
|
36
36
|
withBabelRegister(config, () => {
|
|
37
37
|
RNModuleParser = require('react-native-codegen/src/parsers/flow/modules');
|
|
38
|
-
RNParserUtils = require('react-native-codegen/src/parsers/
|
|
38
|
+
RNParserUtils = require('react-native-codegen/src/parsers/utils');
|
|
39
39
|
});
|
|
40
40
|
} else {
|
|
41
41
|
const config = {
|
|
@@ -45,7 +45,7 @@ function requireModuleParser() {
|
|
|
45
45
|
|
|
46
46
|
withBabelRegister(config, () => {
|
|
47
47
|
RNModuleParser = require('react-native-codegen/lib/parsers/flow/modules');
|
|
48
|
-
RNParserUtils = require('react-native-codegen/lib/parsers/
|
|
48
|
+
RNParserUtils = require('react-native-codegen/lib/parsers/utils');
|
|
49
49
|
});
|
|
50
50
|
}
|
|
51
51
|
}
|
|
@@ -134,7 +134,7 @@ function rule(context) {
|
|
|
134
134
|
const [parsingErrors, tryParse] = createParserErrorCapturer();
|
|
135
135
|
|
|
136
136
|
const sourceCode = context.getSourceCode().getText();
|
|
137
|
-
const ast = flowParser.parse(sourceCode);
|
|
137
|
+
const ast = flowParser.parse(sourceCode, {enums: true});
|
|
138
138
|
|
|
139
139
|
tryParse(() => {
|
|
140
140
|
buildModuleSchema(hasteModuleName, ast, tryParse);
|