Skip to content

Commit 7556895

Browse files
authored
#2712 Update elyra-canvas to use ESM format instead of commonjs (#2826)
Signed-off-by: CTomlyn <[email protected]>
1 parent a041c5e commit 7556895

File tree

109 files changed

+1815
-1870
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

109 files changed

+1815
-1870
lines changed

canvas_modules/common-canvas/.eslintrc.js

Lines changed: 0 additions & 44 deletions
This file was deleted.

canvas_modules/common-canvas/Gruntfile.js renamed to canvas_modules/common-canvas/Gruntfile.cjs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2017-2023 Elyra Authors
2+
* Copyright 2017-2025 Elyra Authors
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -14,15 +14,19 @@
1414
* limitations under the License.
1515
*/
1616

17+
"use strict";
1718

1819
const codeCoverageDir = "reports/coverage";
1920
const autoprefixer = require("autoprefixer");
2021

2122
module.exports = function(grunt) {
2223
grunt.initConfig({
2324
eslint: {
24-
node: {
25-
src: ["Gruntfile.js", "__mocks__/**/*.js", "__tests__/**/*.js", "constants/**/*.js", "utils/**/*.js"]
25+
target: [
26+
"Gruntfile.cjs", "__mocks__/**/*.js", "__tests__/**/*.js", "constants/**/*.js", "utils/**/*.js"
27+
],
28+
options: {
29+
overrideConfigFile: "eslint.config.mjs"
2630
},
2731
browser: {
2832
files: {
@@ -69,7 +73,7 @@ module.exports = function(grunt) {
6973
postcss: {
7074
options: {
7175
processors: [
72-
autoprefixer() // add vendor prefixes
76+
autoprefixer // add vendor prefixes
7377
]
7478
},
7579
dist: {

canvas_modules/common-canvas/__mocks__/fileMock.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2017-2023 Elyra Authors
2+
* Copyright 2017-2025 Elyra Authors
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -15,4 +15,4 @@
1515
*/
1616

1717

18-
module.exports = "test-file-stub";
18+
export default "test-file-stub";

canvas_modules/common-canvas/__mocks__/globalMock.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2017-2023 Elyra Authors
2+
* Copyright 2017-2025 Elyra Authors
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -15,9 +15,7 @@
1515
*/
1616

1717
/* eslint no-empty-function: ["error", { "allow": ["functions", "arrowFunctions"] }] */
18-
/* global document*/
1918

20-
global.Range = function Range() {};
2119

2220
const createContextualFragment = (html) => {
2321
const div = document.createElement("div");

canvas_modules/common-canvas/__mocks__/styleMock.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2017-2023 Elyra Authors
2+
* Copyright 2017-2025 Elyra Authors
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -17,7 +17,7 @@
1717
// This file allows jest tests to run. It should contain any exported variables
1818
// from *.scss files which are used in the code
1919

20-
module.exports = {
20+
export default {
2121
smallFlyoutWidth: "318px", // This variable is taken from global.scss
2222
mediumFlyoutWidth: "625px" // This variable is taken from global.scss
2323
};

canvas_modules/common-canvas/__mocks__/svgMock.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2017-2023 Elyra Authors
2+
* Copyright 2017-2025 Elyra Authors
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -14,4 +14,4 @@
1414
* limitations under the License.
1515
*/
1616

17-
module.exports = "<svg />";
17+
export default "<svg />";

canvas_modules/common-canvas/__tests__/.eslintrc.js

Lines changed: 0 additions & 30 deletions
This file was deleted.

canvas_modules/common-canvas/__tests__/_utils_/control-utilsRTL.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
const { fireEvent } = require("@testing-library/react");
17+
import { fireEvent } from "@testing-library/react";
1818

1919
// Retrieve the dropdown items from a non-filterable dropdown control
2020
function getDropdownItems(container, parameterId) {
@@ -26,6 +26,6 @@ function getDropdownItems(container, parameterId) {
2626
return dropdownList;
2727
}
2828

29-
module.exports = {
30-
getDropdownItems: getDropdownItems
29+
export default {
30+
getDropdownItems
3131
};

canvas_modules/common-canvas/__tests__/_utils_/custom-condition-ops/customInvalid.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2017-2023 Elyra Authors
2+
* Copyright 2017-2025 Elyra Authors
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -24,5 +24,7 @@ function invalid(paramInfo, param2Info, value, controller) {
2424

2525
// Public Methods ------------------------------------------------------------->
2626

27-
module.exports.op = op;
28-
module.exports.invalid = invalid;
27+
export default {
28+
op,
29+
invalid
30+
};

canvas_modules/common-canvas/__tests__/_utils_/custom-condition-ops/customMax.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2017-2023 Elyra Authors
2+
* Copyright 2017-2025 Elyra Authors
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -28,5 +28,7 @@ function evaluate(paramInfo, param2Info, value, controller) {
2828

2929
// Public Methods ------------------------------------------------------------->
3030

31-
module.exports.op = op;
32-
module.exports.evaluate = evaluate;
31+
export default {
32+
op,
33+
evaluate
34+
};

0 commit comments

Comments
 (0)