@cornerstonejs/codemods 6.0.0-beta.0 → 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.
Files changed (79) hide show
  1. package/.oxlintrc.json +4 -0
  2. package/package.json +1 -1
  3. package/registry/cornerstone3d/6/README.md +46 -0
  4. package/registry/cornerstone3d/6/classes-and-types/README.md +16 -0
  5. package/registry/cornerstone3d/6/classes-and-types/scripts/classes-and-types.ts +32 -90
  6. package/registry/cornerstone3d/6/classes-and-types/scripts/lib.ts +864 -16
  7. package/registry/cornerstone3d/6/classes-and-types/tests/tsx/jsx-in-a-js-file/expected.js +31 -0
  8. package/registry/cornerstone3d/6/classes-and-types/tests/tsx/jsx-in-a-js-file/input.js +31 -0
  9. package/registry/cornerstone3d/6/classes-and-types/tests/tsx/jsx-in-a-js-file/metrics.json +46 -0
  10. package/registry/cornerstone3d/6/classes-and-types/tests/tsx/not-analysed-a-name-declared-twice/expected.tsx +34 -0
  11. package/registry/cornerstone3d/6/classes-and-types/tests/tsx/not-analysed-a-name-declared-twice/input.tsx +34 -0
  12. package/registry/cornerstone3d/6/classes-and-types/tests/tsx/not-analysed-a-name-declared-twice/metrics.json +12 -0
  13. package/registry/cornerstone3d/6/classes-and-types/tests/typescript/positive-classes/metrics.json +10 -0
  14. package/registry/cornerstone3d/6/classes-and-types/tests/typescript/renamed-classes-make-two-operands-one/expected.ts +61 -0
  15. package/registry/cornerstone3d/6/classes-and-types/tests/typescript/renamed-classes-make-two-operands-one/input.ts +65 -0
  16. package/registry/cornerstone3d/6/classes-and-types/tests/typescript/renamed-classes-make-two-operands-one/metrics.json +36 -0
  17. package/registry/cornerstone3d/6/display-sets/README.md +4 -0
  18. package/registry/cornerstone3d/6/display-sets/scripts/display-sets.ts +4 -2
  19. package/registry/cornerstone3d/6/display-sets/scripts/lib.ts +864 -16
  20. package/registry/cornerstone3d/6/display-sets/tests/tsx/jsx-in-a-js-file/expected.js +45 -0
  21. package/registry/cornerstone3d/6/display-sets/tests/tsx/jsx-in-a-js-file/input.js +39 -0
  22. package/registry/cornerstone3d/6/display-sets/tests/tsx/jsx-in-a-js-file/metrics.json +84 -0
  23. package/registry/cornerstone3d/6/display-sets/tests/tsx/not-analysed-a-name-declared-twice/expected.tsx +42 -0
  24. package/registry/cornerstone3d/6/display-sets/tests/tsx/not-analysed-a-name-declared-twice/input.tsx +42 -0
  25. package/registry/cornerstone3d/6/display-sets/tests/tsx/not-analysed-a-name-declared-twice/metrics.json +12 -0
  26. package/registry/cornerstone3d/6/events/README.md +4 -0
  27. package/registry/cornerstone3d/6/events/scripts/events.ts +5 -3
  28. package/registry/cornerstone3d/6/events/scripts/lib.ts +864 -16
  29. package/registry/cornerstone3d/6/events/tests/tsx/jsx-in-a-js-file/expected.js +18 -0
  30. package/registry/cornerstone3d/6/events/tests/tsx/jsx-in-a-js-file/input.js +18 -0
  31. package/registry/cornerstone3d/6/events/tests/tsx/jsx-in-a-js-file/metrics.json +38 -0
  32. package/registry/cornerstone3d/6/events/tests/tsx/not-analysed-a-name-declared-twice/expected.tsx +21 -0
  33. package/registry/cornerstone3d/6/events/tests/tsx/not-analysed-a-name-declared-twice/input.tsx +21 -0
  34. package/registry/cornerstone3d/6/events/tests/tsx/not-analysed-a-name-declared-twice/metrics.json +12 -0
  35. package/registry/cornerstone3d/6/settings/README.md +4 -0
  36. package/registry/cornerstone3d/6/settings/scripts/lib.ts +864 -16
  37. package/registry/cornerstone3d/6/settings/scripts/settings.ts +5 -3
  38. package/registry/cornerstone3d/6/settings/tests/tsx/jsx-in-a-js-file/expected.js +18 -0
  39. package/registry/cornerstone3d/6/settings/tests/tsx/jsx-in-a-js-file/input.js +18 -0
  40. package/registry/cornerstone3d/6/settings/tests/tsx/jsx-in-a-js-file/metrics.json +46 -0
  41. package/registry/cornerstone3d/6/settings/tests/tsx/not-analysed-a-name-declared-twice/expected.tsx +21 -0
  42. package/registry/cornerstone3d/6/settings/tests/tsx/not-analysed-a-name-declared-twice/input.tsx +21 -0
  43. package/registry/cornerstone3d/6/settings/tests/tsx/not-analysed-a-name-declared-twice/metrics.json +12 -0
  44. package/registry/cornerstone3d/6/tools/README.md +5 -0
  45. package/registry/cornerstone3d/6/tools/scripts/lib.ts +864 -16
  46. package/registry/cornerstone3d/6/tools/scripts/tools.ts +6 -3
  47. package/registry/cornerstone3d/6/tools/tests/tsx/jsx-in-a-js-file/expected.js +35 -0
  48. package/registry/cornerstone3d/6/tools/tests/tsx/jsx-in-a-js-file/input.js +35 -0
  49. package/registry/cornerstone3d/6/tools/tests/tsx/jsx-in-a-js-file/metrics.json +52 -0
  50. package/registry/cornerstone3d/6/tools/tests/tsx/not-analysed-a-name-declared-twice/expected.tsx +38 -0
  51. package/registry/cornerstone3d/6/tools/tests/tsx/not-analysed-a-name-declared-twice/input.tsx +38 -0
  52. package/registry/cornerstone3d/6/tools/tests/tsx/not-analysed-a-name-declared-twice/metrics.json +12 -0
  53. package/registry/cornerstone3d/6/viewport-members/README.md +5 -0
  54. package/registry/cornerstone3d/6/viewport-members/scripts/lib.ts +864 -16
  55. package/registry/cornerstone3d/6/viewport-members/scripts/viewport-members.ts +5 -3
  56. package/registry/cornerstone3d/6/viewport-members/tests/tsx/jsx-in-a-js-file/expected.js +41 -0
  57. package/registry/cornerstone3d/6/viewport-members/tests/tsx/jsx-in-a-js-file/input.js +41 -0
  58. package/registry/cornerstone3d/6/viewport-members/tests/tsx/jsx-in-a-js-file/metrics.json +108 -0
  59. package/registry/cornerstone3d/6/viewport-members/tests/tsx/not-analysed-a-name-declared-twice/expected.tsx +44 -0
  60. package/registry/cornerstone3d/6/viewport-members/tests/tsx/not-analysed-a-name-declared-twice/input.tsx +44 -0
  61. package/registry/cornerstone3d/6/viewport-members/tests/tsx/not-analysed-a-name-declared-twice/metrics.json +12 -0
  62. package/registry/cornerstone3d/6/viewport-types/README.md +35 -0
  63. package/registry/cornerstone3d/6/viewport-types/scripts/lib.ts +864 -16
  64. package/registry/cornerstone3d/6/viewport-types/scripts/viewport-types.ts +192 -4
  65. package/registry/cornerstone3d/6/viewport-types/tests/tsx/jsx-in-a-js-file/expected.js +76 -0
  66. package/registry/cornerstone3d/6/viewport-types/tests/tsx/jsx-in-a-js-file/input.js +76 -0
  67. package/registry/cornerstone3d/6/viewport-types/tests/tsx/jsx-in-a-js-file/metrics.json +102 -0
  68. package/registry/cornerstone3d/6/viewport-types/tests/tsx/not-analysed-a-name-declared-twice/expected.tsx +79 -0
  69. package/registry/cornerstone3d/6/viewport-types/tests/tsx/not-analysed-a-name-declared-twice/input.tsx +79 -0
  70. package/registry/cornerstone3d/6/viewport-types/tests/tsx/not-analysed-a-name-declared-twice/metrics.json +12 -0
  71. package/registry/cornerstone3d/6/viewport-types/tests/tsx/not-analysed-a-name-declared-twice-in-a-js-file/expected.js +78 -0
  72. package/registry/cornerstone3d/6/viewport-types/tests/tsx/not-analysed-a-name-declared-twice-in-a-js-file/input.js +78 -0
  73. package/registry/cornerstone3d/6/viewport-types/tests/tsx/not-analysed-a-name-declared-twice-in-a-js-file/metrics.json +12 -0
  74. package/registry/cornerstone3d/6/viewport-types/tests/typescript/ohif-returns-of-two-types-become-one/expected.ts +173 -0
  75. package/registry/cornerstone3d/6/viewport-types/tests/typescript/ohif-returns-of-two-types-become-one/input.ts +173 -0
  76. package/registry/cornerstone3d/6/viewport-types/tests/typescript/ohif-returns-of-two-types-become-one/metrics.json +166 -0
  77. package/registry/cornerstone3d/6/viewport-types/tests/typescript/ohif-two-operands-become-one/expected.ts +103 -0
  78. package/registry/cornerstone3d/6/viewport-types/tests/typescript/ohif-two-operands-become-one/input.ts +103 -0
  79. package/registry/cornerstone3d/6/viewport-types/tests/typescript/ohif-two-operands-become-one/metrics.json +78 -0
