vscode-prettier doesn't format according to defaults in prettier@2.0.2
See original GitHub issueSummary
vscode-prettier doesn’t format according to defaults for prettier@2.0.2
Github Repository to Reproduce Issue
https://github.com/trivikr/prettier-vscode-test
Steps To Reproduce:
- Clone the repo, and open it in VSCode
- Install prettier-vscode extension v3.20.0
- Run
yarn
to install dependencies - Open index.js, and add trailingComma at the end of array
Expected result
prettier-vscode should retain trailingComma as per prettier@2 defaults (link)
Actual result
prettier-vscode removes trailingComma
Additional information
Recording
VS Code Version: Version: 1.43.2 Commit: 0ba0ca52957102ca3527cf479571617f0de6ed50 Date: 2020-03-24T07:34:57.037Z Electron: 7.1.11 Chrome: 78.0.3904.130 Node.js: 12.8.1 V8: 7.8.279.23-electron.0 OS: Darwin x64 18.7.0
Prettier Extension Version: Extension Name: “prettier-vscode”. Extension Version: “3.20.0”.
OS and version: macOS 10.14.6 (18G4032)
Prettier Log Output
LOGS
["INFO" - 9:21:13 AM] Extension Name: "prettier-vscode".
["INFO" - 9:21:13 AM] Extension Version: "3.20.0".
["INFO" - 9:21:13 AM] Loaded module 'prettier@2.0.2' from '/Users/trivikr/workspace/prettier-vscode-test/node_modules/prettier/index.js'
["INFO" - 9:21:13 AM] Enabling prettier for languages
[
"css",
"graphql",
"html",
"javascript",
"javascriptreact",
"json",
"json5",
"jsonc",
"less",
"markdown",
"mdx",
"mongo",
"postcss",
"scss",
"typescript",
"typescriptreact",
"vue",
"yaml"
]
["INFO" - 9:21:13 AM] Enabling prettier for range supported languages
[
"graphql",
"javascript",
"javascriptreact",
"json",
"typescript",
"typescriptreact"
]
["INFO" - 9:21:38 AM] Formatting /Users/trivikr/workspace/prettier-vscode-test/index.js
["INFO" - 9:21:38 AM] Using ignore file (if present) at /Users/trivikr/workspace/prettier-vscode-test/.prettierignore
["INFO" - 9:21:38 AM] Loaded module 'prettier@2.0.2' from '/Users/trivikr/workspace/prettier-vscode-test/node_modules/prettier/index.js'
["INFO" - 9:21:38 AM] File Info:
{
"ignored": false,
"inferredParser": "babel"
}
["INFO" - 9:21:38 AM] No local configuration (i.e. .prettierrc or .editorconfig) detected, falling back to VS Code configuration
["INFO" - 9:21:38 AM] Prettier Options:
{
"arrowParens": "avoid",
"bracketSpacing": true,
"endOfLine": "auto",
"htmlWhitespaceSensitivity": "css",
"insertPragma": false,
"jsxBracketSameLine": false,
"jsxSingleQuote": false,
"printWidth": 80,
"proseWrap": "preserve",
"quoteProps": "as-needed",
"requirePragma": false,
"semi": true,
"singleQuote": false,
"tabWidth": 2,
"trailingComma": "none",
"useTabs": false,
"vueIndentScriptAndStyle": false,
"filepath": "/Users/trivikr/workspace/prettier-vscode-test/index.js",
"parser": "babel"
}
["INFO" - 9:21:39 AM] Formatting completed in 56.96916ms.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:6 (1 by maintainers)
Top Results From Across the Web
prettier-vscode@4.0.0 uses prettier@2.x config by default #1290
prettier-config should use default config for the prettier version ... vscode-prettier doesn't format according to defaults in prettier@2.0.2 #1285.
Read more >Why does Prettier not format code in VS Code? - Stack Overflow
Select File -> Preferences -> Settings ( Ctrl + comma ) and search form formatter; Set Prettiers as Default formatter. enter image ...
Read more >Options - Prettier
Prettier's printWidth option does not work the same way. It is not the hard upper allowed line length limit. It is a way...
Read more >How To Format Code with Prettier in Visual Studio Code
In the command palette, search for format and then choose Format Document. Then choose Prettier - Code Formatter.
Read more >Prettier - Code formatter - Visual Studio Marketplace
Prettier Formatter for Visual Studio Code. Prettier is an opinionated code formatter. It enforces a consistent style by parsing your code ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This issue is fixed by #1272 (already merged ATM, waiting for release) and is a possible duplicate of #1275 .
I still think the question on relying on
prettier
defaults w/o a configuration file still stands 😉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.