Skip to content

Attempt tsc fix

Attempt tsc fix #41

Triggered via push August 19, 2024 19:13
Status Failure
Total duration 26s
Artifacts

main.yml

on: push
Run Type Check & Linters
16s
Run Type Check & Linters
Fit to window
Zoom out
Zoom in

Annotations

10 errors and 1 warning
src/Graph.spec.ts: src/index.js#L4
Error: require() of ES Module /home/runner/work/graph-data-structure/graph-data-structure/src/Graph.js from /home/runner/work/graph-data-structure/graph-data-structure/src/index.js not supported. Graph.js is treated as an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which declares all .js files in that package scope as ES modules. Instead either rename Graph.js to end in .cjs, change the requiring code to use dynamic import() which is available in all CommonJS modules, or change "type": "module" to "type": "commonjs" in /home/runner/work/graph-data-structure/graph-data-structure/package.json to treat all .js files as CommonJS (using .mjs for all ES modules instead). ❯ src/index.js:4:18 ❯ src/Graph.spec.ts:2:31 ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Serialized Error: { code: 'ERR_REQUIRE_ESM' }
src/utils/deserializeGraph.spec.ts: src/Graph.js#L4
Error: require() of ES Module /home/runner/work/graph-data-structure/graph-data-structure/src/invariant.js from /home/runner/work/graph-data-structure/graph-data-structure/src/Graph.js not supported. invariant.js is treated as an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which declares all .js files in that package scope as ES modules. Instead either rename invariant.js to end in .cjs, change the requiring code to use dynamic import() which is available in all CommonJS modules, or change "type": "module" to "type": "commonjs" in /home/runner/work/graph-data-structure/graph-data-structure/package.json to treat all .js files as CommonJS (using .mjs for all ES modules instead). ❯ src/Graph.js:4:22 ❯ src/utils/deserializeGraph.spec.ts:2:31 ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Serialized Error: { code: 'ERR_REQUIRE_ESM' }
src/utils/findNodes.spec.ts: src/Graph.js#L4
Error: require() of ES Module /home/runner/work/graph-data-structure/graph-data-structure/src/invariant.js from /home/runner/work/graph-data-structure/graph-data-structure/src/Graph.js not supported. invariant.js is treated as an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which declares all .js files in that package scope as ES modules. Instead either rename invariant.js to end in .cjs, change the requiring code to use dynamic import() which is available in all CommonJS modules, or change "type": "module" to "type": "commonjs" in /home/runner/work/graph-data-structure/graph-data-structure/package.json to treat all .js files as CommonJS (using .mjs for all ES modules instead). ❯ src/Graph.js:4:22 ❯ src/utils/findNodes.spec.ts:2:31 ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Serialized Error: { code: 'ERR_REQUIRE_ESM' }
src/utils/getFirstNode.spec.ts: src/Graph.js#L4
Error: require() of ES Module /home/runner/work/graph-data-structure/graph-data-structure/src/invariant.js from /home/runner/work/graph-data-structure/graph-data-structure/src/Graph.js not supported. invariant.js is treated as an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which declares all .js files in that package scope as ES modules. Instead either rename invariant.js to end in .cjs, change the requiring code to use dynamic import() which is available in all CommonJS modules, or change "type": "module" to "type": "commonjs" in /home/runner/work/graph-data-structure/graph-data-structure/package.json to treat all .js files as CommonJS (using .mjs for all ES modules instead). ❯ src/Graph.js:4:22 ❯ src/utils/getFirstNode.spec.ts:2:31 ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Serialized Error: { code: 'ERR_REQUIRE_ESM' }
src/utils/getNode.spec.ts: src/Graph.js#L4
Error: require() of ES Module /home/runner/work/graph-data-structure/graph-data-structure/src/invariant.js from /home/runner/work/graph-data-structure/graph-data-structure/src/Graph.js not supported. invariant.js is treated as an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which declares all .js files in that package scope as ES modules. Instead either rename invariant.js to end in .cjs, change the requiring code to use dynamic import() which is available in all CommonJS modules, or change "type": "module" to "type": "commonjs" in /home/runner/work/graph-data-structure/graph-data-structure/package.json to treat all .js files as CommonJS (using .mjs for all ES modules instead). ❯ src/Graph.js:4:22 ❯ src/utils/getNode.spec.ts:2:31 ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Serialized Error: { code: 'ERR_REQUIRE_ESM' }
src/utils/hasCycle.spec.ts: src/Graph.js#L4
Error: require() of ES Module /home/runner/work/graph-data-structure/graph-data-structure/src/invariant.js from /home/runner/work/graph-data-structure/graph-data-structure/src/Graph.js not supported. invariant.js is treated as an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which declares all .js files in that package scope as ES modules. Instead either rename invariant.js to end in .cjs, change the requiring code to use dynamic import() which is available in all CommonJS modules, or change "type": "module" to "type": "commonjs" in /home/runner/work/graph-data-structure/graph-data-structure/package.json to treat all .js files as CommonJS (using .mjs for all ES modules instead). ❯ src/Graph.js:4:22 ❯ src/utils/hasCycle.spec.ts:2:31 ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Serialized Error: { code: 'ERR_REQUIRE_ESM' }
src/utils/indegree.spec.ts: src/Graph.js#L4
Error: require() of ES Module /home/runner/work/graph-data-structure/graph-data-structure/src/invariant.js from /home/runner/work/graph-data-structure/graph-data-structure/src/Graph.js not supported. invariant.js is treated as an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which declares all .js files in that package scope as ES modules. Instead either rename invariant.js to end in .cjs, change the requiring code to use dynamic import() which is available in all CommonJS modules, or change "type": "module" to "type": "commonjs" in /home/runner/work/graph-data-structure/graph-data-structure/package.json to treat all .js files as CommonJS (using .mjs for all ES modules instead). ❯ src/Graph.js:4:22 ❯ src/utils/indegree.spec.ts:2:31 ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Serialized Error: { code: 'ERR_REQUIRE_ESM' }
src/utils/outdegree.spec.ts: src/Graph.js#L4
Error: require() of ES Module /home/runner/work/graph-data-structure/graph-data-structure/src/invariant.js from /home/runner/work/graph-data-structure/graph-data-structure/src/Graph.js not supported. invariant.js is treated as an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which declares all .js files in that package scope as ES modules. Instead either rename invariant.js to end in .cjs, change the requiring code to use dynamic import() which is available in all CommonJS modules, or change "type": "module" to "type": "commonjs" in /home/runner/work/graph-data-structure/graph-data-structure/package.json to treat all .js files as CommonJS (using .mjs for all ES modules instead). ❯ src/Graph.js:4:22 ❯ src/utils/outdegree.spec.ts:2:31 ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Serialized Error: { code: 'ERR_REQUIRE_ESM' }
src/utils/serializeGraph.spec.ts: src/Graph.js#L4
Error: require() of ES Module /home/runner/work/graph-data-structure/graph-data-structure/src/invariant.js from /home/runner/work/graph-data-structure/graph-data-structure/src/Graph.js not supported. invariant.js is treated as an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which declares all .js files in that package scope as ES modules. Instead either rename invariant.js to end in .cjs, change the requiring code to use dynamic import() which is available in all CommonJS modules, or change "type": "module" to "type": "commonjs" in /home/runner/work/graph-data-structure/graph-data-structure/package.json to treat all .js files as CommonJS (using .mjs for all ES modules instead). ❯ src/Graph.js:4:22 ❯ src/utils/serializeGraph.spec.ts:2:31 ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Serialized Error: { code: 'ERR_REQUIRE_ESM' }
src/algorithms/depthFirstSearch/depthFirstSearch.spec.ts: src/Graph.js#L4
Error: require() of ES Module /home/runner/work/graph-data-structure/graph-data-structure/src/invariant.js from /home/runner/work/graph-data-structure/graph-data-structure/src/Graph.js not supported. invariant.js is treated as an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which declares all .js files in that package scope as ES modules. Instead either rename invariant.js to end in .cjs, change the requiring code to use dynamic import() which is available in all CommonJS modules, or change "type": "module" to "type": "commonjs" in /home/runner/work/graph-data-structure/graph-data-structure/package.json to treat all .js files as CommonJS (using .mjs for all ES modules instead). ❯ src/Graph.js:4:22 ❯ src/algorithms/depthFirstSearch/depthFirstSearch.spec.ts:2:31 ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Serialized Error: { code: 'ERR_REQUIRE_ESM' }
Run Type Check & Linters
The following actions use a deprecated Node.js version and will be forced to run on node20: actions/checkout@v3, actions/setup-node@v3. For more info: https://github.blog/changelog/2024-03-07-github-actions-all-actions-will-run-on-node20-instead-of-node16-by-default/