prettier [command...]

Run Prettier from the command line

Arguments

NameDescription
commandfilepaths, folders

Options

NameDescription
-c,--check <command...>Check if your files are formatted
-l,--list-differentPrint the names of files that are different from Prettier's formatting
-w,--write
  • Dangerous 💥
--arrow-parens <command>Include parentheses around a sole arrow function parameter
--no-bracket-spacingDo not print spaces between brackets
--embedded-language-formatting <command>Control how Prettier formats quoted code embedded in the file
--end-of-line <command>Which end of line characters to apply
--html-whitespace-sensitivity <command>How to handle whitespaces in HTML
--jsx-bracket-same-linePut > on the last line instead of at a new line
--jsx-single-quoteUse single quotes in JSX
--parser <command>Which parser to use
--print-width <command>The line length where Prettier will try wrap
--prose-wrap <command>How to wrap prose
--quote-props <command>Change when properties in objects are quoted
--no-semiDo not print semicolons, except at the beginning of lines which may need them
--single-quoteUse single quotes instead of double quotes
--tab-width <command>Number of spaces per indentation level
--trailing-comma <command>Print trailing commas wherever possible when multi-line
--use-tabsIndent with tabs instead of spaces
--vue-indent-script-and-styleIndent script and style tags in Vue files
--config <command>Path to a Prettier configuration file (.prettierrc, package.json, prettier.config.js)
--no-configDo not look for a configuration file
--config-precedence <command>Define in which order config files and CLI options should be evaluated
--no-editorconfigDon't take .editorconfig into account when parsing configuration
--find-config-path <command>Finds a path to the configuration file for the given input file
--ignore-path <command>Path to a file with patterns describing files to ignore
--plugin <command>Add a plugin
--plugin-search-dir <command...>Custom directory that contains prettier plugins in node_modules subdirectory
--with-node-modulesProcess files inside 'node_modules' directory
--cursor-offset <command>Print (to stderr) where a cursor at the given position would move to after formatting
--range-end <command>Format code ending at a given character offset (exclusive)
--range-start <command>Format code starting at a given character offset
--no-colorDo not colorize error messages
--file-info <command>Extract the following info (as JSON) for a given file path
-h,--help [command]Show CLI usage, or details about the given flag
-u,--ignore-unknownIgnore unknown files
--insert-pragmaInsert @format pragma into file's first docblock comment
--loglevel <command>What level of logs to report
--require-pragmaRequire either '@prettier' or '@format' to be present in the file's first docblock comment in order for it to be formatted
--stdin-filepath <command>Path to the file to pretend that stdin comes from
--support-infoPrint support information as JSON
-v,--versionPrint Prettier version
--debug-checkThis will cause Prettier to print an error message if it detects that code correctness might have changed
--no-error-on-unmatched-patternPrevent errors when pattern is unmatched