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

BUG: Does not support prettier.config.ts, recently added in Prettier v3.5.0 #3623

Open
taep96 opened this issue Feb 10, 2025 · 4 comments
Open

Comments

@taep96
Copy link

taep96 commented Feb 10, 2025

Summary

Does not support prettier.config.ts, recently added in Prettier v3.5.0

Steps To Reproduce:

  1. Run prettier-vscode
  2. Check the output

Expected result

Working properly, like the CLI

Actual result

Errors

VS Code Version:

Version: 1.97.0

Prettier Extension Version:

11.0.0

Prettier Log Output

["ERROR" - 8:16:51 PM] Unknown file extension ".ts" for /path/to/prettier.config.ts
TypeError [ERR_UNKNOWN_FILE_EXTENSION]: Unknown file extension ".ts" for /path/to/prettier.config.ts
    at Object.getFileProtocolModuleFormat [as file:] (node:internal/modules/esm/get_format:177:9)
    at defaultGetFormat (node:internal/modules/esm/get_format:220:36)
    at defaultLoad (node:internal/modules/esm/load:142:22)
    at async ModuleLoader.load (node:internal/modules/esm/loader:555:7)
    at async ModuleLoader.moduleProvider (node:internal/modules/esm/loader:434:45)
    at async link (node:internal/modules/esm/module_job:87:21)
["ERROR" - 8:16:51 PM] Invalid prettier configuration file detected. See log for details.
["ERROR" - 8:19:53 PM] Invalid prettier configuration file detected.
@taep96
Copy link
Author

taep96 commented Feb 10, 2025

@itsyoboieltr @fisker

@tryforceful
Copy link

Is there any way we can set NODE_OPTIONS="--experimental-strip-types" somewhere in VSCode before Prettier runs? 🤔 to help get around this

@kingyue737
Copy link

kingyue737 commented Feb 14, 2025

To make TypeScript config files work, Node.js>=22.6.0 is required and Node.js v22 requires --experimental-strip-types.

According to the release note, Node v22 is required. I wonder if it is currently possible for the prettier extension to implement support for ts config, since VSCode ships with Node v20

@fisker
Copy link
Member

fisker commented Feb 14, 2025

As mentioned in the Prettier 3.5 release note, maybe we can use tsc to run Prettier.

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

4 participants