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

Formatting failed if "with" keyword in import attributes but Prettier v3.4.2 and acorn support #3593

Open
anilkumarum opened this issue Dec 16, 2024 · 1 comment

Comments

@anilkumarum
Copy link

Summary

pPease update vscode extension in vscode marketplace
Formatting fails when the 'with' keyword is used in import attributes, but both Prettier v3.4.2 and Acorn support the use of the 'with' keyword in import attributes.

Steps To Reproduce:

import styleCss from "./style.css" with { type: "css" };
document.adoptedStyleSheets.push(styleCss);

Expected result

Format javascript file properly if "with" keyword in import attributes used

Actual result

SyntaxError: Unexpected token, expected "(" (1:41)

1 | import styleCss from "./style.css" with { type: "css" };
| ^
2 | document.adoptedStyleSheets.push(styleCss);

Additional information

Prettier v3.4.2 supports the 'with' keyword in import attributes. Please update your Prettier dependencies and the Prettier VSCode extension. Due to this issue, I was forced to use an alternative formatting tool.

VS Code Version:
Version: 1.89.1
Commit: dc96b837cf6bb4af9cd736aa3af08cf8279f7685
Date: 2024-05-07T05:16:23.416Z
Electron: 28.2.8
ElectronBuildId: 27744544
Chromium: 120.0.6099.291
Node.js: 18.18.2
V8: 12.0.267.19-electron.0
OS: Linux x64 5.15.0-126-generic

Prettier Extension Version: v11.0.0

OS and version:Linux

Prettier Log Output

SyntaxError: Unexpected token, expected "(" (1:42)
> 1 | import  styleCss from "./style.css" with { type: "css" };
    |                                          ^
  2 | document.adoptedStyleSheets.push(styleCss);
  3 |
  4 |
@anilkumarum anilkumarum changed the title Formatting failed if "with" keyword in import attributes but Prettier v3.4.2 and acorn support "with" keyword in import attributes Formatting failed if "with" keyword in import attributes but Prettier v3.4.2 and acorn support Dec 16, 2024
@thevalleyy
Copy link

Having the same issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants
@thevalleyy @anilkumarum and others