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

Remove CJS support for config file #222

Closed
AndreaPontrandolfo opened this issue Aug 20, 2024 · 5 comments · Fixed by #225 or #220
Closed

Remove CJS support for config file #222

AndreaPontrandolfo opened this issue Aug 20, 2024 · 5 comments · Fixed by #225 or #220
Assignees
Labels
accepted The issue is accepted and a PR can be proposed. refactor

Comments

@AndreaPontrandolfo
Copy link
Owner

eslint.config.js with CJS syntax has been broken for months now.
The issue started when i integrated eslint-config-flat-gitignore.
eslint-config-flat-gitignore is not compatible with CJS and will throw an error at runtime if eslint.config.js is treated as a CJS module (funnily enough, it was my own PR that broke CJS support).

Now, considering that the config file can be .mjs file without any drawback (@antfu/eslint-config also adopt this approach), and even better it should be a .ts file, i see no downsides to removing the CJS support all togheter.

@AndreaPontrandolfo AndreaPontrandolfo added refactor accepted The issue is accepted and a PR can be proposed. labels Aug 20, 2024
@AndreaPontrandolfo AndreaPontrandolfo self-assigned this Aug 20, 2024
@lishaduck
Copy link
Contributor

This'd also drastically simplify #161.

I think it'd better to fix eslint-config-flat-gitignore, but if @antfu didn't want to bundle find-up-simple, I'd be understanding.

@AndreaPontrandolfo
Copy link
Owner Author

I mean, this is the exact outcome that Sindresorhus wants, i'm not going against the will of that guy haha.

@lishaduck
Copy link
Contributor

lishaduck commented Aug 23, 2024

Well, thanks I guess! I've been slowly rewriting #161 and this'll make it much easier (if not obsolete)
The only thing I didn't realize is that we'll run into arethetypeswrong/arethetypeswrong.github.io#112, which is a shame (tl;dr: attw'll fail without esm/node10 support until there's an option for esm-only packages, so we can't run it in ci)

@AndreaPontrandolfo
Copy link
Owner Author

I think this might does the trick? https://github.com/andrewbranch/example-subpath-exports-ts-compat.

I'm not sure, will have to check.

@lishaduck
Copy link
Contributor

I think this might does the trick? https://github.com/andrewbranch/example-subpath-exports-ts-compat.

I'm not sure, will have to check.

I was going to say no, but actually it should work:
https://github.com/andrewbranch/example-subpath-exports-ts-compat/tree/main/examples/node_modules/types-versions-wildcards

Doesn't work at runtime though, so I'd argue it's still wrong. One ought to be using modern moduleResolution settings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accepted The issue is accepted and a PR can be proposed. refactor
Projects
None yet
2 participants