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

Handle Webpack and Prettier breaking changes #3103

Merged
merged 2 commits into from
Feb 14, 2025

Conversation

Mrtenz
Copy link
Member

@Mrtenz Mrtenz commented Feb 14, 2025

This updates the CLI and Webpack plugin to handle breaking changes following the bump required for ESLint 9.

Unfortunately Prettier 3 makes it very complicated to load configuration files with CJS, since it loads the ESM bundle using a top-level await, which is not supported by Node.js without additional experimental parameters. For now I've removed the functionality for custom Prettier configs, but we can reconsider this in the future (i.e., through specifying a Prettier path in the CLI config, or allowing to provide the options directly).

Copy link

socket-security bot commented Feb 14, 2025

New dependencies detected. Learn more about Socket for GitHub ↗︎

Package New capabilities Transitives Size Publisher
npm/[email protected] environment, filesystem, unsafe 0 11.2 MB prettier-bot

View full report↗︎

Base automatically changed from mrtenz/bump-eslint-packages to eslint-9 February 14, 2025 09:47
@Mrtenz Mrtenz force-pushed the mrtenz/eslint-9/webpack-breaking-changes branch from e269bab to 68360e6 Compare February 14, 2025 10:01
Comment on lines -21 to -26
const config = await resolveConfig(path, {
editorconfig: true,
});

const formattedManifest = format(data, {
...config,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The non-standalone version uses top-level await to import the ESM bundle, it seems. That unfortunately breaks unless we use an experimental Node.js flag. The easiest solution for now seems to be to remove support for a custom Prettier config.

@Mrtenz Mrtenz marked this pull request as ready for review February 14, 2025 10:04
@Mrtenz Mrtenz requested a review from a team as a code owner February 14, 2025 10:04
@Mrtenz Mrtenz force-pushed the mrtenz/eslint-9/webpack-breaking-changes branch from 68360e6 to 31870a7 Compare February 14, 2025 11:43

const formattedManifest = format(data, {
...config,
const formattedManifest = await format(data, {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wondering if we should just use Prettier 2 instead since we are forced to keep it around for now anyways?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With the ESLint 9 changes we need to bump to Prettier 3 as well. We could keep Prettier 2 around for this specifically, but I don't think it would be able to load Prettier 3 configs 😕

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I meant since we are forced to keep it for Jest. What would the downside be of the CLI still using Prettier 2?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What would the downside be of the CLI still using Prettier 2?

That it won't be able to load Prettier 3 configs 😅 I assume Snaps will want to update to ESLint 9, Prettier 3, etc. as well, so I'm not sure if there's a benefit to keeping Prettier 2 around.

@Mrtenz Mrtenz merged commit a14f609 into eslint-9 Feb 14, 2025
114 of 169 checks passed
@Mrtenz Mrtenz deleted the mrtenz/eslint-9/webpack-breaking-changes branch February 14, 2025 12:47
Mrtenz added a commit that referenced this pull request Feb 14, 2025
This updates the CLI and Webpack plugin to handle breaking changes
following the bump required for ESLint 9.

Unfortunately Prettier 3 makes it very complicated to load configuration
files with CJS, since it loads the ESM bundle using a top-level await,
which is not supported by Node.js without additional experimental
parameters. For now I've removed the functionality for custom Prettier
configs, but we can reconsider this in the future (i.e., through
specifying a Prettier path in the CLI config, or allowing to provide the
options directly).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants