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

estree.d.ts is not a module #15017

Closed
kingyue737 opened this issue Jul 6, 2023 · 3 comments · Fixed by #15018
Closed

estree.d.ts is not a module #15017

kingyue737 opened this issue Jul 6, 2023 · 3 comments · Fixed by #15018
Labels
locked-due-to-inactivity Please open a new issue and fill out the template instead of commenting. type:bug Issues identifying ugly output, or a defect in the program type:meta Issues about the status of Prettier, or anything else about Prettier itself

Comments

@kingyue737
Copy link
Contributor

Environments:

  • Prettier Version: 3.0.0
  • Running Prettier via: Browser API
  • Runtime: Chrome 114
  • Operating System: Windows
  • Prettier plugins (if any): built-in estree and babel plugin

Steps to reproduce:

I'm using standalone prettier to format code text in browser
image

Import prettier/plugins/estree in source code will raise typescript error:

File './node_modules/.pnpm/prettier@3.0.0/node_modules/prettier/plugins/estree.d.ts' is not a module.ts(2306)

Expected behavior:
No type error

Actual behavior:
I found estree.d.ts is an empty file

@fisker
Copy link
Member

fisker commented Jul 6, 2023

// We only add `parsers` to types file, printers should not be used alone
// For `estree` plugin, we just write an empty file

Any idea how to fix it?

@kingyue737
Copy link
Contributor Author

kingyue737 commented Jul 6, 2023

@fisker Add the following line can fix it

// estree.d.ts
export {}

Adding this in the declaration file seems to be a routine operation to ensure it treated as a module
https://router.vuejs.org/guide/advanced/meta.html#typescript

@fisker
Copy link
Member

fisker commented Jul 6, 2023

Would you like to send a PR?

@fisker fisker added type:bug Issues identifying ugly output, or a defect in the program type:meta Issues about the status of Prettier, or anything else about Prettier itself labels Jul 6, 2023
@github-actions github-actions bot added the locked-due-to-inactivity Please open a new issue and fill out the template instead of commenting. label Nov 24, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 24, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
locked-due-to-inactivity Please open a new issue and fill out the template instead of commenting. type:bug Issues identifying ugly output, or a defect in the program type:meta Issues about the status of Prettier, or anything else about Prettier itself
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants