@cornerstonejs/codemods 6.0.0-beta.1 → 6.0.0-beta.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/.oxlintrc.json +4 -0
- package/package.json +1 -1
- package/registry/cornerstone3d/6/README.md +46 -0
- package/registry/cornerstone3d/6/classes-and-types/README.md +16 -0
- package/registry/cornerstone3d/6/classes-and-types/scripts/classes-and-types.ts +32 -90
- package/registry/cornerstone3d/6/classes-and-types/scripts/lib.ts +864 -16
- package/registry/cornerstone3d/6/classes-and-types/tests/tsx/jsx-in-a-js-file/expected.js +31 -0
- package/registry/cornerstone3d/6/classes-and-types/tests/tsx/jsx-in-a-js-file/input.js +31 -0
- package/registry/cornerstone3d/6/classes-and-types/tests/tsx/jsx-in-a-js-file/metrics.json +46 -0
- package/registry/cornerstone3d/6/classes-and-types/tests/tsx/not-analysed-a-name-declared-twice/expected.tsx +34 -0
- package/registry/cornerstone3d/6/classes-and-types/tests/tsx/not-analysed-a-name-declared-twice/input.tsx +34 -0
- package/registry/cornerstone3d/6/classes-and-types/tests/tsx/not-analysed-a-name-declared-twice/metrics.json +12 -0
- package/registry/cornerstone3d/6/classes-and-types/tests/typescript/positive-classes/metrics.json +10 -0
- package/registry/cornerstone3d/6/classes-and-types/tests/typescript/renamed-classes-make-two-operands-one/expected.ts +61 -0
- package/registry/cornerstone3d/6/classes-and-types/tests/typescript/renamed-classes-make-two-operands-one/input.ts +65 -0
- package/registry/cornerstone3d/6/classes-and-types/tests/typescript/renamed-classes-make-two-operands-one/metrics.json +36 -0
- package/registry/cornerstone3d/6/display-sets/README.md +4 -0
- package/registry/cornerstone3d/6/display-sets/scripts/display-sets.ts +4 -2
- package/registry/cornerstone3d/6/display-sets/scripts/lib.ts +864 -16
- package/registry/cornerstone3d/6/display-sets/tests/tsx/jsx-in-a-js-file/expected.js +45 -0
- package/registry/cornerstone3d/6/display-sets/tests/tsx/jsx-in-a-js-file/input.js +39 -0
- package/registry/cornerstone3d/6/display-sets/tests/tsx/jsx-in-a-js-file/metrics.json +84 -0
- package/registry/cornerstone3d/6/display-sets/tests/tsx/not-analysed-a-name-declared-twice/expected.tsx +42 -0
- package/registry/cornerstone3d/6/display-sets/tests/tsx/not-analysed-a-name-declared-twice/input.tsx +42 -0
- package/registry/cornerstone3d/6/display-sets/tests/tsx/not-analysed-a-name-declared-twice/metrics.json +12 -0
- package/registry/cornerstone3d/6/events/README.md +4 -0
- package/registry/cornerstone3d/6/events/scripts/events.ts +5 -3
- package/registry/cornerstone3d/6/events/scripts/lib.ts +864 -16
- package/registry/cornerstone3d/6/events/tests/tsx/jsx-in-a-js-file/expected.js +18 -0
- package/registry/cornerstone3d/6/events/tests/tsx/jsx-in-a-js-file/input.js +18 -0
- package/registry/cornerstone3d/6/events/tests/tsx/jsx-in-a-js-file/metrics.json +38 -0
- package/registry/cornerstone3d/6/events/tests/tsx/not-analysed-a-name-declared-twice/expected.tsx +21 -0
- package/registry/cornerstone3d/6/events/tests/tsx/not-analysed-a-name-declared-twice/input.tsx +21 -0
- package/registry/cornerstone3d/6/events/tests/tsx/not-analysed-a-name-declared-twice/metrics.json +12 -0
- package/registry/cornerstone3d/6/settings/README.md +4 -0
- package/registry/cornerstone3d/6/settings/scripts/lib.ts +864 -16
- package/registry/cornerstone3d/6/settings/scripts/settings.ts +5 -3
- package/registry/cornerstone3d/6/settings/tests/tsx/jsx-in-a-js-file/expected.js +18 -0
- package/registry/cornerstone3d/6/settings/tests/tsx/jsx-in-a-js-file/input.js +18 -0
- package/registry/cornerstone3d/6/settings/tests/tsx/jsx-in-a-js-file/metrics.json +46 -0
- package/registry/cornerstone3d/6/settings/tests/tsx/not-analysed-a-name-declared-twice/expected.tsx +21 -0
- package/registry/cornerstone3d/6/settings/tests/tsx/not-analysed-a-name-declared-twice/input.tsx +21 -0
- package/registry/cornerstone3d/6/settings/tests/tsx/not-analysed-a-name-declared-twice/metrics.json +12 -0
- package/registry/cornerstone3d/6/tools/README.md +5 -0
- package/registry/cornerstone3d/6/tools/scripts/lib.ts +864 -16
- package/registry/cornerstone3d/6/tools/scripts/tools.ts +6 -3
- package/registry/cornerstone3d/6/tools/tests/tsx/jsx-in-a-js-file/expected.js +35 -0
- package/registry/cornerstone3d/6/tools/tests/tsx/jsx-in-a-js-file/input.js +35 -0
- package/registry/cornerstone3d/6/tools/tests/tsx/jsx-in-a-js-file/metrics.json +52 -0
- package/registry/cornerstone3d/6/tools/tests/tsx/not-analysed-a-name-declared-twice/expected.tsx +38 -0
- package/registry/cornerstone3d/6/tools/tests/tsx/not-analysed-a-name-declared-twice/input.tsx +38 -0
- package/registry/cornerstone3d/6/tools/tests/tsx/not-analysed-a-name-declared-twice/metrics.json +12 -0
- package/registry/cornerstone3d/6/viewport-members/README.md +5 -0
- package/registry/cornerstone3d/6/viewport-members/scripts/lib.ts +864 -16
- package/registry/cornerstone3d/6/viewport-members/scripts/viewport-members.ts +5 -3
- package/registry/cornerstone3d/6/viewport-members/tests/tsx/jsx-in-a-js-file/expected.js +41 -0
- package/registry/cornerstone3d/6/viewport-members/tests/tsx/jsx-in-a-js-file/input.js +41 -0
- package/registry/cornerstone3d/6/viewport-members/tests/tsx/jsx-in-a-js-file/metrics.json +108 -0
- package/registry/cornerstone3d/6/viewport-members/tests/tsx/not-analysed-a-name-declared-twice/expected.tsx +44 -0
- package/registry/cornerstone3d/6/viewport-members/tests/tsx/not-analysed-a-name-declared-twice/input.tsx +44 -0
- package/registry/cornerstone3d/6/viewport-members/tests/tsx/not-analysed-a-name-declared-twice/metrics.json +12 -0
- package/registry/cornerstone3d/6/viewport-types/README.md +35 -0
- package/registry/cornerstone3d/6/viewport-types/scripts/lib.ts +864 -16
- package/registry/cornerstone3d/6/viewport-types/scripts/viewport-types.ts +192 -4
- package/registry/cornerstone3d/6/viewport-types/tests/tsx/jsx-in-a-js-file/expected.js +76 -0
- package/registry/cornerstone3d/6/viewport-types/tests/tsx/jsx-in-a-js-file/input.js +76 -0
- package/registry/cornerstone3d/6/viewport-types/tests/tsx/jsx-in-a-js-file/metrics.json +102 -0
- package/registry/cornerstone3d/6/viewport-types/tests/tsx/not-analysed-a-name-declared-twice/expected.tsx +79 -0
- package/registry/cornerstone3d/6/viewport-types/tests/tsx/not-analysed-a-name-declared-twice/input.tsx +79 -0
- package/registry/cornerstone3d/6/viewport-types/tests/tsx/not-analysed-a-name-declared-twice/metrics.json +12 -0
- package/registry/cornerstone3d/6/viewport-types/tests/tsx/not-analysed-a-name-declared-twice-in-a-js-file/expected.js +78 -0
- package/registry/cornerstone3d/6/viewport-types/tests/tsx/not-analysed-a-name-declared-twice-in-a-js-file/input.js +78 -0
- package/registry/cornerstone3d/6/viewport-types/tests/tsx/not-analysed-a-name-declared-twice-in-a-js-file/metrics.json +12 -0
- package/registry/cornerstone3d/6/viewport-types/tests/typescript/ohif-returns-of-two-types-become-one/expected.ts +173 -0
- package/registry/cornerstone3d/6/viewport-types/tests/typescript/ohif-returns-of-two-types-become-one/input.ts +173 -0
- package/registry/cornerstone3d/6/viewport-types/tests/typescript/ohif-returns-of-two-types-become-one/metrics.json +166 -0
- package/registry/cornerstone3d/6/viewport-types/tests/typescript/ohif-two-operands-become-one/expected.ts +103 -0
- package/registry/cornerstone3d/6/viewport-types/tests/typescript/ohif-two-operands-become-one/input.ts +103 -0
- package/registry/cornerstone3d/6/viewport-types/tests/typescript/ohif-two-operands-become-one/metrics.json +78 -0
|
@@ -4,6 +4,8 @@ import { useMetricAtom } from 'codemod:metrics';
|
|
|
4
4
|
import {
|
|
5
5
|
CoreImports,
|
|
6
6
|
EditSet,
|
|
7
|
+
HeldMetric,
|
|
8
|
+
analysed,
|
|
7
9
|
bracketKey,
|
|
8
10
|
coreImportOf,
|
|
9
11
|
coreReExports,
|
|
@@ -24,10 +26,10 @@ import {
|
|
|
24
26
|
import type { Node } from './lib.ts';
|
|
25
27
|
|
|
26
28
|
/** Sites that the reader changes. */
|
|
27
|
-
const manual = useMetricAtom('cornerstone3d-6-manual');
|
|
29
|
+
const manual = new HeldMetric(useMetricAtom('cornerstone3d-6-manual'));
|
|
28
30
|
|
|
29
31
|
/** Rewrites that the reader checks. */
|
|
30
|
-
const review = useMetricAtom('cornerstone3d-6-review');
|
|
32
|
+
const review = new HeldMetric(useMetricAtom('cornerstone3d-6-review'));
|
|
31
33
|
|
|
32
34
|
/** The members whose call keeps its arguments under a new name. */
|
|
33
35
|
const RENAMED_METHODS: Record<string, string> = {
|
|
@@ -812,4 +814,4 @@ const codemod: Codemod<TSX> = (root) => {
|
|
|
812
814
|
return rootNode.commitEdits([...run.edits.all(), ...importEdits]);
|
|
813
815
|
};
|
|
814
816
|
|
|
815
|
-
export default codemod;
|
|
817
|
+
export default analysed(codemod, manual, review);
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { utilities, RenderingEngine } from '@cornerstonejs/core';
|
|
3
|
+
|
|
4
|
+
export function Controls({ engine, displaySetId, imageIds }) {
|
|
5
|
+
const viewport = engine.getViewport('ct');
|
|
6
|
+
|
|
7
|
+
const apply = () => {
|
|
8
|
+
viewport.setProperties({ voiRange: { lower: 0, upper: 1 } }, 'volume');
|
|
9
|
+
viewport.setProperties({ isComputedVOI: true });
|
|
10
|
+
viewport.setProperties(savedProperties);
|
|
11
|
+
viewport.resetCamera({ resetToCenter: false });
|
|
12
|
+
viewport.setCamera({ parallelScale: 10 });
|
|
13
|
+
viewport.setCamera({ flipHorizontal: true });
|
|
14
|
+
viewport.isDisabled = true;
|
|
15
|
+
|
|
16
|
+
return [viewport.getCamera(), viewport.getProperties(), viewport.scaling];
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
const remount = async () => {
|
|
20
|
+
viewport.setProperties({ invert: true });
|
|
21
|
+
await viewport.setDisplaySets({ displaySetId });
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
const supports = utilities.viewportSupportsStackCompatibility(viewport);
|
|
25
|
+
|
|
26
|
+
return (
|
|
27
|
+
<button onClick={apply} onDoubleClick={remount}>
|
|
28
|
+
{String(supports)} {imageIds.length}
|
|
29
|
+
</button>
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export function reset() {
|
|
34
|
+
const renderingEngine = new RenderingEngine('engine');
|
|
35
|
+
const stack = renderingEngine.getViewport('stack');
|
|
36
|
+
|
|
37
|
+
stack.resetViewState();
|
|
38
|
+
stack.setProperties({ invert: true });
|
|
39
|
+
|
|
40
|
+
return <i>{stack.getZoom()}</i>;
|
|
41
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { utilities, RenderingEngine } from '@cornerstonejs/core';
|
|
3
|
+
|
|
4
|
+
export function Controls({ engine, displaySetId, imageIds }) {
|
|
5
|
+
const viewport = engine.getViewport('ct');
|
|
6
|
+
|
|
7
|
+
const apply = () => {
|
|
8
|
+
viewport.setProperties({ voiRange: { lower: 0, upper: 1 } }, 'volume');
|
|
9
|
+
viewport.setProperties({ isComputedVOI: true });
|
|
10
|
+
viewport.setProperties(savedProperties);
|
|
11
|
+
viewport.resetCamera({ resetToCenter: false });
|
|
12
|
+
viewport.setCamera({ parallelScale: 10 });
|
|
13
|
+
viewport.setCamera({ flipHorizontal: true });
|
|
14
|
+
viewport.isDisabled = true;
|
|
15
|
+
|
|
16
|
+
return [viewport.getCamera(), viewport.getProperties(), viewport.scaling];
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
const remount = async () => {
|
|
20
|
+
viewport.setProperties({ invert: true });
|
|
21
|
+
await viewport.setDisplaySets({ displaySetId });
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
const supports = utilities.viewportSupportsStackCompatibility(viewport);
|
|
25
|
+
|
|
26
|
+
return (
|
|
27
|
+
<button onClick={apply} onDoubleClick={remount}>
|
|
28
|
+
{String(supports)} {imageIds.length}
|
|
29
|
+
</button>
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export function reset() {
|
|
34
|
+
const renderingEngine = new RenderingEngine('engine');
|
|
35
|
+
const stack = renderingEngine.getViewport('stack');
|
|
36
|
+
|
|
37
|
+
stack.resetCamera();
|
|
38
|
+
stack.setProperties({ invert: true });
|
|
39
|
+
|
|
40
|
+
return <i>{stack.getZoom()}</i>;
|
|
41
|
+
}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
{
|
|
2
|
+
"cornerstone3d-6-manual": [
|
|
3
|
+
{
|
|
4
|
+
"cardinality": {
|
|
5
|
+
"file": "input.js",
|
|
6
|
+
"line": "10",
|
|
7
|
+
"rule": "setProperties"
|
|
8
|
+
},
|
|
9
|
+
"count": 1
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
"cardinality": {
|
|
13
|
+
"file": "input.js",
|
|
14
|
+
"line": "11",
|
|
15
|
+
"rule": "resetCamera"
|
|
16
|
+
},
|
|
17
|
+
"count": 1
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"cardinality": {
|
|
21
|
+
"file": "input.js",
|
|
22
|
+
"line": "12",
|
|
23
|
+
"rule": "setCamera"
|
|
24
|
+
},
|
|
25
|
+
"count": 1
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
"cardinality": {
|
|
29
|
+
"file": "input.js",
|
|
30
|
+
"line": "13",
|
|
31
|
+
"rule": "setCamera"
|
|
32
|
+
},
|
|
33
|
+
"count": 1
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"cardinality": {
|
|
37
|
+
"file": "input.js",
|
|
38
|
+
"line": "14",
|
|
39
|
+
"rule": "isDisabled"
|
|
40
|
+
},
|
|
41
|
+
"count": 1
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
"cardinality": {
|
|
45
|
+
"file": "input.js",
|
|
46
|
+
"line": "16",
|
|
47
|
+
"rule": "getCamera"
|
|
48
|
+
},
|
|
49
|
+
"count": 1
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
"cardinality": {
|
|
53
|
+
"file": "input.js",
|
|
54
|
+
"line": "16",
|
|
55
|
+
"rule": "getProperties"
|
|
56
|
+
},
|
|
57
|
+
"count": 1
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
"cardinality": {
|
|
61
|
+
"file": "input.js",
|
|
62
|
+
"line": "16",
|
|
63
|
+
"rule": "scaling"
|
|
64
|
+
},
|
|
65
|
+
"count": 1
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
"cardinality": {
|
|
69
|
+
"file": "input.js",
|
|
70
|
+
"line": "20",
|
|
71
|
+
"rule": "setProperties"
|
|
72
|
+
},
|
|
73
|
+
"count": 1
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
"cardinality": {
|
|
77
|
+
"file": "input.js",
|
|
78
|
+
"line": "24",
|
|
79
|
+
"rule": "viewportSupportsStackCompatibility"
|
|
80
|
+
},
|
|
81
|
+
"count": 1
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
"cardinality": {
|
|
85
|
+
"file": "input.js",
|
|
86
|
+
"line": "38",
|
|
87
|
+
"rule": "setProperties: the viewport may not show its data yet"
|
|
88
|
+
},
|
|
89
|
+
"count": 1
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
"cardinality": {
|
|
93
|
+
"file": "input.js",
|
|
94
|
+
"line": "8",
|
|
95
|
+
"rule": "setProperties"
|
|
96
|
+
},
|
|
97
|
+
"count": 1
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
"cardinality": {
|
|
101
|
+
"file": "input.js",
|
|
102
|
+
"line": "9",
|
|
103
|
+
"rule": "setProperties"
|
|
104
|
+
},
|
|
105
|
+
"count": 1
|
|
106
|
+
}
|
|
107
|
+
]
|
|
108
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { utilities, RenderingEngine } from '@cornerstonejs/core';
|
|
3
|
+
|
|
4
|
+
export function Controls({ engine, displaySetId, imageIds }) {
|
|
5
|
+
const viewport = engine.getViewport('ct');
|
|
6
|
+
|
|
7
|
+
const apply = () => {
|
|
8
|
+
viewport.setProperties({ voiRange: { lower: 0, upper: 1 } }, 'volume');
|
|
9
|
+
viewport.setProperties({ isComputedVOI: true });
|
|
10
|
+
viewport.setProperties(savedProperties);
|
|
11
|
+
viewport.resetCamera({ resetToCenter: false });
|
|
12
|
+
viewport.setCamera({ parallelScale: 10 });
|
|
13
|
+
viewport.setCamera({ flipHorizontal: true });
|
|
14
|
+
viewport.isDisabled = true;
|
|
15
|
+
|
|
16
|
+
return [viewport.getCamera(), viewport.getProperties(), viewport.scaling];
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
const remount = async () => {
|
|
20
|
+
viewport.setProperties({ invert: true });
|
|
21
|
+
await viewport.setDisplaySets({ displaySetId });
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
const supports = utilities.viewportSupportsStackCompatibility(viewport);
|
|
25
|
+
|
|
26
|
+
return (
|
|
27
|
+
<button onClick={apply} onDoubleClick={remount}>
|
|
28
|
+
{String(supports)} {imageIds.length}
|
|
29
|
+
</button>
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export function reset() {
|
|
34
|
+
const renderingEngine = new RenderingEngine('engine');
|
|
35
|
+
const stack = renderingEngine.getViewport('stack');
|
|
36
|
+
|
|
37
|
+
stack.resetCamera();
|
|
38
|
+
stack.setProperties({ invert: true });
|
|
39
|
+
|
|
40
|
+
return <i>{stack.getZoom()}</i>;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const twice = 1;
|
|
44
|
+
const twice = 2;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { utilities, RenderingEngine } from '@cornerstonejs/core';
|
|
3
|
+
|
|
4
|
+
export function Controls({ engine, displaySetId, imageIds }) {
|
|
5
|
+
const viewport = engine.getViewport('ct');
|
|
6
|
+
|
|
7
|
+
const apply = () => {
|
|
8
|
+
viewport.setProperties({ voiRange: { lower: 0, upper: 1 } }, 'volume');
|
|
9
|
+
viewport.setProperties({ isComputedVOI: true });
|
|
10
|
+
viewport.setProperties(savedProperties);
|
|
11
|
+
viewport.resetCamera({ resetToCenter: false });
|
|
12
|
+
viewport.setCamera({ parallelScale: 10 });
|
|
13
|
+
viewport.setCamera({ flipHorizontal: true });
|
|
14
|
+
viewport.isDisabled = true;
|
|
15
|
+
|
|
16
|
+
return [viewport.getCamera(), viewport.getProperties(), viewport.scaling];
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
const remount = async () => {
|
|
20
|
+
viewport.setProperties({ invert: true });
|
|
21
|
+
await viewport.setDisplaySets({ displaySetId });
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
const supports = utilities.viewportSupportsStackCompatibility(viewport);
|
|
25
|
+
|
|
26
|
+
return (
|
|
27
|
+
<button onClick={apply} onDoubleClick={remount}>
|
|
28
|
+
{String(supports)} {imageIds.length}
|
|
29
|
+
</button>
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export function reset() {
|
|
34
|
+
const renderingEngine = new RenderingEngine('engine');
|
|
35
|
+
const stack = renderingEngine.getViewport('stack');
|
|
36
|
+
|
|
37
|
+
stack.resetCamera();
|
|
38
|
+
stack.setProperties({ invert: true });
|
|
39
|
+
|
|
40
|
+
return <i>{stack.getZoom()}</i>;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const twice = 1;
|
|
44
|
+
const twice = 2;
|
|
@@ -45,6 +45,37 @@ an alias of `Enums`, the namespace import, or `const { ViewportType } = Enums`.
|
|
|
45
45
|
- Review: each `AXIAL` written for an `ORTHOGRAPHIC` viewport, and an
|
|
46
46
|
`ORTHOGRAPHIC` whose orientation the codemod cannot see (a conditional
|
|
47
47
|
type, a variable).
|
|
48
|
+
- Review: a function (a declaration, an arrow, a method) in which the
|
|
49
|
+
rewrite turns a return of `STACK` and a return of `ORTHOGRAPHIC` into
|
|
50
|
+
`PLANAR`
|
|
51
|
+
(`ViewportType.PLANAR: one function returned STACK and ORTHOGRAPHIC, read what its callers do with the answer`,
|
|
52
|
+
at the line of the function). The rewrite is right for a viewport type.
|
|
53
|
+
An application that stored or compared the answer to tell a stack from a
|
|
54
|
+
volume has lost it: give it its own values, and ask
|
|
55
|
+
`viewport.getCurrentMode()` for a live viewport. A return counts directly
|
|
56
|
+
(also in each `case` of a `switch`), in a branch of a conditional, and
|
|
57
|
+
through a name: a `const` with its value, a `let` or a `var` with every
|
|
58
|
+
value when the file writes it only as `name = value`. A name written in
|
|
59
|
+
another way, a parameter and a call show nothing, so there is no entry. A
|
|
60
|
+
`STACK` that the codemod does not rewrite (in `type = ViewportType.STACK`,
|
|
61
|
+
or in a conditional) is in the manual report, and the function has no
|
|
62
|
+
entry. A function that returned a plain and a `_NEXT` name of one type
|
|
63
|
+
(`VOLUME_3D` and `VOLUME_3D_NEXT`) has no entry: 6.0 has one viewport of
|
|
64
|
+
that type.
|
|
65
|
+
- Review: two operands that the rewrite makes the same expression
|
|
66
|
+
(`ViewportType.VOLUME_3D: two operands of one || are the same now, read what each tested in 5.x`,
|
|
67
|
+
at the line of the second one): in a chain of `||` or of `&&`, as `case`
|
|
68
|
+
labels of one `switch`, or as entries of an array literal used with
|
|
69
|
+
`includes`, directly or through a `const`.
|
|
70
|
+
`type === ViewportType.VOLUME_3D || type === ViewportType.VOLUME_3D_NEXT`
|
|
71
|
+
told a legacy viewport from a next one in 5.x and is one test after the
|
|
72
|
+
rename. Where the code meant "any 3D viewport", delete one operand; where
|
|
73
|
+
it meant "a legacy 3D viewport", the test is true for every 3D viewport in
|
|
74
|
+
6.0, so delete that branch. Of two equal `case` labels only the first
|
|
75
|
+
runs. Operands are compared without comments, casts and white space. Two
|
|
76
|
+
operands that were the same before, and a member with its own string
|
|
77
|
+
(`viewport.type === ViewportType.STACK || viewport.type === 'stack'`),
|
|
78
|
+
have no entry.
|
|
48
79
|
- Manual: `PERSPECTIVE` and `'perspective'` (a 3D viewport draws the volume
|
|
49
80
|
in 3D, a decision of the guide); `STACK` or `ORTHOGRAPHIC` in another place,
|
|
50
81
|
such as a `switch` or a comparison with `viewportInput.type`; a comparison
|
|
@@ -58,6 +89,10 @@ an alias of `Enums`, the namespace import, or `const { ViewportType } = Enums`.
|
|
|
58
89
|
`'*Next'` string; `defaultOptions.displayArea` and
|
|
59
90
|
`defaultOptions.aspectRatio` of a viewport input, which a planar viewport
|
|
60
91
|
does not apply by itself.
|
|
92
|
+
- Manual, at line 1: `the file was not analysed:` with the reason, for a
|
|
93
|
+
file whose names cannot be looked up (the tool cannot read it, or a name
|
|
94
|
+
is declared twice in one scope). The file stays as it is. See the README
|
|
95
|
+
of `@cornerstonejs/cornerstone3d-6`.
|
|
61
96
|
|
|
62
97
|
## Development
|
|
63
98
|
|