hosseinmd / prettier-plugin-jsdoc

A Prettier plugin to format JSDoc comments.
MIT License
232 stars 28 forks source link

Workaround for `mdast-util-from-markdown` not working? #173

Closed giltayar closed 2 years ago

giltayar commented 2 years ago

While upgrading to the latest version of this plugin (0.4.1), ESlint failed me because this plugin's dist/index.js was require-ing a package that was ESM-only (mdast-util-from-markdown).

I looked in this repo, and found that there was supposed to be a workaround to fix this (by rolling up everything into CJS): https://github.com/hosseinmd/prettier-plugin-jsdoc/commit/28ac56e0eeaaf9d5f6e6170f8d8979c0d758840b.

But it looks like it doesn't work, because dist/index.js is still require-ing that ESM-only package.

To make sure, I cloned this repo, and ran yarn. This should have created a rolled-up dist/index.js, but did not. To make sure, I opened a CLI, and did require('./dist/index.js'), and got an ESM error, as I expected it should. So the current code in the repo also doesn't solve the ESM error.

I don't see how I'm the only one with this problem, so what am I missing?

ghdoergeloh commented 2 years ago

No, your not. Got the same problem. Maybe it is just because the release is very young so nobody else had this error before. In the earlier Version 0.3.38 I only find the dependency of mdast-util-from-markdown but I cannot find any usage. In the newer Version (which I cannot find here on github) there is a require('mdast-util-from-markdown') which results in this issue.

So for a workaround, I would downgrade to 0.3.38 until this is fixed.

hosseinmd commented 2 years ago

Fixed: v0.4.2

giltayar commented 2 years ago

Works! Thanks!