I have solved this issue by fixing my setting.json file.

I just make editor.formateOnSave: true for individual language. Like this way

    "[javascript]": {
        "editor.formatOnSave": true,
        "editor.defaultFormatter": "esbenp.prettier-vscode"
    },
    "[javascriptreact]": {
        "editor.formatOnSave": true,
        "editor.defaultFormatter": "esbenp.prettier-vscode"
    },
    "[typescript]": {
        "editor.formatOnSave": true,
        "editor.defaultFormatter": "esbenp.prettier-vscode"
    },

This works for me.

Another solution was running prettier command. prettier --write \"src/**/*.ts\" \"test/**/*.ts\"

But for using this command according to my .prettierrc and .eslintrc file you have to ensure some packages as the dev dependency.

  • prettier
  • eslint
  • @trivago/prettier-plugin-sort-imports
  • @typescript-eslint/eslint-plugin
  • @typescript-eslint/parser
  • eslint-config-prettier
  • eslint-plugin-import
  • eslint-plugin-prettier
  • eslint-plugin-simple-import-sort

Most of the packages come from the nest js boilerplate. If you have not found any package from the boilerplate then install by yourself.

Hopefully, this will be a great solution for those, who are facing this kind of problem like me. Have a good day!

Answer from Asif Jalil on Stack Overflow
🌐
Prettier
prettier.io
Prettier · Opinionated Code Formatter · Prettier
More than 83% of respondents to State of JS 2021.
Blog
If you appreciate Prettier and would like to support our work, please consider sponsoring us directly via our OpenCollective or by sponsoring the projects we depend on, such as typescript-eslint, remark, and Babel. Thank you for your continued support! ... This release includes new features such as adding a JSONC ...
Options · Prettier
Note that Prettier never unquotes ... languages. See: Angular, TypeScript, Flow. Also Prettier doesn’t unquote numeric properties for Vue (see the issue about that). Use single quotes instead of double quotes in JSX....
Configuration File
Otherwise, Prettier wouldn’t be able to guarantee that everybody in a team gets the same consistent results. The options you can use in the configuration file are the same as the API options. TypeScript support requires Node.js>=22.6.0, and --experimental-strip-types is required before Node.js ...
🌐
GitHub
github.com › prettier › prettier
GitHub - prettier/prettier: Prettier is an opinionated code formatter. · GitHub
JavaScript · TypeScript · Flow · JSX · JSON CSS · SCSS · Less HTML · Vue · Angular GraphQL · Markdown · YAML Your favorite language? Prettier is an opinionated code formatter.
Author   prettier
Discussions

typescript - Code formatting with prettier is not working in nest js - Stack Overflow
I am using Visual Studio Code. In my Nest JS project, the code is not formatting according to prettier rules. I already set .prettierrc and .eslintrc. Also i have set formatOnSave: true from the se... More on stackoverflow.com
🌐 stackoverflow.com
How to run prettier in browser to format code? e.g. inside ReactJs app - Stack Overflow
22 What is Prettier keyboard shortcut command in VS Code to format only a block of React code, not just format on file autosave? 0 How to fix JSX/React formatting issue with Prettier in VSCode More on stackoverflow.com
🌐 stackoverflow.com
Prettier on JS, TS, JSX, TSX Help
https://github.com/helix-editor/helix/wiki/External-binary-formatter-configuration#prettier More on reddit.com
🌐 r/HelixEditor
2
7
October 1, 2022
Prettier removing camelCasing from css-in-js?

I've been wanting to use camelCase in my cssjs code too for some time.

I like react css convensions and I've used this for a while, and when I moved to jss (which is like emotion) I've used react conventions in my code as well using their library require('react/lib/CSSPropertyOperations');.

Hope it helps

More on reddit.com
🌐 r/javascript
6
7
May 12, 2016
🌐
Reddit
reddit.com › r/frontend › is using prettier to format code bad.
r/Frontend on Reddit: Is using Prettier to format code bad.
May 23, 2023 -

Recently joined a agency as an Contract React developer. I was assigned a task to edit some inline Scss code.

Being a Prettier user I formatted the code, made the necessary changes and submitted a pull request.

Next day the senior developer reviewed my code and asked me to stop using Prettier and assigned me a task to change back the Scss code manually to inline Scss.

When I asked why should I not use prettier to format code. He said it's bad and time consuming and other team members started telling me a story how one time prettier wasn't working and started throwing errors.

That's why they never use it.

I wanted to say that It was showing error because you were doing something wrong.

Just because you once had an bad experience doesn't mean it's bad.

Plus they use one big single Scss file for the whole project.

When I question it too and asked them to use separate files and how it can effect the performance.

One team member answered it doesn't matter, how they don't care about the performance and I should be open minded and learn from them. The boss has 18 years of experience.

What should I learn why not to follow good practices!

🌐
Visual Studio Marketplace
marketplace.visualstudio.com › items
Prettier - Code formatter - Visual Studio Marketplace
January 21, 2026 - Extension for Visual Studio Code - Code formatter using prettier
🌐
npm
npmjs.com › package › prettier
prettier - npm
January 21, 2026 - Prettier is an opinionated code formatter. Latest version: 3.8.1, last published: a month ago. Start using prettier in your project by running `npm i prettier`. There are 20147 other projects in the npm registry using prettier.
      » npm install prettier
    
Published   Jan 21, 2026
Version   3.8.1
Author   James Long
🌐
Beautifier
beautifier.io
Online JavaScript beautifier
Chrome, in case the built-in CSS and javascript formatting isn't enough for you: — Quick source viewer by Tomi Mickelsson (github, blog), — Javascript and CSS Code beautifier by c7sky, — jsbeautify-for-chrome by Tom Rix (github), — Pretty Beautiful JavaScript by Will McSweeney — Stackoverflow Code Beautify by Making Odd Edit Studios (github).
Find elsewhere
🌐
JetBrains
jetbrains.com › help › webstorm › prettier.html
Prettier | WebStorm Documentation
Prettier is a tool to format files in various languages, like TypeScript, JavaScript, CSS, HTML, JSON, and others. With WebStorm, you can format selected code fragments as well as entire files or directories using the Reformat with Prettier action.
🌐
GeeksforGeeks
geeksforgeeks.org › typescript › how-to-set-up-prettier-in-your-javascript-typescript-project
How to Set Up Prettier in Your JavaScript/TypeScript Project? - GeeksforGeeks
July 23, 2025 - npm install --save-dev eslint-config-prettier eslint-plugin-prettier · Next, update your ESLint configuration (.eslintrc.json or .eslintrc.js) to include Prettier:
🌐
DigitalOcean
digitalocean.com › community › tutorials › how-to-format-code-with-prettier-in-visual-studio-code
Format Code with Prettier in Visual Studio Code: Setup Guide | DigitalOcean
August 1, 2025 - Prettier extension for VS Code: You’ll install it from the Extensions Marketplace later in the tutorial. Node.js and npm (optional but recommended): Required if you want to install Prettier as a local or global package via the command line.
Top answer
1 of 6
8

I have solved this issue by fixing my setting.json file.

I just make editor.formateOnSave: true for individual language. Like this way

    "[javascript]": {
        "editor.formatOnSave": true,
        "editor.defaultFormatter": "esbenp.prettier-vscode"
    },
    "[javascriptreact]": {
        "editor.formatOnSave": true,
        "editor.defaultFormatter": "esbenp.prettier-vscode"
    },
    "[typescript]": {
        "editor.formatOnSave": true,
        "editor.defaultFormatter": "esbenp.prettier-vscode"
    },

This works for me.

Another solution was running prettier command. prettier --write \"src/**/*.ts\" \"test/**/*.ts\"

But for using this command according to my .prettierrc and .eslintrc file you have to ensure some packages as the dev dependency.

  • prettier
  • eslint
  • @trivago/prettier-plugin-sort-imports
  • @typescript-eslint/eslint-plugin
  • @typescript-eslint/parser
  • eslint-config-prettier
  • eslint-plugin-import
  • eslint-plugin-prettier
  • eslint-plugin-simple-import-sort

Most of the packages come from the nest js boilerplate. If you have not found any package from the boilerplate then install by yourself.

Hopefully, this will be a great solution for those, who are facing this kind of problem like me. Have a good day!

2 of 6
2

While I'm not sure why NestJS has the default setup the way they do (with an eslintrc.js file along with a prettierrc file, with any config you put in the prettierrc not having any impact/effect). I've found a work-around.

Prove problem (optional)

Before the steps to fix, 'prove' that the default NestJS provided prettierrc config-file is having no effect on your code by changing the default "trailingComma": "none" (the default is "all"). Now go to any of your src files and add a dangler to the last element in an object .. or create a example object and leave a trailing comma. Then format or format+save.. whatever.. Notice (at least for those of us experiencing this problem) that nothing changes and no warnings are issued from prettier.

