Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SyntaxError: Unexpected identifier 'assert' in Node 22 LTS #144

Open
1 of 4 tasks
gillisandrew opened this issue Nov 28, 2024 · 0 comments · May be fixed by #145
Open
1 of 4 tasks

SyntaxError: Unexpected identifier 'assert' in Node 22 LTS #144

gillisandrew opened this issue Nov 28, 2024 · 0 comments · May be fixed by #145
Labels
bug Something isn't working

Comments

@gillisandrew
Copy link

Describe the bug
Code will fail to run in Node 22 LTS with the following error:

import WorkflowSchema from "../workflow-v1.0.json" assert { type: "json" };
                                                   ^^^^^^

SyntaxError: Unexpected identifier 'assert'
    at compileSourceTextModule (node:internal/modules/esm/utils:340:16)
    at ModuleLoader.moduleStrategy (node:internal/modules/esm/translators:102:18)
    at #translate (node:internal/modules/esm/loader:433:12)
    at ModuleLoader.loadAndTranslate (node:internal/modules/esm/loader:480:27)

Node.js v22.11.0

This is the relevant line in the source:

import WorkflowSchema from "../workflow-v1.0.json" assert {type: "json"};

Package/Area

  • Expressions
  • Workflow Parser
  • Language Service
  • Language Server

Package Version
@actions/workflow-parser@0.3.13

Additional context
This is related to Node dropping support for the non-standard assert syntax (see nodejs/node#52104)
I only checked with Workflow Parser but a search shows it will also impact Language Service

import descriptions from "./descriptions.json" assert {type: "json"};

import workflow_call from "./workflow_call.json" assert {type: "json"};

import schemaImport from "rest-api-description/descriptions/api.github.com/dereferenced/api.github.com.deref.json" assert {type: "json"};

@gillisandrew gillisandrew added the bug Something isn't working label Nov 28, 2024
@gillisandrew gillisandrew linked a pull request Nov 29, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant