Prettier
The nf-core community uses automated code formatting tools to maintain a consistent style across repositories. Use Prettier to check that your documentation is correctly formatted.
Learn how to install and run Prettier to correctly format your documentation.
See Bytesize 41: Code linting tools to see Prettier in action.
Install Prettier
Install Prettier using conda:
conda install prettierEditor plugin
You can install Prettier as an extension for your code editor. It will fix formatting issues automatically every time you save a file.
For VS Code, install the Prettier extension.
The Prettier extension is included in the nf-core extension pack. See nf-core extension pack for more information.
Run Prettier
If you have Prettier installed, you can run it manually to check for formatting issues or apply fixes:
-
Check for changes:
prettier -c . -
Write changes:
prettier -w .
Run Prettier With pre-commit hooks
Configure prek to run Prettier automatically every time you commit code.
Most nf-core repositories already include a .pre-commit-config.yaml file:
- repo: https://github.com/pre-commit/mirrors-prettier
rev: <sha-or-tag> # Use the sha or tag you want to point at
hooks:
- id: prettierTo run Prettier with prek:
-
Install prek:
NoteIf you have nf-core tools installed, prek is already included — skip this step.
pip install prek -
Install the hooks in your repository:
prek install --install-hooks
When you run git commit, Prettier runs automatically.
If changes are made, prek aborts the commit.
To continue, run git add with the modified files and try the commit again.
Run Prettier on a pull request
If you’ve already created a pull request, add a comment with @nf-core-bot fix linting.
The nf-core bot will run Prettier and apply the required fixes.