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

Inconsistent formatting of long arguments with inline types (cli vs. vscode) #3135

Closed
peterhirn opened this issue Sep 1, 2023 · 2 comments
Closed
Labels
locked Please open a new issue and fill out the template instead of commenting.

Comments

@peterhirn
Copy link

Summary

I discovered inconsistent formatting between vscode and cli when using long arguments with inline type declarations.

Github Repository to Reproduce Issue

see below

Steps To Reproduce:

prettier.config.js

export default {
  semi: false,
  trailingComma: "none",
  singleQuote: false,
  printWidth: 90,
  endOfLine: "auto",
  tailwindFunctions: ["cva", "cx"],
  tabWidth: 2,
  useTabs: false,
  plugins: ["prettier-plugin-tailwindcss"],
};

Formatted with vscode

export const FooBarComponent = (
  props: {
    structure: string
    asset: string
    onClose: () => void
  }
) => {
  console.log("f")
}

Formatted with pnpm prettier -w .\src\foo.tsx

export const FooBarComponent = (props: {
  structure: string
  asset: string
  onClose: () => void
}) => {
  console.log("f")
}

Expected result

Formatting should be identical.

Actual result

Inconsistent, see above.

Additional information

VS Code Version:
Version: 1.81.1 (user setup)
Commit: 6c3e3dba23e8fadc360aed75ce363ba185c49794
Date: 2023-08-09T22:22:42.175Z
Electron: 22.3.18
ElectronBuildId: 22689846
Chromium: 108.0.5359.215
Node.js: 16.17.1
V8: 10.8.168.25-electron.0
OS: Windows_NT x64 10.0.19044

Prettier Extension Version: v10.1.0

OS and version: Windows 10

pnpm prettier -v
3.0.1

Prettier Log Output

["INFO" - 2:24:14 PM] Using config file at 'c:\project\prettier.config.js'
["INFO" - 2:24:17 PM] Formatting file:///c%3A/project/src/foo.tsx
["DEBUG" - 2:24:17 PM] Local prettier module path: 'c:\Users\User\Documents\node_modules\prettier\index.cjs'
["INFO" - 2:24:17 PM] Using config file at 'c:\project\prettier.config.js'
["DEBUG" - 2:24:17 PM] Local prettier module path: 'c:\Users\User\Documents\node_modules\prettier\index.cjs'
["INFO" - 2:24:17 PM] PrettierInstance:
{
  "modulePath": "c:\\Users\\User\\Documents\\node_modules\\prettier\\index.cjs",
  "importResolver": {},
  "callMethodResolvers": {},
  "currentCallMethodId": 80,
  "version": "3.0.0"
}
["INFO" - 2:24:17 PM] Using ignore file (if present) at c:\project\.prettierignore
["INFO" - 2:24:17 PM] File Info:
{
  "ignored": false,
  "inferredParser": "typescript"
}
["INFO" - 2:24:17 PM] Detected local configuration (i.e. .prettierrc or .editorconfig), VS Code configuration will not be used
["INFO" - 2:24:17 PM] Prettier Options:
{
  "filepath": "c:\\project\\src\\foo.tsx",
  "parser": "typescript",
  "semi": false,
  "trailingComma": "none",
  "singleQuote": false,
  "printWidth": 90,
  "endOfLine": "auto",
  "tailwindFunctions": [
    "cva",
    "cx"
  ],
  "tabWidth": 2,
  "useTabs": false,
  "plugins": [
    "C:\\project\\node_modules\\.pnpm\\[email protected][email protected]\\node_modules\\prettier-plugin-tailwindcss\\dist\\index.mjs"
  ]
}
["INFO" - 2:24:17 PM] Formatting completed in 61ms.
@peterhirn
Copy link
Author

Never mind, I was accidentally using a global prettier instance. Everything is working as expected.

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 Dec 12, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 12, 2023
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.
Projects
None yet
Development

No branches or pull requests

1 participant