🌐
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
🌐
Prettier
prettier.io › docs › install
Install · Prettier
For example, you can do the following to have Prettier run before each commit: ... npm install --save-dev husky lint-staged npx husky init node --eval "fs.writeFileSync('.husky/pre-commit','npx lint-staged\n')"
🌐
Prettier
prettier.io
Prettier · Opinionated Code Formatter · Prettier
More than 19.4k dependent packages on npmSee them all
🌐
npm
npmjs.com › package › prettier-plugin-java
prettier-plugin-java - npm
January 8, 2026 - Prettier Java Plugin. Latest version: 2.8.1, last published: 2 months ago. Start using prettier-plugin-java in your project by running `npm i prettier-plugin-java`. There are 56 other projects in the npm registry using prettier-plugin-java.
      » npm install prettier-plugin-java
    
Published   Jan 08, 2026
Version   2.8.1
🌐
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-eslint
prettier-eslint - npm
May 7, 2025 - Formats your JavaScript using prettier followed by eslint --fix. Latest version: 16.4.2, last published: 10 months ago. Start using prettier-eslint in your project by running `npm i prettier-eslint`. There are 338 other projects in the npm registry using prettier-eslint.
      » npm install prettier-eslint
    
Published   May 07, 2025
Version   16.4.2
Author   Kent C. Dodds
🌐
GitHub
btholt.github.io › complete-intro-to-react-v5 › eslint-prettier
npm, ESLint & Prettier
Either install Prettier globally npm install --global prettier or replace when I run prettier with (from the root of your project) npx prettier. From there, run prettier script.js. This will output the formatted version of your file. If you want to actually write the file, run prettier --write ...
Find elsewhere
🌐
JetBrains
jetbrains.com › help › webstorm › prettier.html
Prettier | WebStorm Documentation
For more information about plugins, refer to Managing plugins. Open the embedded Terminal (Alt+F12) . Type one of the following commands: npm install --save-dev --save-exact prettier ·
🌐
npm
npmjs.com › search
eslint-plugin-prettier - npm search
``` "eslint": "^8.9", "eslint-config-prettier": "^8.3", "eslint-formatter-codeframe": "^7.32", "eslint-plugin-babel": "^5.3", "eslint-plugin-import": "^2.25", "eslint-plugin-jsx-a11y": "^6.5", "eslint-plugin-prettier": "^4.0", "eslint-plugin-react": "^7.2
🌐
GitHub
github.com › prettier › prettier
GitHub - prettier/prettier: Prettier is an opinionated code formatter. · GitHub
Prettier can be run in your editor on-save, in a pre-commit hook, or in CI environments to ensure your codebase has a consistent style without devs ever having to post a nit-picky comment on a code review ever again!
Author   prettier
🌐
npm
npmjs.com › package › eslint-plugin-prettier
eslint-plugin-prettier - npm
January 14, 2026 - Runs prettier as an eslint rule. Latest version: 5.5.5, last published: 2 months ago. Start using eslint-plugin-prettier in your project by running `npm i eslint-plugin-prettier`. There are 8704 other projects in the npm registry using eslint-plugin-prettier.
      » npm install eslint-plugin-prettier
    
Published   Jan 14, 2026
Version   5.5.5
Author   Teddy Katz
Top answer
1 of 1
41

Functionally there is no difference, they will both work.

The VS Code extension Prettier (not Pretty Formatter, that's different) includes a recent copy of the prettier npm package inside it, which it will use by default if you don't have the package installed via npm in your repo. See the extension page's section on Prettier Resolution.

I want to use an example to illustrate why you might use npm over the extension.

Lets say you worked on a team and you wanted everyone to have the same version of prettier. It would be pretty hard to get everyone on the same version by VS Code extension. Developers would have to manage the versioning on their own, and would be difficult to all be on the same version (if needed). But If you used npm and had the package.json/lock file in a repository you could all easily be on the same version. If you needed to update to the same version you can just npm install and that will bring everyone on the same page. It might not be so important for prettier, but think about packages with breaking changes to the latest version.

so to answer your questions:

If I only install the extension, can I format the codebase where the prettier npm package is not installed?

When using the VS Code extension, you can use it to format any file. If you don't have the npm package installed in a given project, the extension will use its built-in default package.

Also does the configuration process differ for these two? Which one is preferred?

Both use .prettierrc for the (small) amount of things you can configure in Prettier. The VS Code extension comes with some additional configuration for how it should interact with your editor.

If you want your editor to do things like run prettier on save, or to be able to run it from the VS Code command palette, you should use the VS Code extension. Additionally, if you need a specific version of Prettier, or you need to run it from the command line, you can install it as an npm package in your repo. These two options are not mutually exclusive.

🌐
Stepsecurity
stepsecurity.io › blog › supply-chain-security-alert-eslint-config-prettier-package-shows-signs-of-compromise
Supply Chain Security Alert: eslint-config-prettier Package Shows Signs of Compromise - StepSecurity
We are currently investigating a potential supply chain security incident involving the eslint-config-prettier npm package. This widely-used package, which helps developers maintain consistent code formatting by turning off ESLint rules that conflict with Prettier, appears to have had multiple versions published with suspicious modifications.
🌐
Medium
medium.com › @robinviktorsson › setting-up-eslint-and-prettier-for-a-typescript-project-aa2434417b8f
Setting Up ESLint and Prettier for a TypeScript Project | by Robin Viktorsson | Medium
March 10, 2025 - Prettier ensures that your code follows a consistent style. npm install --save-dev prettier eslint-config-prettier eslint-plugin-prettier
🌐
npm
npmjs.com › package › eslint-config-prettier
eslint-config-prettier - npm
July 18, 2025 - Turns off all rules that are unnecessary or might conflict with Prettier.. Latest version: 10.1.8, last published: 8 months ago. Start using eslint-config-prettier in your project by running `npm i eslint-config-prettier`. There are 12180 other projects in the npm registry using eslint-con...
      » npm install eslint-config-prettier
    
Published   Jul 18, 2025
Version   10.1.8
Author   Simon Lydell
🌐
Hacker News
news.ycombinator.com › item
eslint-config-prettier npm package compromised | Hacker News
July 28, 2025 - Good reminder to use a password manager as well (as it would also catch the 'npnjs' typo squatted domain too) · Similar incident happened to the HIBP guy who mentioned ignoring the password manager safeguards due to being half asleep while on the plane
🌐
Fishtank
getfishtank.com › insights › running-prettier-from-the-command-line
Running Prettier from the Command Line | Fishtank
March 21, 2023 - Now format all files with Prettier by running - npm run format in your terminal. This command will pick up “format” inside “script” in your project’s package.
🌐
npm
npmjs.com › package › prettier-plugin-package
prettier-plugin-package - npm
July 31, 2025 - Prettier is an opinionated code formatter. It enforces a consistent style by parsing your code and re-printing, taking various rules into account. This plugin adds support for package.json files used within NPM modules.
      » npm install prettier-plugin-package
    
Published   Jul 31, 2025
Version   2.0.0
Author   shellscape