prettier [file, dir or glob...]

Run Prettier from the command line


file, dir or globfilepaths, folders


-c, --check <file, dir, or glob...>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 <mode>Include parentheses around a sole arrow function parameter
--no-bracket-spacingDo not print spaces between brackets
--embedded-language-formatting <mode>Control how Prettier formats quoted code embedded in the file
--end-of-line <choice>Which end of line characters to apply
--html-whitespace-sensitivity <choice>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 <parser>Which parser to use
--print-width <int>The line length where Prettier will try wrap
--prose-wrap <arg>How to wrap prose
--quote-props <when>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 <int>Number of spaces per indentation level
--trailing-comma <type>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 <path>Path to a Prettier configuration file (.prettierrc, package.json, prettier.config.js)
--no-configDo not look for a configuration file
--config-precedence <precedence>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 <file>Finds a path to the configuration file for the given input file
--ignore-path <path>Path to a file with patterns describing files to ignore
--plugin <path>Add a plugin
--plugin-search-dir <path...>Custom directory that contains prettier plugins in node_modules subdirectory
--with-node-modulesProcess files inside 'node_modules' directory
--cursor-offset <int>Print (to stderr) where a cursor at the given position would move to after formatting
--range-end <int>Format code ending at a given character offset (exclusive)
--range-start <int>Format code starting at a given character offset
--no-colorDo not colorize error messages
--file-info <path>Extract the following info (as JSON) for a given file path
-h, --help [flag]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 <level>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 <path>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