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

Update rules to prevent prettier to run #475

Merged
merged 2 commits into from Jul 21, 2023

Conversation

christianlupus
Copy link
Contributor

Currently, the webpack-loader runs prettier in development mode. This is the current default. With the updated version of Prettier from 2 to 3, the trailing comma setting changed to all. Unfortunately, the vue-loader chokes on the additional commas and refuses to build the Vue files.

This PR will disable the prettify step during the Vue build for the development build. Thus no issue is triggered for the build with the Vue loader.

This is more of a central fix to prevent others to run into the same issue as me and needing to configure the rules locally in the apps. This is only intended as a temporary workaround until the vue loader can handle the extra commas. As the default codebase would ideally be prettified already, the impact on readability should not be too much.

Signed-off-by: Christian Wolf <github@christianwolf.email>
@ShGKme
Copy link
Contributor

ShGKme commented Jul 18, 2023

Do you have a reproduction example for the described issue?

@christianlupus
Copy link
Contributor Author

christianlupus commented Jul 19, 2023

Hey @ShGKme.
Yes, I stumbled over this in the cookbook app. The commit that fixed it for now is to use this PR: see this commit

If you peek into the history, you will see that I merged prettier twice as I thought I managed to fix it in the meantime.

A more detailed explanation of the problem was written by SysKeeper in this form thread. This thread had additional information and command output logs attached for completeness.

@ShGKme
Copy link
Contributor

ShGKme commented Jul 19, 2023

Seems like this is dependency resolving issue. I'll check later today, if it is possible to solve it without loosing prettify output.

@ShGKme
Copy link
Contributor

ShGKme commented Jul 19, 2023

A bit mode details about the problem.

  • vue-loader for vue@2.7 uses @vue/compiler-sfc for compiling, not vue-template-compiler.
  • @vue/compiler-sfc prettifies result with prettier
  • @vue/compiler-sfc has no prettier in dependencies (bug in vue/compiler-sfc)

As the result, @vue/compiler-sfc uses any installed prettier, including incompatible one.

Copy link
Contributor

@ShGKme ShGKme left a comment

Choose a reason for hiding this comment

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

It fixes Vue 2.7 bug with dependencies.

Alternative solution: vuejs/vue#13053

rules.js Outdated Show resolved Hide resolved
Co-authored-by: Grigorii K. Shartsev <grigorii.shartsev@nextcloud.com>
Signed-off-by: Christian Wolf <github@christianwolf.email>
@christianlupus
Copy link
Contributor Author

I will merge this. Until a new release of Vue2 has been pushed out (and we can use that as a dependency) that was fixed by your PR, we can use this workaround. This can be reverted afterward.

@christianlupus christianlupus merged commit ddfc433 into master Jul 21, 2023
5 checks passed
@delete-merged-branch delete-merged-branch bot deleted the fix/prettier-15-support branch July 21, 2023 13:51
@skjnldsv skjnldsv mentioned this pull request Aug 16, 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

Successfully merging this pull request may close these issues.

None yet

2 participants