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

ESM-only plugin #808

Open
benmccann opened this issue Jun 28, 2024 · 3 comments
Open

ESM-only plugin #808

benmccann opened this issue Jun 28, 2024 · 3 comments
Labels
breaking change enhancement New feature or request help wanted Extra attention is needed

Comments

@benmccann
Copy link
Member

benmccann commented Jun 28, 2024

Description

You can now write eslint plugins in ESM. Their docs demonstrate it here: https://eslint.org/docs/latest/extend/plugins

This would be a nice code modernization. It would also potentially be helpful to the Svelte core project as one the big reasons we've had to distribute a CJS version of the Svelte compiler is to support the eslint plugin. Though the other reason we need it is for the REPL and I'm unsure if we can avoid it there.

I think this may only work in eslint 9, so the plugin would need to drop support for older versions.

@benmccann benmccann added the enhancement New feature or request label Jun 28, 2024
@ota-meshi
Copy link
Member

ota-meshi commented Jun 28, 2024

I hope to one day change this package and the parser package to ESM.
But I'm not sure when that's going to be OK yet.
If we make our packages to ESM, users will have to migrate to the flat config of ESLint and write them in ESM.

When do you think it will be OK for us to force our users to use a flat config?
Do you think it's ok to ship the next major version soon and drop support for the old config?

I think this may only work in eslint 9, so the plugin would need to drop support for older versions.

ESLint v8 also has an experimental flat config available, so our package can be made into an ESM and still support ESLint v8.
(However, I would recommend dropping support for all but the last versions of ESLint v8, as the older ones have more bugs in flat config.)

@ota-meshi ota-meshi pinned this issue Jun 28, 2024
@benmccann
Copy link
Member Author

create-svelte creates new projects with the flat config. I do think it would be nice to encourage users to switch to the new config format as it's a much nicer experience

I wonder if this plugin could detect if you're using the old config format and print a deprecation warning encouraging users to migrate? Then they'd get some extra notice. We could do that as a 2.42.0 and then do a 3.0.0 afterwards that drops support for the old config format

@ota-meshi
Copy link
Member

ota-meshi commented Jun 29, 2024

Thank you for your opinion.

I wonder if this plugin could detect if you're using the old config format and print a deprecation warning encouraging users to migrate?

That's a good idea! I won't know until we try it, but I think it might be possible to warn about the old configuration getter.

Once that's done, I'd like to proceed with the migration to ESM.

If anyone can help us, I'm looking forward to PRs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking change enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants