Open sgehrman opened 3 years ago
I ran into a similar issue. I think the problem is with the VS Code Prettier extension resolving your prettier config file. Prettier uses cosmic config which allows you to define your prettier config in lots of ways. However prettier-vscode is only looking for .prettierrc or .editorconfig
config files. So if you aren't using one of those prettier-vscode falls back to their settings. I fixed this by configuring prettier with a .prettierrc
file.
Well it looks like it should support more config formats https://github.com/prettier/prettier-vscode/blob/3c80018d69fa129fed638f624404e728870e4a90/src/PrettierEditService.ts#L32 but I had issues when it was defined as a prettier.config.js
file
This might be the same thing as https://github.com/azz/pretty-quick/issues/95
Not sure to understand what's the issue.
A minimal but runnable online reproduction is required.
Hi !
I have a similar issue.
I am using pretty-quick and VsCode on a Vue.js project.
I've enabled the "format on save" option.
However, when I save, it formats the file differently than when formatting with npx pretty-quick
.
I think maybe it's because VsCode can't find the Prettier configuration file
Here is my package.json
file:
{
"name": "xxx",
"version": "0.3.20-0",
"private": true,
"scripts": {
"serve": "vite",
"build": "vite build",
"preview": "vite preview",
"prepare": "husky",
"lint": "prettier --check .",
"fix": "prettier --write ."
},
"dependencies": {
"@oruga-ui/oruga-next": "~0.7.0",
"keycloak-js": "~25.0.4",
"vue": "~3.5.8",
"vue-router": "~4.4.5",
},
"devDependencies": {
"@tsconfig/node18": "^18.2.4",
"@types/node": "^18.18.5",
"@vitejs/plugin-vue": "^4.6.2",
"@vue/tsconfig": "~0.5.1",
"autoprefixer": "^10.4.20",
"husky": "^9.1.6",
"postcss": "^8.4.47",
"postcss-grid-kiss": "^3.1.0",
"postcss-loader": "^8.1.1",
"postcss-nested": "^6.2.0",
"postcss-nesting": "^13.0.0",
"postcss-simple-vars": "^7.0.1",
"prettier": "^3.3.3",
"pretty-quick": "^4.0.0",
"tslint-config-prettier": "^1.18.0",
"typescript": "~5.2.0",
"vite": "^4.5.5",
"vite-plugin-webpackchunkname": "^0.2.4",
"vue-tsc": "^2.1.6",
"webpack": "^5.95.0"
}
}
On some files, I lint, format and save in VSCode, but then on push, husky runs pretty-quick and formats some files differently that make it fail the eslint check on push that comes after it when it checks the prettier rules.