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

bug report: eslint-plugin-no-autofix with ESM-only packages #104

Open
MorevM opened this issue Feb 23, 2025 · 2 comments
Open

bug report: eslint-plugin-no-autofix with ESM-only packages #104

MorevM opened this issue Feb 23, 2025 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@MorevM
Copy link

MorevM commented Feb 23, 2025

Good day :)

The environment doesn't matter, all versions are the latest.

There is a trend towards publishing ESM-only packages: at a minimum I see @stylistic/eslint-plugin and eslint-plugin-unicorn.

When I try to upgrade these packages to the latest versions, I get the following error:

Image

This is maybe the same problem as mentioned in #92

If we want to keep using the plugin (I do, thanks for it), this is the time to rewrite it to ESM format.

I see that you've not been very active lately - I could probably do it myself, but I need explicit confirmation that you want to do it and are willing to accept the PR when it's ready (my fear is that the work will get done and the PR will hang around indefinitely).

Give me feedback, please.

@MorevM MorevM added the bug Something isn't working label Feb 23, 2025
@aladdin-add
Copy link
Owner

I have plans to rewrite it as ESM, but that would be a breaking change. Additionally, Node.js has made significant progress in this area: require(esm). Therefore, I recommend upgrading your Node.js environment, as it can help you conveniently use existing CJS modules.

The capability to require() ESM modules in Node.js, initiated by
JOYEECHEUNG, marks an incredible milestone. This feature allows packages to be published as ESM-only while still being consumable by CJS codebases with minimal modifications. It helps avoid the async infection (also known as Red Functions) introduced by dynamic import() ESM, which can be pretty hard, if not impossible in some cases, to migrate and adapt.

This feature was recently unflagged and backported to Node.js v22 (and soon v20), which means it should be available to many developers already. Consider the top-down or bottom-up metaphor, this feature actually makes it possible to start ESM migration also from middle-out, as it allows import chains like ESM → CJS → ESM → CJS to work seamlessly.

@MorevM
Copy link
Author

MorevM commented Feb 23, 2025

but that would be a breaking change

It wouldn't be a breaking change if you provide a dual export (but would require an extra build step, of course)

At this point I see it as a more serious step of increasing the minimum Node version to 22 just to use the shared ESLint config, versus working within the ecosystem.

I have plans to rewrite it as ESM

When do you think you'll be able to do that?
Do you need any help with it? I could look in that direction and send a PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants