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

Unexpected token for import attribute "with" #294

Closed
1 task
jase88 opened this issue May 12, 2024 · 1 comment
Closed
1 task

Unexpected token for import attribute "with" #294

jase88 opened this issue May 12, 2024 · 1 comment

Comments

@jase88
Copy link

jase88 commented May 12, 2024

Your Environment

  • Prettier version: 3.2.5
  • node version 20.13.1:
  • package manager: [email protected]
  • IDE: Webstorm

Describe the bug

Error if using import attribute with:

SyntaxError: Unexpected token, expected "{"

To Reproduce

import something from './something.json' with { type: 'json' };

https://v8.dev/features/import-attributes#deprecation-and-eventual-removal-of-assert

Expected behavior

Formatting works as for assert with importAssertions

import something from './something.json' assert { type: 'json' };

Screenshots, code sample, etc

see above

Configuration File (.prettierrc)

{
  "plugins": ["@trivago/prettier-plugin-sort-imports"],
  "singleQuote": true,
  "trailingComma": "es5",
  "importOrder": ["<THIRD_PARTY_MODULES>", "^@company/(.*)$", "^[./]"],
  "importOrderParserPlugins": ["typescript", "decorators-legacy", "importAttributes"],
  "importOrderSeparation": true,
  "importOrderSortSpecifiers": true
}

Error log

✖ prettier --write:
[error] script.mjs: SyntaxError: Unexpected token, expected "{" (2:58)
[error] 1 | import something from './something.json' assert { type: 'json' };

Contribute to @trivago/prettier-plugin-sort-imports

  • I'm willing to fix this bug 🥇
@jase88
Copy link
Author

jase88 commented May 13, 2024

Probably duplicate of #270

@jase88 jase88 closed this as not planned Won't fix, can't repro, duplicate, stale May 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant