🌐
Prettier
prettier.io
Prettier · Opinionated Code Formatter · Prettier
Try It OnlineInstall Prettier · Limited edition tshirts are now available to buy! $10 per tshirt goes to maintain the project. An opinionated code formatter · Supports many languages · Integrates with most editors · Has few options » · Your code is formatted on save ·
Blog
We're excited to announce that Prettier now fully supports the fresh features landing in Angular v21.1 (released today 🎉)! This update brings cleaner, more expressive templates with: Consecutive @case statements in @switch blocks. Spread elements (...) in array literals, object literals, and function calls inside templates. We've also added the ability to format ...
Options · Prettier
Setting max_line_length in an .editorconfig file will configure Prettier’s print width, unless overridden. (If you don’t want line wrapping when formatting Markdown, you can set the Prose Wrap option to disable it.)
Configuration File
A .prettierrc.toml file. ... The configuration file will be resolved starting from the location of the file being formatted, and searching up the file tree until a config file is (or isn’t) found.
🌐
GitHub
github.com › prettier › prettier
GitHub - prettier/prettier: Prettier is an opinionated code formatter. · GitHub
Prettier is an opinionated code formatter. Contribute to prettier/prettier development by creating an account on GitHub.
Starred by 51.8K users
Forked by 4.7K users
Languages   JavaScript 83.3% | TypeScript 6.2% | CSS 3.0% | HTML 3.0% | SCSS 1.5% | Less 1.0%
Discussions

Is using Prettier to format code bad.
It sounds to me though that you formatted some huge file that wasn't previously formatted with prettier (vs your own changes) And that is annoying af. Just incredibly noisy if it's a bug fix. Propose your refactor but do it outside of a bug fix. More on reddit.com
🌐 r/Frontend
120
99
May 23, 2023
How to make "Prettier" the default formatter in VS Code? - Stack Overflow
I've installed Prettier extension in VS Code, and when I attempt to format a file, VS Code asked me: Do you want to format with the default formatter or with prettier formatter? I accidentally ch... More on stackoverflow.com
🌐 stackoverflow.com
How to format selected code using vscode and Prettier? - Stack Overflow
Linters usually contain not only code quality rules, but also stylistic rules. Most stylistic rules are unnecessary when using Prettier, but worse – they might conflict with Prettier! Use Prettier for code formatting concerns, and linters for code-quality concerns, as outlined in Prettier vs. More on stackoverflow.com
🌐 stackoverflow.com
Those who stopped using prettier , why ?
What are you having troubles with? The only complaints I've heard about it is that it is too opinionated More on reddit.com
🌐 r/webdev
215
146
February 1, 2024
🌐
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-format
prettier-format - npm
September 8, 2023 - auto load config and run prettier on code. Latest version: 4.0.0, last published: 3 years ago. Start using prettier-format in your project by running `npm i prettier-format`. There are 4 other projects in the npm registry using prettier-format.
      » npm install prettier-format
    
Published   Sep 08, 2023
Version   4.0.0
Author   fisker Cheung
🌐
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!

🌐
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 - Maintaining consistent code formatting is essential for readability, collaboration, and reducing unnecessary diffs in version control. Instead of manually enforcing style rules or debating formatting choices in code reviews, you can automate the process using a tool like Prettier - a popular, opinionated code formatter.
🌐
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.
🌐
Snyk
snyk.io › advisor › prettier › functions › prettier.format
How to use the prettier.format function in prettier | Snyk
November 24, 2025 - complexTypeDefinitions.map(async structureDefinition => { const filename = `${structureDefinition.name.toLowerCase()}.profile.canonical.json`; return writeFileAsync( `../structure-definitions/${version}/${filename}`, format(JSON.stringify(structureDefinition), { parser: "json" }) ).then(() => { // tslint:disable-next-line:no-console console.log(`Downloaded ${structureDefinition.name}`); }); }) ); graphprotocol / graph-cli / src / type-generator.js View on Github · async spinner => { // Generate TypeScript module from schema let codeGenerator = schema.codeGenerator() let code = prettier.format
Find elsewhere
🌐
Prettier
prettier.io › docs › options
Options · Prettier
These two options can be used to format code starting and ending at a given character offset (inclusive and exclusive, respectively). The range will extend: Backwards to the start of the first line containing the selected statement. Forwards to the end of the selected statement. Specify which parser to use. Prettier automatically infers the parser from the input file path, so you shouldn’t have to change this setting.
🌐
GeeksforGeeks
geeksforgeeks.org › installation guide › formatting-code-with-prettier
Formatting code with Prettier - GeeksforGeeks
July 23, 2025 - Prettier is an opinionated code formatter that will take all your code, remove the inconsistency in the codebase in styling the code, and ensure the output code is formatted in the desired pattern by using the predefined styles in prettier.
🌐
LazyVim
lazyvim.org › ⭐ extras › prettier
Prettier | LazyVim
{ "stevearc/conform.nvim", optional = true, ---@param opts ConformOpts opts = function(_, opts) opts.formatters_by_ft = opts.formatters_by_ft or {} for _, ft in ipairs(supported) do opts.formatters_by_ft[ft] = opts.formatters_by_ft[ft] or {} table.insert(opts.formatters_by_ft[ft], "prettier") end opts.formatters = opts.formatters or {} opts.formatters.prettier = { condition = function(_, ctx) return M.has_parser(ctx) and (vim.g.lazyvim_prettier_needs_config ~= true or M.has_config(ctx)) end, } end, }
Top answer
1 of 3
3

I dont know the solution yet, but there are some info that may help.

  • Basically, there are something wrong with the linter. ( https://github.com/prettier/prettier-vscode/issues/137 )

    And your may fix it by checking out this https://prettier.io/docs/en/integrating-with-linters.html ,

  • I dont know how & didnt try. cuz:: [[
    • looks complicated (download many things) & mess up with the project structure
    • may not even work
    • some info I have no knowledge of / incompatible with my understanding
    • dont know what will happen to my linters
    • dont know what is the next step

[]

https://github.com/prettier/prettier-vscode/issues/134

[]

No, the issue is with prettier-eslint not supporting range formatting.

...

I would suggest switching to the recommended approach of integrating ESLint and Prettier

https://github.com/prettier/prettier-vscode/issues/137

[]

let Prettier do the formatting and configure the linter to not deal with formatting rules. You can find instructions on how to configure each linter on the Prettier docs site.

...

For details refer to the Prettier documentation.

https://github.com/prettier/prettier-vscode#linter-integration

[]

Linters usually contain not only code quality rules, but also stylistic rules. Most stylistic rules are unnecessary when using Prettier, but worse – they might conflict with Prettier! Use Prettier for code formatting concerns, and linters for code-quality concerns, as outlined in Prettier vs. Linters.

Luckily it’s easy to turn off rules that conflict or are unnecessary with Prettier, by using these pre-made configs:

  • eslint-config-prettier

  • stylelint-config-prettier

https://prettier.io/docs/en/integrating-with-linters.html

[]

I would like to format my code with prettier, then apply all eslint fixes. Previously, this could be achieved by setting prettier.eslintIntegration to true. Now, the extension say that this option is [DEPRECTAED] and prettier-eslint should be used instead. However, it's not clear how to use prettier-eslint in vscode.

https://github.com/prettier/prettier-vscode/issues/999


Actually, "format only selected code" is working on my end, I didnt do any fancy extra config.

  • What you need to pay attention to is the "syntax tree"

    -- ie: dont blindly select across the scope (the bracket {}).

    @eg::

    • given

      function test() {
        let a = [1, 2, 3,          4];
      
        let b = [          1,2 ,3,4]; // select only this line
      
        return false
      }
      
    • if you only select::

      let b = [          1,2 ,3,4];
      

      then press ctrl+k, ctrl+f

      everything is fine

    • if you select across the bracket (the } for function scope)::

        let b = [          1,2 ,3,4]; // select only this line
      
        return false
      }
      

      then press ctrl+k, ctrl+f

      the whole thing in the bracket (the } for function scope) gets formatted

  • the "syntax tree" in a class is a bit weird.

    -- ie: if you select the WHOLE function AA & format it -- codes inside another function BB will also get formatted...

    you may need to apply // prettier-ignore somewhere to prevent formatting

  • prettier-ignore

    A JavaScript comment of // prettier-ignore will exclude the next node in the abstract syntax tree from formatting.

    https://prettier.io/docs/en/ignore.html

    • (note, it seems there is no ending tag for // prettier-ignore for Javascript (at current stage of Prettier))

    • for the meaning of a "syntax tree", see ex below

      • if you place it above the code line
        seems it applies to the item (the code) (-- which is a "syntax tree node") directly below ((empty lines not counted for)) the // prettier-ignore line
        -- eg-below: console.log("show a", a);, and ends there.

      • if you place it behind the code line (inline)
        seems it applies to the inline code only

  • @for_your_case-do_this:

    const test = (a, b,          c) => {  
      // prettier-ignore
      console.log("show a",          a);  
      // prettier-ignore
      console.log("show b",     b);  
    }
    
    // or
    const test = (a, b,          c) => {  
      console.log("show a",          a); // prettier-ignore
      console.log("show b",     b); // prettier-ignore
    }
    
2 of 3
2

Select the code or leave the cursor in the row you want to format and press Ctrl + K Ctrl + F.

🌐
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 - Writing clean, consistent, and readable code is crucial for maintaining a high-quality codebase. Prettier is a powerful code formatter that helps developers achieve this by automatically formatting their code according to a set of predefined rules.
🌐
GoodRequest
goodrequest.com › blog › code-formatting-using-the-prettier-tool
How to format code with Prettier tool step-by-step guide | GoodRequest
July 14, 2023 - If you want automatic formatting for the "on save" action, you need to set the IDE that you use when developing through their settings. I will show you how to set up a webstorm and visual studio code. ... As I mentioned above, prettier provides easy auto-formatting options and settings that keep the code consistent, so you avoid problems and save time, so I definitely recommend it.
🌐
Codux
help.codux.com › home › all topics › codux editor › using prettier to format code
Using Prettier to Format Code - Codux Knowledge Base
Prettier is a code formatting tool that makes your code more readable, consistent, and easier to maintain. It takes messy, unformatted code and formats it in an aesthetically pleasing manner while also keeping the structure intact.
🌐
JetBrains
jetbrains.com › help › idea › prettier.html
Prettier | IntelliJ IDEA Documentation
Prettier is a tool to format files in various languages, like TypeScript, JavaScript, CSS, HTML, JSON, and others. With IntelliJ IDEA, you can format selected code fragments as well as entire files or directories using the Reformat with Prettier ...
🌐
Prettier
prettier.io › docs
What is Prettier? · Prettier
Prettier enforces a consistent code style (i.e. code formatting that won’t affect the AST) across your entire codebase because it disregards the original styling* by parsing it away and re-printing the parsed AST with its own rules that take the maximum line length into account, wrapping code when necessary.
🌐
npm
npmjs.com › package › prettier
prettier - npm
January 21, 2026 - Prettier is an opinionated code formatter. Latest version: 3.8.1, last published: 2 months ago. Start using prettier in your project by running `npm i prettier`. There are 20208 other projects in the npm registry using prettier.
      » npm install prettier
    
Published   Jan 21, 2026
Version   3.8.1
Author   James Long
🌐
DEV Community
dev.to › shieldstring › how-to-set-up-prettier-code-formatter-4a2f
How to Set Up Prettier – Code Formatter - DEV Community
September 22, 2024 - Prettier is an opinionated code formatter that helps ensure your code is clean, consistent, and easy to read. It supports a wide range of languages, including JavaScript, TypeScript, HTML, CSS, JSON, and more.