Formatting Files
Format all supported files in the current directory recursively
$prettier --write .Format all supported files in the src directory recursively
$prettier --write srcFormat a single specific file in place
$prettier --write src/index.tsFormat all TypeScript files in src recursively
$prettier --write "src/**/*.ts"Format all TypeScript and TSX files in src recursively
$prettier --write "src/**/*.{ts,tsx}"Format all JS and TS files across the entire project
$prettier --write "**/*.{js,jsx,ts,tsx}"Format JS, TS, JSON, CSS, and Markdown files across the project
$prettier --write "**/*.{js,ts,json,css,md}"Format all files in both src and tests directories
$prettier --write "src/**" "tests/**"Format all files using .gitignore as the ignore rule source
$prettier --write . --ignore-path .gitignoreFormat all files using a specific .prettierignore file
$prettier --write . --ignore-path .prettierignoreFormat supported files, silently skipping unsupported file types
$prettier --write . --ignore-unknownFormat files without erroring if a glob pattern matches nothing
$prettier --write . --no-error-on-unmatched-patternFormat files showing only warnings and errors in output
$prettier --write . --log-level=warnFormat files suppressing all output
$prettier --write . --log-level=silentFormat files with verbose debug output for troubleshooting
$prettier --write . --log-level=debugChecking Files
Check if all supported files in the current directory are formatted
$prettier --check .Check if all supported files in the src directory are formatted
$prettier --check srcCheck if a single specific file is formatted correctly
$prettier --check src/index.tsCheck if all TypeScript files in src are formatted
$prettier --check "src/**/*.ts"Check formatting of JS, TS, JSON, CSS, and Markdown files
$prettier --check "**/*.{js,ts,json,css,md}"Check formatting of files using .gitignore as the ignore source
$prettier --check . --ignore-path .gitignoreCheck formatting, silently skipping unsupported file types
$prettier --check . --ignore-unknownCheck formatting showing only warnings and errors
$prettier --check . --log-level=warnPrinting & Stdout
Print the formatted output of a file to stdout without writing it
$prettier src/index.tsFormat stdin input treating it as the given file path and print to stdout
$prettier --stdin-filepath src/index.tsPipe a file through prettier via stdin and print formatted output
$cat src/index.ts | prettier --stdin-filepath index.tsExplicitly print formatted output to stdout without writing to disk
$prettier src/index.ts --write=falseFormatting Options
Format files with a line wrap width of 100 characters
$prettier --write . --print-width=100Format files with a line wrap width of 120 characters
$prettier --write . --print-width=120Format files using 2 spaces per indentation level
$prettier --write . --tab-width=2Format files using 4 spaces per indentation level
$prettier --write . --tab-width=4Format files indenting with tabs instead of spaces
$prettier --write . --use-tabsFormat files indenting with spaces instead of tabs
$prettier --write . --no-use-tabsFormat files using single quotes instead of double quotes
$prettier --write . --single-quoteFormat files using double quotes instead of single quotes
$prettier --write . --no-single-quoteFormat JSX attributes using single quotes
$prettier --write . --jsx-single-quoteFormat JSX attributes using double quotes
$prettier --write . --no-jsx-single-quoteAdd trailing commas wherever valid in ES5 and function parameters
$prettier --write . --trailing-comma=allAdd trailing commas only where valid in ES5 syntax
$prettier --write . --trailing-comma=es5Remove all trailing commas from formatted output
$prettier --write . --trailing-comma=noneFormat files omitting semicolons at the end of statements
$prettier --write . --no-semiFormat files adding semicolons at the end of statements
$prettier --write . --semiPrint spaces between brackets in object literals
$prettier --write . --bracket-spacingOmit spaces between brackets in object literals
$prettier --write . --no-bracket-spacingPut the closing bracket of multiline JSX elements on the last line
$prettier --write . --bracket-same-linePut the closing bracket of multiline JSX elements on a new line
$prettier --write . --no-bracket-same-lineAlways include parentheses around arrow function arguments
$prettier --write . --arrow-parens=alwaysOmit parentheses around single arrow function arguments when possible
$prettier --write . --arrow-parens=avoidWrap prose in Markdown and similar files at the print width
$prettier --write . --prose-wrap=alwaysDo not wrap prose in Markdown files regardless of line length
$prettier --write . --prose-wrap=neverPreserve the original wrapping of prose in Markdown files
$prettier --write . --prose-wrap=preserveRespect CSS display property for HTML whitespace handling
$prettier --write . --html-whitespace-sensitivity=cssTreat all whitespace as significant in HTML formatting
$prettier --write . --html-whitespace-sensitivity=strictIgnore all whitespace sensitivity in HTML formatting
$prettier --write . --html-whitespace-sensitivity=ignoreIndent script and style blocks inside Vue single-file components
$prettier --write . --vue-indent-script-and-styleDo not indent script and style blocks inside Vue single-file components
$prettier --write . --no-vue-indent-script-and-styleFormat files using LF line endings
$prettier --write . --end-of-line=lfFormat files using CRLF line endings
$prettier --write . --end-of-line=crlfFormat files using CR line endings
$prettier --write . --end-of-line=crMaintain existing line endings in each file
$prettier --write . --end-of-line=autoFormat embedded code blocks in supported languages automatically
$prettier --write . --embedded-language-formatting=autoDisable formatting of embedded code blocks
$prettier --write . --embedded-language-formatting=offEnforce one HTML or JSX attribute per line in multiline elements
$prettier --write . --single-attribute-per-lineFormat ternary expressions using the experimental curious ternary style
$prettier --write . --experimental-ternariesParser & Language
Format a file explicitly using the TypeScript parser
$prettier --write src/index.ts --parser=typescriptFormat a file explicitly using the Babel JavaScript parser
$prettier --write src/index.js --parser=babelFormat a JSX file explicitly using the Babel parser
$prettier --write src/index.jsx --parser=babelFormat a TSX file explicitly using the Babel TypeScript parser
$prettier --write src/index.tsx --parser=babel-tsFormat a file explicitly using the CSS parser
$prettier --write src/style.css --parser=cssFormat a file explicitly using the SCSS parser
$prettier --write src/style.scss --parser=scssFormat a file explicitly using the Less parser
$prettier --write src/style.less --parser=lessFormat a file explicitly using the JSON parser
$prettier --write data.json --parser=jsonFormat a file explicitly using the JSON5 parser
$prettier --write data.json --parser=json5Format a file explicitly using the Markdown parser
$prettier --write README.md --parser=markdownFormat a file explicitly using the MDX parser
$prettier --write docs/page.mdx --parser=mdxFormat a file explicitly using the HTML parser
$prettier --write index.html --parser=htmlFormat a file explicitly using the GraphQL parser
$prettier --write schema.graphql --parser=graphqlFormat a config file without an extension using the JSON parser
$prettier --write .prettierrc --parser=jsonFormat a file explicitly using the YAML parser
$prettier --write config.yaml --parser=yamlConfiguration
Format files using a specific Prettier configuration file
$prettier --write . --config .prettierrcFormat files using a JavaScript Prettier configuration file
$prettier --write . --config prettier.config.jsFormat files ignoring any discovered configuration files
$prettier --write . --no-configPrefer config file options over CLI options when both are present
$prettier --write . --config-precedence=prefer-fileLet CLI options override config file options when both are present
$prettier --write . --config-precedence=cli-overrideLet config file options override CLI options entirely
$prettier --write . --config-precedence=file-overridePrint the path to the configuration file resolved for a given file
$prettier --find-config-path src/index.tsApply options from .editorconfig when formatting files
$prettier --write . --editorconfigIgnore .editorconfig settings when formatting files
$prettier --write . --no-editorconfigFormat files using a specific Prettier plugin
$prettier --write . --plugin=prettier-plugin-tailwindcssFormat files using the Prettier PHP plugin
$prettier --write . --plugin=@prettier/plugin-phpFormat files using the Prettier Svelte plugin
$prettier --write . --plugin=prettier-plugin-svelteInfo & Debugging
Display the currently installed version of Prettier
$prettier --versionDisplay help information and all available CLI options
$prettier --helpPrint a list of all languages and file types Prettier supports
$prettier --support-infoPrint supported languages and file types as JSON
$prettier --support-info --jsonShow the parser and config that Prettier would use for a given file
$prettier --file-info src/index.tsShow file info for a given file in JSON format
$prettier --file-info src/index.ts --jsonShow file info using a specific ignore file
$prettier --file-info src/index.ts --ignore-path .prettierignoreCheck formatting with verbose debug output for troubleshooting
$prettier --check . --log-level=debugCI & Integration
Check formatting in CI using .gitignore as the ignore source
$prettier --check . --ignore-path .gitignoreCheck formatting of source files in CI showing only warnings and errors
$prettier --check "src/**/*.{ts,tsx,js,jsx}" --log-level=warnFormat all files in CI skipping unknown types and reducing noise
$prettier --write . --ignore-unknown --log-level=warnCheck formatting without failing if a glob pattern matches no files
$prettier --check . --no-error-on-unmatched-patternFormat all common file types in CI using gitignore and minimal logging
$prettier --write "**/*.{ts,tsx,js,jsx,json,css,md}" --ignore-path .gitignore --log-level=warn