Skip to main content

prettier

Prettier is an opinionated code formatter.

Usage

npx sv add prettier

What you get

  • scripts in your package.json
  • .prettierignore and .prettierrc files
  • updates to your eslint config if you're using that package

Options

useTabs

Whether to use tabs for indentation. Default: yes

npx sv add prettier="useTabs:no"

singleQuote

Whether to use single quotes instead of double quotes. Default: yes

npx sv add prettier="singleQuote:no"

trailingComma

Which trailing comma style to use:

  • none — no trailing commas
  • es5 — where valid in ES5 (objects, arrays)
  • all — wherever possible

Default: none

npx sv add prettier="trailingComma:es5"

printWidth

The line width at which the printer will wrap. Default: 100

npx sv add prettier="printWidth:120"

Multiple options can be combined with +:

npx sv add prettier="useTabs:no+singleQuote:no+trailingComma:es5+printWidth:80"

Edit this page on GitHub llms.txt

previous next