1.5 KiB
1.5 KiB
Formatting
Project Search uses StyLua for Lua formatting.
Install StyLua locally
Ubuntu / Linux Mint
Using cargo:
cargo install stylua --locked
Or using npm / npx without a global install:
npx @johnnymorganz/stylua-bin --version
Arch Linux
sudo pacman -S stylua
macOS
brew install stylua
Run formatting
From the repository root:
make format
This runs:
stylua lua scripts
It formats:
lua/**/*.luascripts/**/*.lua
Check formatting without writing files
make format-check
This runs:
stylua --check lua scripts
Run all checks
make check
make check includes:
format-checkvalidatetesttest-runner
Recommended formatting PR workflow
Create a dedicated branch:
git checkout main
git pull --ff-only
git checkout -b style/format-lua
Run formatting:
make format
Review the diff:
git diff -- lua scripts
Run all checks:
make check
Commit only formatting changes:
git add lua scripts
git commit -m "style: format lua files"
Push and open a pull request:
git push -u origin style/format-lua
CI
CI installs StyLua using cargo and runs:
make check
This means CI fails when Lua files are not formatted.
Notes
Keep formatting PRs focused. Avoid mixing formatting with behavior changes, tests, templates, or docs updates.