flow-upgrade 2.1.0 → 2.2.0

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/README.md CHANGED
@@ -68,11 +68,23 @@ Removes annotations nested inside of destructuring (e.g. `const [o: number] = fo
68
68
 
69
69
  Run with `yarn run flow-codemod removeAnnotationsInDestructuring`.
70
70
 
71
- Part of upgrade to 0.176
71
+ Part of the upgrade to 0.176
72
72
 
73
73
  ### Remove duplicate class properties
74
74
  Removes useless duplicate class properties and fixes bad constructor binding in those classes.
75
75
 
76
76
  Run with `yarn run flow-codemod removeDuplicateClassProperties`.
77
77
 
78
- Part of upgrade to 0.170
78
+ Part of the upgrade to 0.170
79
+
80
+ ### Rename `$Partial` to `Partial`
81
+ Renames usages of the `$Partial` utility type to its new name, [`Partial`](https://flow.org/en/docs/types/utilities/#toc-partial).
82
+
83
+ Run with `yarn run flow-codemod renamePartial`.
84
+
85
+ Part of the upgrade to 0.201
86
+
87
+ ### Convert `$Shape` to `Partial`
88
+ Converts usages of the deprecated and unsafe `$Shape` utility type to its replacement, [`Partial`](https://flow.org/en/docs/types/utilities/#toc-partial).
89
+
90
+ Run with `yarn run flow-codemod convertShapeToPartial`.
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
8
+ var _Types = require("../Types");
9
+
10
+ /**
11
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
12
+ *
13
+ * This source code is licensed under the MIT license found in the
14
+ * LICENSE file in the root directory of this source tree.
15
+ *
16
+ * @format
17
+ *
18
+ */
19
+ var _default = (0, _Types.codemod)({
20
+ title: 'Convert `$Shape` to `Partial`',
21
+ description: 'Converts usage of the `$Shape` utility type to `Partial`. It is possible that this will create type errors that you will have to resolve.',
22
+ transform: context => {
23
+ return {
24
+ 'GenericTypeAnnotation[id.name="$Shape"][typeParameters.params.length > 0]'(node) {
25
+ context.modifyNodeInPlace(node.id, {
26
+ name: 'Partial'
27
+ });
28
+ }
29
+
30
+ };
31
+ }
32
+ });
33
+
34
+ exports.default = _default;
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
8
+ var _Types = require("../Types");
9
+
10
+ /**
11
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
12
+ *
13
+ * This source code is licensed under the MIT license found in the
14
+ * LICENSE file in the root directory of this source tree.
15
+ *
16
+ * @format
17
+ *
18
+ */
19
+ var _default = (0, _Types.codemod)({
20
+ title: 'Rename `$Partial` to `Partial`',
21
+ description: 'Renames the `$Partial` type utility to `Partial`.',
22
+ transform: context => {
23
+ return {
24
+ 'GenericTypeAnnotation[id.name="$Partial"][typeParameters.params.length > 0]'(node) {
25
+ context.modifyNodeInPlace(node.id, {
26
+ name: 'Partial'
27
+ });
28
+ }
29
+
30
+ };
31
+ }
32
+ });
33
+
34
+ exports.default = _default;
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
8
+ var _renamePartial = _interopRequireDefault(require("../../codemods/renamePartial"));
9
+
10
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
+
12
+ /**
13
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
14
+ *
15
+ * This source code is licensed under the MIT license found in the
16
+ * LICENSE file in the root directory of this source tree.
17
+ *
18
+ * @format
19
+ *
20
+ */
21
+ var _default = {
22
+ version: '0.201.0',
23
+ upgrades: [_renamePartial.default]
24
+ };
25
+ exports.default = _default;
@@ -11,6 +11,8 @@ var _2 = _interopRequireDefault(require("./0.170.0"));
11
11
 
12
12
  var _3 = _interopRequireDefault(require("./0.176.0"));
13
13
 
14
+ var _4 = _interopRequireDefault(require("./0.201.0"));
15
+
14
16
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
17
 
16
18
  /**
@@ -27,5 +29,5 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
27
29
  * Holds all of the upgrades that need to be run to upgrade to each version from
28
30
  * the last version of Flow.
29
31
  */
30
- const VERSION_UPGRADES = [_.default, _2.default, _3.default];
32
+ const VERSION_UPGRADES = [_.default, _2.default, _3.default, _4.default];
31
33
  exports.VERSION_UPGRADES = VERSION_UPGRADES;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "flow-upgrade",
3
- "version": "2.1.0",
3
+ "version": "2.2.0",
4
4
  "description": "A utility for upgrading your codebase to the latest version of Flow.",
5
5
  "engines": {
6
6
  "node": ">=14"
@@ -31,9 +31,9 @@
31
31
  "@babel/highlight": "^7.18.6",
32
32
  "chalk": "^2.0.1",
33
33
  "fs-extra": "10.1.0",
34
- "hermes-estree": "0.9.0",
35
- "hermes-parser": "0.9.0",
36
- "hermes-transform": "0.9.0",
34
+ "hermes-estree": "0.10.0",
35
+ "hermes-parser": "0.10.0",
36
+ "hermes-transform": "0.10.0",
37
37
  "klaw-sync": "^6.0.0",
38
38
  "ora": "^5.4.1",
39
39
  "prompt-confirm": "^1.2.0",