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

Default value for trailingComma is ignored by the extension or not true in the documentation #3067

Closed
ghost opened this issue Jul 7, 2023 · 6 comments
Labels
locked Please open a new issue and fill out the template instead of commenting. Stale

Comments

@ghost
Copy link

ghost commented Jul 7, 2023

Summary

While configuring my Prettier (only as a plugin for VSCode) with the .prettierrc config file, I found that according to documentation, the default value of trailingComma is either ignored by the plugin or it is not the right value in the documentation.

The documentation says the default value is all, while the code is formatted according to the value es5.

As it was found: function parameters are divided into several lines, in the default Prettier config the comma after the last parameter is removed

Steps To Reproduce:

  1. Use VSCode Insiders (tested with version 1.81.0)
  2. Install Prettier extension (tested with version 9.19.0)
  3. Use the default value for the trailingComma configure parameter
  4. Format the code with the Prettier extension. Example:
export function setupCounter(
  element: HTMLButtonElement,
  arg0: any,
  arg1: any
) { ...some }
  1. Observe that there are no commas after the last argument of the function, although according to the documentation it should be.

Expected result

According to the documentation for the value all there must be a comma after the last argument of the function if the argument is divided into a set of lines

VS Code Version:

Version: 1.81.0-insider
Commit: 31f183271b0d1f24a2052f6eccbb76bdef45d60b
Date: 2023-07-07T05:35:32.760Z
Electron: 22.3.14
ElectronBuildId: 21893604
Chromium: 108.0.5359.215
Node.js: 16.17.1
V8: 10.8.168.25-electron.0
OS: Darwin arm64 22.5.0

Prettier Extension Version:

9.19.0

OS and version:
macOS Ventura 13.4.1 (22F82)

@Tri125
Copy link

Tri125 commented Jul 25, 2023

The extension is still using prettier 2.8.8 with the defaults configuration from that version. The default value of trailingComma was changed in prettier 3.0.0.

#3069 should fix this.

According to the Readme we should have it in version 10 of the extension.

I personally can't wait, in our project we don't create a config file because we rely on the default provided by prettier.
At the moment we are in a situation where the extension run with it's own internal outdated config while our CI tools runs with the default from prettier 3, conflicting with each others.

@github-actions
Copy link

This issue has been labeled as stale due to inactivity. Reply to keep this issue open.

@github-actions github-actions bot added the Stale label Sep 24, 2023
@ghost
Copy link
Author

ghost commented Sep 24, 2023

For some strange reason, even considering @Tri125 comment, I have everything working as it should, latest version of the extension: v10.1.0, there is no trailingComma parameter in the config, but the plugin puts a comma after function parameters if they look like multilines.

@github-actions github-actions bot removed the Stale label Sep 25, 2023
@vzvu3k6k
Copy link

vzvu3k6k commented Nov 8, 2023

#3069 has been reverted in v10.1.0, reverting back to prettier 2.x (changelog). And the extension's default value of trailingComma has been also reverted from all to es5 as it is in prettier 2.x (commit).

But as kergian says, placing a .prettierrc prevents the extension's prettier setting to be used.

It works even though the .prettierrc has no entries (it requires {} - an empty file won't work). The implementation only falls back to the extension's Prettier options if no config file exists (PrettierEditService.ts#L528) as README says.

Copy link

github-actions bot commented Jan 8, 2024

This issue has been labeled as stale due to inactivity. Reply to keep this issue open.

@github-actions github-actions bot added the Stale label Jan 8, 2024
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Jan 15, 2024
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot added the locked Please open a new issue and fill out the template instead of commenting. label Apr 15, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 15, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
locked Please open a new issue and fill out the template instead of commenting. Stale
Projects
None yet
Development

No branches or pull requests

2 participants