@onerepo/plugin-prettier
Installation
Section titled InstallationConfiguration
Section titled Configurationprettier()
Section titled prettier()Include the prettier
plugin in your oneRepo plugin setup:
Parameters
Section titled ParametersParameter | Type |
---|---|
opts | Options |
Options
Section titled OptionsOptions for configuring the Prettier plugin for oneRepo.
Type declaration
Section titled Type declarationgithubAnnotate?
Section titled githubAnnotate?When true
or unset and run in GitHub Actions, any files failing format checks will be annotated with an error in the GitHub user interface.
- Default:
true
name?
Section titled name?The name of the prettier command. You might change this to 'format'
or ['format', 'prettier']
to keep things more familiar for most developers.
useCache?
Section titled useCache?Whether to use Prettier’s built-in cache determinism.
- Default:
true
Recommended tasks
Section titled Recommended tasksIf you’re also running ESLint, it is important to run Prettier after ESLint. Do this by creating sequential tasks: an array of tasks within the serial
tasks array:
Commands
Section titled Commandsone prettier
Section titled one prettierAliases: one format
Format files with prettier
Option | Type | Description |
---|---|---|
--add | boolean | Add modified files after write |
--affected | boolean | Select all affected Workspaces. If no other inputs are chosen, this will default to true . |
--all, -a | boolean | Run across all Workspaces |
--check | boolean | Check for changes. |
--files, -f | array | Determine Workspaces from specific files |
--staged | boolean | Use files on the git stage to calculate affected files or Workspaces. When unset or --no-staged , changes will be calculated from the entire branch, since its fork point. |
--workspaces, -w | array | List of Workspace names to run against |
Advanced options
Option | Type | Description |
---|---|---|
--cache | boolean , default: true | Use Prettier’s built-in cache to determin whether files need formatting or not. |
--from-ref | string | Git ref to start looking for affected files or Workspaces |
--github-annotate | boolean , default: true | Annotate files in GitHub with errors when failing format checks in GitHub Actions. |
--show-advanced | boolean | Pair with --help to show advanced options. |
--through-ref | string | Git ref to start looking for affected files or Workspaces |