Fix

  • First: Rename your prettierrc to prettierrc.js.
  • Next: Inside your prettierrc.js modify the default json obj to an exported object, keeping our test-trailing-comma as "none" : module.exports = {"singleQuote": true, "trailingComma": "none"}
  • Next, inside the eslintrc.js leaving all of the other defaults alone, add an import(require) at the top const prettierConfig = require('./.prettierrc.js') module.exports = { ... }
  • Then still in eslintrc.js in your rules section, add the following rule : rules: { 'prettier/prettier': [ 'error', prettierConfig ], ...} I'll attach a link to a screenshot if needed.. but you basically are importing and specifying inside eslintrc.js that you want to use the (now importable/requireable) prettierrc.js for formatting prettier rules (which you write out like you'd expect in the prettierrc.js file). You can now check your trailing commas for the lovely red-squigleys ;) eslintrc.js with prettierrc.js in vscode
🌐
Visual Studio Marketplace
marketplace.visualstudio.com › items
Prettier-Standard - JavaScript formatter - Visual Studio Marketplace
Visual Studio Code>Formatters>Prettier-Standard - JavaScript formatterNew to Visual Studio Code?
🌐
npm
npmjs.com › package › prettier-format
prettier-format - npm
September 8, 2023 - auto load config and run prettier on code · To load config and format code with prettier, you have to do · const config = await prettier.resolveConfig('path/to/file', {useCache: false}) const formatted = await prettier.format(source, {...config, semi: false}) I want it simple ·
      » npm install prettier-format
    
Published   Sep 08, 2023
Version   4.0.0
Author   fisker Cheung
🌐
JetBrains
jetbrains.com › help › rider › Prettier.html
Prettier | JetBrains Rider Documentation
November 24, 2025 - Prettier is a tool to format files in various languages, like TypeScript, JavaScript, CSS, HTML, JSON, and others. With JetBrains Rider, you can format selected code fragments as well as entire files or directories using the Reformat with Prettier ...
🌐
SourceForge
sourceforge.net › projects › prettier.mirror
Prettier download | SourceForge.net
January 22, 2026 - Prettier makes writing code in ... styles or formatting your code. Simply press save and your code is formatted. Prettier supports several languages including JavaScript, TypeScript, JSON, CSS, HTML and more....
🌐
Medium
thiraphat-ps-dev.medium.com › how-to-use-prettier-to-format-your-code-a-comprehensive-guide-6baad28c383d
How to Use Prettier to Format Your Code: A Comprehensive Guide | by Thiraphat Phutson | Medium
June 5, 2024 - name: Prettier Check on: [push, pull_request] jobs: prettier: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - name: Set up Node.js uses: actions/setup-node@v1 with: node-version: '14' - name: Install dependencies run: npm install - name: Run Prettier run: npm run format:check
🌐
JetBrains
jetbrains.com › help › pycharm › prettier.html
Prettier | PyCharm Documentation
November 24, 2025 - Prettier is a tool to format files in various languages, like TypeScript, JavaScript, CSS, HTML, JSON, and others. With PyCharm, you can format selected code fragments as well as entire files or directories using the Reformat with Prettier action.
🌐
Scott Sauber
scottsauber.com › 2017 › 06 › 10 › prettier-format-on-save-never-worry-about-formatting-javascript-again
Prettier + Format On Save = Never worry about formatting JavaScript again – Scott Sauber
June 12, 2021 - While I only mentioned JavaScript so far, technically Prettier can do more than just JavaScript. It can do CSS, LESS, SASS, TypeScript, JSX, Markdown, and more as well.
🌐
freeCodeCamp
freecodecamp.org › news › alternatives-to-prettier
Alternatives to Prettier – Popular Code Linting and Formatting Tools
March 15, 2023 - In this guide, we will talk about the Prettier code formatter. We will also talk about alternatives to Prettier like JsFmt, StandardJS, EsLint + EditorConfig, and Beautifier.
🌐
GitHub
github.com › prettier › eslint-config-prettier
GitHub - prettier/eslint-config-prettier: Turns off all rules that are unnecessary or might conflict with Prettier. · GitHub
Otherwise Prettier might reformat your code in such a way that ESLint never gets a chance to report anything (as seen in the first example). ... (The following applies to babel/quotes, @stylistic/quotes, @stylistic/js/quotes, @stylistic/ts/quotes, and @typescript-eslint/quotes as well.)
Author   prettier