@@ -0,0 +1,18 @@
1
+ import React, { useEffect } from 'react';
2
+ import { Enums } from '@cornerstonejs/core';
3
+
4
+ const { ACTORS_CHANGED, NEW_IMAGE: STACK_NEW_IMAGE } = Enums.Events;
5
+ const NEW_IMAGE = 'local';
6
+
7
+ export function Listener({ element }) {
8
+ useEffect(() => {
9
+ const onActors = (evt) => evt.detail;
10
+
11
+ element.addEventListener(Enums.Events.PRE_STACK_NEW_IMAGE, onPre);
12
+ element.addEventListener(ACTORS_CHANGED, onActors);
13
+ element.addEventListener('CORNERSTONE_STACK_NEW_IMAGE', onPre);
14
+ element.addEventListener(STACK_NEW_IMAGE, onPre);
15
+ }, [element]);
16
+
17
+ return <span>{NEW_IMAGE}</span>;
18
+ }
@@ -0,0 +1,18 @@
1
+ import React, { useEffect } from 'react';
2
+ import { Enums } from '@cornerstonejs/core';
3
+
4
+ const { ACTORS_CHANGED, STACK_NEW_IMAGE } = Enums.Events;
5
+ const NEW_IMAGE = 'local';
6
+
7
+ export function Listener({ element }) {
8
+ useEffect(() => {
9
+ const onActors = (evt) => evt.detail;
10
+
11
+ element.addEventListener(Enums.Events.PRE_STACK_NEW_IMAGE, onPre);
12
+ element.addEventListener(ACTORS_CHANGED, onActors);
13
+ element.addEventListener('CORNERSTONE_STACK_NEW_IMAGE', onPre);
14
+ element.addEventListener(STACK_NEW_IMAGE, onPre);
15
+ }, [element]);
16
+
17
+ return <span>{NEW_IMAGE}</span>;
18
+ }
@@ -0,0 +1,38 @@
1
+ {
2
+ "cornerstone3d-6-manual": [
3
+ {
4
+ "cardinality": {
5
+ "file": "input.js",
6
+ "line": "11",
7
+ "rule": "Events.PRE_STACK_NEW_IMAGE"
8
+ },
9
+ "count": 1
10
+ },
11
+ {
12
+ "cardinality": {
13
+ "file": "input.js",
14
+ "line": "13",
15
+ "rule": "'CORNERSTONE_STACK_NEW_IMAGE'"
16
+ },
17
+ "count": 1
18
+ },
19
+ {
20
+ "cardinality": {
21
+ "file": "input.js",
22
+ "line": "4",
23
+ "rule": "Events.ACTORS_CHANGED"
24
+ },
25
+ "count": 1
26
+ }
27
+ ],
28
+ "cornerstone3d-6-review": [
29
+ {
30
+ "cardinality": {
31
+ "file": "input.js",
32
+ "line": "4",
33
+ "rule": "Events.STACK_NEW_IMAGE: NEW_IMAGE also fires for each slice of a volume"
34
+ },
35
+ "count": 1
36
+ }
37
+ ]
38
+ }
@@ -0,0 +1,21 @@
1
+ import React, { useEffect } from 'react';
2
+ import { Enums } from '@cornerstonejs/core';
3
+
4
+ const { ACTORS_CHANGED, STACK_NEW_IMAGE } = Enums.Events;
5
+ const NEW_IMAGE = 'local';
6
+
7
+ export function Listener({ element }) {
8
+ useEffect(() => {
9
+ const onActors = (evt) => evt.detail;
10
+
11
+ element.addEventListener(Enums.Events.PRE_STACK_NEW_IMAGE, onPre);
12
+ element.addEventListener(ACTORS_CHANGED, onActors);
13
+ element.addEventListener('CORNERSTONE_STACK_NEW_IMAGE', onPre);
14
+ element.addEventListener(STACK_NEW_IMAGE, onPre);
15
+ }, [element]);
16
+
17
+ return <span>{NEW_IMAGE}</span>;
18
+ }
19
+
20
+ const twice = 1;
21
+ const twice = 2;
@@ -0,0 +1,21 @@
1
+ import React, { useEffect } from 'react';
2
+ import { Enums } from '@cornerstonejs/core';
3
+
4
+ const { ACTORS_CHANGED, STACK_NEW_IMAGE } = Enums.Events;
5
+ const NEW_IMAGE = 'local';
6
+
7
+ export function Listener({ element }) {
8
+ useEffect(() => {
9
+ const onActors = (evt) => evt.detail;
10
+
11
+ element.addEventListener(Enums.Events.PRE_STACK_NEW_IMAGE, onPre);
12
+ element.addEventListener(ACTORS_CHANGED, onActors);
13
+ element.addEventListener('CORNERSTONE_STACK_NEW_IMAGE', onPre);
14
+ element.addEventListener(STACK_NEW_IMAGE, onPre);
15
+ }, [element]);
16
+
17
+ return <span>{NEW_IMAGE}</span>;
18
+ }
19
+
20
+ const twice = 1;
21
+ const twice = 2;
@@ -0,0 +1,12 @@
1
+ {
2
+ "cornerstone3d-6-manual": [
3
+ {
4
+ "cardinality": {
5
+ "file": "input.tsx",
6
+ "line": "1",
7
+ "rule": "the file was not analysed: Identifier `twice` has already been declared"
8
+ },
9
+ "count": 1
10
+ }
11
+ ]
12
+ }
@@ -54,6 +54,10 @@ reference to it changed, the new ones come in, under a fresh alias such as
54
54
  key stays for the reader).
55
55
  - `viewport.setUseCPURendering()`, the member of a stack viewport, is
56
56
  reported by `@cornerstonejs/cornerstone3d-6-viewport-members`.
57
+ - Manual, at line 1: `the file was not analysed:` with the reason, for a
58
+ file whose names cannot be looked up (the tool cannot read it, or a name
59
+ is declared twice in one scope). The file stays as it is. See the README
60
+ of `@cornerstonejs/cornerstone3d-6`.
57
61
 
58
62
  ## Development
59
63