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

feat: Add mjs options to prettier #33949

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

alexrecuenco
Copy link

@alexrecuenco alexrecuenco commented Jan 30, 2025

See here: https://prettier.io/docs/en/configuration.html

Now ESM modules are allowed for prettier config files

At the same time, it might make sense to use prettier.resolveConfig, which returns null if no config is found. That way you don't need to keep matching prettier's interface ad-infinitum

Changes

Prettier allows mjs files.

Context

Prettier now allows ESM configuration

Documentation (please check one with an [x])

  • I have updated the documentation, or
  • No documentation update is required

How I've tested my work (please select one)

I have verified these changes via:

  • Code inspection only, or
  • Newly added/modified unit tests, or
  • No unit tests but ran on a real repository, or
  • Both unit tests + ran on a real repository

@viceice viceice changed the title Add mjs options to prettier feat: Add mjs options to prettier Jan 30, 2025
Copy link
Member

@viceice viceice left a comment

Choose a reason for hiding this comment

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

can you propose a PR to use the resolve config function?

@alexrecuenco
Copy link
Author

I am not sure I get what "Snapshots have been added in this PR. Use toMatch instead." means

@alexrecuenco
Copy link
Author

can you propose a PR to use the resolve config function?

If I have enough time, I'll try, I am unfortunately quite busy lately

@rarkins
Copy link
Collaborator

rarkins commented Jan 31, 2025

Doesn't prettier.resolveConfig also execute any JS found? Ie a massive attack vector if renovate were to allow users to execute arbitrary code?

@alexrecuenco
Copy link
Author

alexrecuenco commented Feb 1, 2025

Doesn't prettier.resolveConfig also execute any JS found? Ie a massive attack vector if renovate were to allow users to execute arbitrary code?

If you know that to be the case, then ignore the suggestion, thanks for your time

See here: https://prettier.io/docs/en/configuration.html

Now ESM modules are allowed for prettier config files
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.

3 participants