Skip to content
This repository has been archived by the owner on Jun 18, 2022. It is now read-only.

Update to remark 14? #14

Closed
akrawitz opened this issue Aug 19, 2021 · 10 comments
Closed

Update to remark 14? #14

akrawitz opened this issue Aug 19, 2021 · 10 comments

Comments

@akrawitz
Copy link

Until recently, linter-remark was working fine for me in Atom. I then updated the devdependencies in my package, including everything related to remark. Now, when I open a markdown file, I get an Error from remark:

Error: Cannot parse file '.remarkrc'  Cannot parse script... Syntax Error: Cannot use import statement outside a module...

I think the problem is that linter-remark is still on remark 13, and with remark 14 came a move to pure ESM. I will downgrade all my remark-related devdeps for now, but it would be great if linter-remark supported the current release.

Thanks,
Adam

@wooorm
Copy link
Owner

wooorm commented Aug 20, 2021

Unfortunately the error is because the plugins are ESM, and Atom does not support ESM at all. Updating to remark 14 wouldn’t help, because that’s ESM too, and thus would also throw this error.
I am personally an Atom user, but Atom is no longer maintained since MS bought GH, as they also have VSCode. So it’s unlikely to change. I myself am thinking of moving to VSCode.

@AlexWayfer
Copy link

I am personally an Atom user, but Atom is no longer maintained since MS bought GH, as they also have VSCode. So it’s unlikely to change. I myself am thinking of moving to VSCode.

FUUUUUU, I hate VS Code for some reasons, but it's too sadly that a lot of Atom users (and maintainers) moving to VSC and staling Atom ecosystem… there is almost no more competition between Electron-based (easily configurable) code editors, only fat IDEs and low-level like vim, emacs, etc., and at the middle VS Code (with problems) and Sublime (paid, closed-source, not too handful, pretty staled too).

@AlexWayfer
Copy link

@wooorm can we call remark via shell command (CLI) to avoid such integration issues?

@wooorm
Copy link
Owner

wooorm commented Nov 9, 2021

I‘ve been thinking a little bit about this. What if we’d use esbuild to bundle the config file and the core code of the linter?
Using the CLI and outputting the report with vfile-reporter-json could also work maybe?

@AlexWayfer
Copy link

What if we’d use esbuild to bundle the config file and the core code of the linter?

CLI can care about its config, I guess, I see no reason to load the config file of remark into the extension.

@wooorm
Copy link
Owner

wooorm commented Nov 16, 2021

I meant to imply there are two approaches. One is CLIs, which you mention. Spawning processes takes time though.

Hence the other idea: esbuild. I tried that today it works well for the linter, but the problem remains that ESM from inside config files doesn’t work, which is the point of this issue.

@AlexWayfer
Copy link

I still don't completely understand the point with "ESM from inside config files", but I'm not expert in this and trust you.

But I consider that slower (this point I understand) but working CLI is better than non-working approach. Probably, temporary, or as a fork, or as a side branch (released temporary).

@wooorm
Copy link
Owner

wooorm commented Nov 16, 2021

I still don't completely understand the point with "ESM from inside config files", but I'm not expert in this and trust you.

I’ll try to explain:

All plugins are ESM. So in practise that means folks have to add a type: module to their package.json or use a .remarkrc.mjs, which does stuff like import remarkToc from 'remark-toc' and const remarkConfig = {plugins: [remarkToc]}; export default remarkConfig

I can write this linter, and unified-engine-atom, in ESM, and use esbuild to compile it to CJS. That solves the problem for this project, as all our dependencies are ESM, but they’re bundled for Electron as CJS.

But the bundled linter will try to load those ESM config files, which crash, because Electron doesn’t support ESM.


But I consider that slower (this point I understand) but working CLI is better than non-working approach. Probably, temporary, or as a fork, or as a side branch (released temporary).

True! But as I thing the bundled version, if it would work, would be better, I’d rather try and get that to work. But you’re right that something working is better than nothing.

Btw, you can also use remark . -w in your project — it watches for changes. Not perfect, but useful enough!

@AlexWayfer
Copy link

But the bundled linter will try to load those ESM config files, which crash, because Electron doesn’t support ESM.

I guess I understood the part above this line, I though even about remark's plugins which can be ESM and will not be converted properly to CJS on-the-fly. But "ESM config files" still frustrating me. 😅 I personally configure remark and its plugins via YAML config files, I know about JSON configs and even sections inside package.json, but "ESM config files"… probably just didn't see them. Don't waste your time, thank you anyway.

Btw, you can also use remark . -w in your project — it watches for changes. Not perfect, but useful enough!

I like real-time underlines in my editor! And it'd be hard to remember to switch to a separate terminal tab for checking "is everything OK?", especially when I sometimes work on few projects (parallel or consistently).

@wooorm
Copy link
Owner

wooorm commented Jun 18, 2022

Closing as this package is now deprecated, due to Atom’s own deprecation: https://github.blog/2022-06-08-sunsetting-atom/

@wooorm wooorm closed this as completed Jun 18, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants