prettier-vscode@4.0.0 uses prettier@2.x config by default
See original GitHub issueSummary
prettier-vscode@4.0.0 uses prettier@2.x config by default
Github Repository to Reproduce Issue
https://github.com/trivikr/prettier-vscode-4-test
Steps To Reproduce:
- Clone this repo, and open it in VSCode
- Install prettier-vscode extension v4.0.0
- Run
yarn
to install dependencies - Open index.js, and remove trailingComma from the end of array
- Notice that prettier-vscode extension adds the trailingComma on Save
Expected result
prettier-config should use default config for the prettier version installed in the workspace
Actual result
prettier-vscode@4.0.0 uses prettier 2 config.
Screen recording
Additional information
Issue in which prettier 2 config was not used with prettier-vscode@3.20.0: https://github.com/prettier/prettier-vscode/issues/1285
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: “4.0.0”.
OS and version: macOS 10.14.6 (18G4032)
Prettier Log Output
Details
["INFO" - 8:38:54 AM] Extension Name: "prettier-vscode".
["INFO" - 8:38:54 AM] Extension Version: "4.0.0".
["INFO" - 8:38:54 AM] Loaded module 'prettier@1.19.1' from '/Users/trivikr/workspace/prettier-vscode-test/node_modules/prettier/index.js'
["INFO" - 8:38:54 AM] Enabling prettier for languages
[
"css",
"graphql",
"html",
"javascript",
"javascriptreact",
"json",
"json5",
"jsonc",
"less",
"markdown",
"mdx",
"mongo",
"postcss",
"scss",
"typescript",
"typescriptreact",
"vue",
"yaml"
]
["INFO" - 8:38:54 AM] Enabling prettier for range supported languages
[
"graphql",
"javascript",
"javascriptreact",
"json",
"typescript",
"typescriptreact"
]
["INFO" - 8:38:57 AM] Formatting /Users/trivikr/workspace/prettier-vscode-test/index.js
["INFO" - 8:38:57 AM] Using ignore file (if present) at /Users/trivikr/workspace/prettier-vscode-test/.prettierignore
["INFO" - 8:38:57 AM] Loaded module 'prettier@1.19.1' from '/Users/trivikr/workspace/prettier-vscode-test/node_modules/prettier/index.js'
["INFO" - 8:38:57 AM] File Info:
{
"ignored": false,
"inferredParser": "babel"
}
["INFO" - 8:38:57 AM] No local configuration (i.e. .prettierrc or .editorconfig) detected, falling back to VS Code configuration
["INFO" - 8:38:57 AM] Prettier Options:
{
"arrowParens": "always",
"bracketSpacing": true,
"endOfLine": "lf",
"htmlWhitespaceSensitivity": "css",
"insertPragma": false,
"jsxBracketSameLine": false,
"jsxSingleQuote": false,
"printWidth": 80,
"proseWrap": "preserve",
"quoteProps": "as-needed",
"requirePragma": false,
"semi": true,
"singleQuote": false,
"tabWidth": 2,
"trailingComma": "es5",
"useTabs": false,
"vueIndentScriptAndStyle": false,
"filepath": "/Users/trivikr/workspace/prettier-vscode-test/index.js",
"parser": "babel"
}
["INFO" - 8:38:57 AM] Formatting completed in 31.578346ms.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:15
- Comments:28 (11 by maintainers)
Top Results From Across the Web
Options - Prettier
Ensure Prettier's endOfLine option is set to lf (this is a default value since v2.0.0); Configure a pre-commit hook that will run Prettier;...
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
We recommend you use your own configuration file in your project. When a configuration file is present, it will be used. The prettier configuration in the extension is always going to default to the version of prettier installed with the extension - now that is 2.0. You should include a
.prettierrc
file in your project to maintain control over the settings you would like.If you’re using prettier@1.19.1 in your projects, the fix is to manually install version 3.20.0 as shown in the screenshot below
SCREENSHOT