Using Prettier

Prettier is used as the default formatter in Bit's official envs. To learn how to use Prettier in an env that uses a different formatter, see Prettier configuration.

Prettier uses the same standard commands used by all formatters.

Run the following to format all components in your workspace:

$bit
Copiedcopy

Run the following to format only new or modified components in your workspace:

$bit
Copiedcopy

Run the following to format a specific component:

$bit
Copiedcopy

Check for unformatted components

Run the following to check for components that needs to be formatted:

$bit
Copiedcopy

The output is similar to the following:

my-org.my-scope/ui/text
issues found in the following files:
text.composition.tsx
text.tsx
Formatting during build

The formatter does not run during the build process. As a general rule, the build process should not modify your components' source code.