Closed G-Rath closed 2 years ago
CI failure looks unrelated to this change:
error An unexpected error occurred: "could not find a copy of prettier to link in /home/runner/work/prettier-plugin-jsdoc/prettier-plugin-jsdoc/node_modules/@react-native-community/eslint-config/node_modules".
CI failure looks unrelated to this change:
error An unexpected error occurred: "could not find a copy of prettier to link in /home/runner/work/prettier-plugin-jsdoc/prettier-plugin-jsdoc/node_modules/@react-native-community/eslint-config/node_modules".
This error occur in last version of prettier, last version of prettier
mdast-util-from-markdown has few updated. But i don't know how we can migrate to new version because new version is esm module. Do you have a solution for this?
@hosseinmd do you need to update mdast-util-from-markdown
? and if so, what is it being used for?
The solutions I know of are:
import(...)
prettier
) to support being given a promise, which I don't think it doesI think the quickest one would be to transpile and vendor the dependency, but the ideal would be switching to another package if possible.
We used this package to convert description md string to a model. I don't know another package to do this. Now this package growing, but I can't use new versions. Convert package into non-esm is a good idea, but i don't know how can i do it.
@hosseinmd have you looked into using a loader?
here's an example of using esm
to load esmodules into a commonjs environment:
const fromMarkdown = require('esm')(module)('mdast-util-from-markdown');
@Sxxov I didn't think about using a sync loader to handle this - not sure how much of a fan I am of it but it probably is fine. It looks like esm
is unmaintained, but I'll hunt around to see if there's another loader that could do the job.
@hosseinmd if you want to create a new issue for this and assign it to me, I'll try and get a solution together (either by transpiling/vendoring or now maybe using a loader). I'm assuming this isn't critical, so will probably get into it next week once I've cleared a few other things on my plate 🙂
@hosseinmd have you looked into using a loader?
here's an example of using
esm
to load esmodules into a commonjs environment:const fromMarkdown = require('esm')(module)('mdast-util-from-markdown');
I created an issue for this https://github.com/hosseinmd/prettier-plugin-jsdoc/issues/150
Fixes #142
Have also added a test using the sample markdown the Prettier playground uses, to ensure the formatting remains consistent.