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

E2E tests: Html element attributes are not getting sorted for assertions #25

Closed
umaranis opened this issue Feb 24, 2023 · 3 comments
Closed
Assignees

Comments

@umaranis
Copy link
Owner

The prettier plugin prettier-plugin-organize-attributes is not working.

@umaranis
Copy link
Owner Author

The issue seems to be related to pnpm. Autoload prettier plugins don't work with pnpm.
See pnpm/pnpm#4700 and prettier/prettier#8474

@umaranis
Copy link
Owner Author

On debugging, I found that prettier is not able to locate the node_module folder for auto-loading plugins when using pnpm.

In the code for loading plugins, the current directory is identified as follows when the code works properly:
__dirname: “/Users/umarxxxx/Projects/svelte-lexical/node_modules/prettier”
And the folder for auto-loading modules is found as:
autoLoadDir: ”/Users/umarxxxx/Projects/svelte-lexical/"

In case of pnpm, the current directory is:
__dirname: “/Users/umarxxxx/Projects/svelte-lexical/node_modules/.pnpm/[email protected]/node_modules/prettier”
From this directory, prettier is not able to figure out autoLoadDir.

Here are the methods called from prettier codebase for loading prettier plugins and identifying the directories.

Pasted Graphic

Pasted Graphic 2

@umaranis umaranis self-assigned this Feb 24, 2023
@umaranis
Copy link
Owner Author

Able to resolve this issue by setting plugins and pluginSearchDirs in .prettierrc.json file.

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

1 participant