AndreaPontrandolfo / sheriff

A comprehensive and opinionated Typescript-first ESLint configuration.
https://www.eslint-config-sheriff.dev
MIT License
104 stars 7 forks source link

Remove CJS support for config file #222

Closed AndreaPontrandolfo closed 2 weeks ago

AndreaPontrandolfo commented 3 weeks ago

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.

lishaduck commented 3 weeks ago

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 commented 3 weeks ago

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

lishaduck commented 2 weeks ago

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 commented 2 weeks ago

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 commented 2 weeks ago

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.