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

Cannot read properties of undefined (reading 'parsers') #49

Open
kantuni opened this issue Jul 7, 2023 · 7 comments
Open

Cannot read properties of undefined (reading 'parsers') #49

kantuni opened this issue Jul 7, 2023 · 7 comments

Comments

@kantuni
Copy link

kantuni commented Jul 7, 2023

I get

Cannot read properties of undefined (reading 'parsers')

when I run

prettier --check Main.elm --plugin=prettier-plugin-elm

P.S. I can't get it to work in the VSCode either.

@kachkaev
Copy link
Member

👋 @kantuni! Which version of Prettier are you using? Can you please provide reproduction steps?

For the plugin to work in VS Code, it is necessary to list it in the Prettier’s config file: https://prettier.io/docs/en/plugins.html. E.g. in .prettierrc.json:

{
  "plugins": ["prettier-plugin-foo"]
}

@jwoLondon
Copy link
Member

Could it be related to the problems with Prettier in vsCode since V9.16?

prettier/prettier-vscode#3045

@kachkaev
Copy link
Member

Prettier 3.0 has dropped support for automatic plugin search because it had a lot of hard-to-solve issues (prettier/prettier#14759). Prettier plugins are is usually installed locally and are declared in Prettier config file. This file is located at the root of the project folder.

How difficult would be to change our recommended setup flow to a local copy of Prettier? If we cannot do that, we can stick with Prettier v2 or ask editor maintainers to support global plugins somehow.

@kachkaev
Copy link
Member

kachkaev commented Jul 15, 2023

I updated instructions for now: 56c32ae.

@jwoLondon feel free to improve them if you see any opportunities.

@kantuni
Copy link
Author

kantuni commented Jul 31, 2023

The issue was caused by Prettier v3. After downgrading to v2, everything works smoothly.
Thank you!

@kantuni kantuni closed this as completed Jul 31, 2023
@kachkaev
Copy link
Member

kachkaev commented Jul 31, 2023

Hmm, that’s odd. What was the context in which your were getting this error? This repo runs tests against Prettier v1, v2 and v3, so I it’d be great if you could help with the reproduction.

If anyone else experiences issues with prettier-plugin-elm after upgrading to Prettier v3, please give us a shout and we will reopen this issue!

@kantuni
Copy link
Author

kantuni commented Dec 17, 2023

Hey @kachkaev 👋 ,

Sorry for a late response. I just saw this message.

I'm trying to setup prettier-plugin-elm with prettier-plugin-tailwindcss (which requires Prettier v3).
But no matter what I do, VS Code refuses to show Prettier as a formatter for Elm files.

Happy to help repro!

@kantuni kantuni reopened this Dec 17, 2023
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