0.2.0 • Published 11 months ago
@hugomods/prettier-config v0.2.0
HugoMods Prettier Config
This is a Prettier config for Hugo to format HTML templates, Markdown files, data files, i18n files and so on.
Installation
npm i -D @hugomods/prettier-configConfiguration
Configure the following settings on package.json.
{
"prettier": "@hugomods/prettier-config",
"scripts": {
"lint:prettier": "prettier . --check",
"lint:prettier:fix": "prettier . -w"
}
}Scripts
Check If Files Is Formatted Correctly
npm run lint:prettierFormat Files In Place
npm run lint:prettier:fixGitHub Actions
To check if files are formatted correctly via GitHub Actions, you can create a workflow as follows, takes .github/workflows/lint.yml as an example.
name: lint
on:
push:
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
- run: npm ci
- run: npm run lint:prettier