Prettier formatting not working for typescript

I’ve hunted down the forum and configuration files - works fine in Vscode but prettier can’t seem to format anything at all.

did you find a solution

Same for me, no auto formatting in cursor

Works for me… did you make sure to configure it as the Default Code Formatter for Typescript and ensure you select the correct Typescript version.

2 Likes

when I save it should fix all the indentation, and remove all ‘;’ like with my vscode setup on the same project, its very annoying

I fixed, just installed Prettier ESLint from rvest, and add in settings.json:

{
  "editor.defaultFormatter": "rvest.vs-code-prettier-eslint",
  "editor.formatOnType": false, // required
  "editor.formatOnPaste": true, // optional
  "editor.formatOnSave": true, // optional
  "editor.formatOnSaveMode": "file", // required to format on save
  "files.autoSave": "onFocusChange", // optional but recommended
  "vs-code-prettier-eslint.prettierLast": false // set as "true" to run 'prettier' last not first
}
1 Like

This is how I set my Cursor up to use both Prettier for multiple languages and Rust Analyzer for my Rust Backend.

{
  "window.commandCenter": true,
  "cursor.chat.premiumChatAutoScrollWhenAtBottom": true,
  "workbench.colorTheme": "One Dark Pro Night Flat",
  "files.autoSave": "onFocusChange",
  "files.autoSaveDelay": 500,
  "workbench.editor.closeOnFileDelete": false,
  "files.hotExit": "off",
  "window.confirmBeforeClose": "always",
  "cursor.composer.shouldAllowCustomModes": true,
  "cursor.composer.collapsePaneInputBoxPills": true,
  "cursor.terminal.usePreviewBox": true,
  "roo-cline.allowedCommands": [
    "npm test",
    "npm install",
    "tsc",
    "git log",
    "git diff",
    "git show"
  ],
  "update.releaseTrack": "prerelease",
  "diffEditor.maxComputationTime": 0,
  "editor.formatOnSave": true,
  "editor.codeActionsOnSave": {
    "source.formatDocument": "explicit"
  },
  "editor.defaultFormatter": "esbenp.prettier-vscode",
  "[json]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode",
    "editor.formatOnSave": true
  },
  "cursor.composer.textSizeScale": 1.15,
  "[typescript]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode",
    "editor.formatOnSave": true
  },
  "[javascript]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode",
    "editor.formatOnSave": true
  },
  "[vue]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode",
    "editor.formatOnSave": true
  },
  "[html]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode",
    "editor.formatOnSave": true
  },
  "[css]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode",
    "editor.formatOnSave": true
  },
  "[scss]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode",
    "editor.formatOnSave": true
  },
  "[markdown]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode",
    "editor.formatOnSave": true
  },
  "[rust]": {
    "editor.defaultFormatter": "rust-lang.rust-analyzer",
    "editor.formatOnSave": true
  },
  "rusty.rustfmtPath": "/home/cpyrighted/.cargo/bin/rustfmt",
  "prettier.singleQuote": true,
  "prettier.semi": false,
  "prettier.printWidth": 100,
  "prettier.requireConfig": false,
  "rust-analyzer.linkedProjects": [
    "/mnt/SStorage/Projects/Sync-Apps/Sync-DB/Test-Versions/0.0.5/ui/src-tauri/Cargo.toml"
  ]
}

1 Like

Amazing Mate, thanks for the share

1 Like