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

[error] Couldn't resolve parser "sh". when upgrading to Prettier 3.1.0 #310

Closed
nbouvrette opened this issue Nov 18, 2023 · 14 comments
Closed

Comments

@nbouvrette
Copy link

I just upgraded to Prettier 3.1.0 this morning and got this new error:

[error] Couldn't resolve parser "sh".

When I downgrade to Prettier 3.0.3 the problem dissapears.

How to reproduce:

  1. Clone https://github.com/Avansai/next-multilingual
  2. Edit packages.json and set Prettier to version 3.1.0
  3. run npm install
  4. run npm test
@JounQin
Copy link
Member

JounQin commented Nov 18, 2023

image

Seems like a prettier core bug?

cc @fisker @sosukesuzuki

@fisker
Copy link

fisker commented Nov 18, 2023

I'll take a look.

@fisker
Copy link

fisker commented Nov 18, 2023

@fisker
Copy link

fisker commented Nov 18, 2023

$ npx prettier --find-config-pah example/.env.development
example/.prettierrc.yaml

@JounQin
Copy link
Member

JounQin commented Nov 18, 2023

I just upgraded to Prettier 3.1.0 this morning and got this new error:

When I downgrade to Prettier 3.0.3 the problem dissapears.

@fisker But it seems a regression, what means config resolution changed.

@fisker
Copy link

fisker commented Nov 18, 2023

Maybe a bug was fixed accidentally.

@fisker
Copy link

fisker commented Nov 18, 2023

@fisker
Copy link

fisker commented Nov 18, 2023

And that's a bug you rasied.. prettier/prettier#15079 😄

@JounQin
Copy link
Member

JounQin commented Nov 18, 2023

OK, last thing is that the error message is a bit confusing? It successfully understands that it should use sh as the parser what means prettier-plugin-sh is already loaded correctly.

@fisker
Copy link

fisker commented Nov 18, 2023

No, the plugin is not loaded, the config file tells prettier to use that parser, https://github.com/Avansai/next-multilingual/blob/c48503df8062304e215919a9ea2f04476d9b253a/example/.prettierrc.yaml#L25

@JounQin
Copy link
Member

JounQin commented Nov 18, 2023

Hah, that makes sense then! Thanks for your explanation! Close due to answered as above then.

@JounQin JounQin closed this as not planned Won't fix, can't repro, duplicate, stale Nov 18, 2023
@nbouvrette
Copy link
Author

Thanks @fisker and @JounQin - I'm not sure why it was working before?

I thought there was some sort of inheritance but maybe this is gone? in any case adding the plugins section in the example prettier config seems to solve the issue.

@JounQin
Copy link
Member

JounQin commented Nov 18, 2023

I'm not sure why it was working before?

Oh, caused by prettier/prettier#15433, in pre-v3.1 we doesn't format that file at all.

Please read the conversation carefully.

@nbouvrette
Copy link
Author

I think I get it - thanks for looking into this!

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

No branches or pull requests

3 participants