pre-commit hook to format and check lua files using stylua and luacheck.
This hook is meant to be used with pre-commit.
Before using pre-commit-lua
, ensure that you have luacheck
and stylua
installed on your system. If you don't have them installed, follow the instructions below:
- Using LuaRocks:
luarocks install luacheck
- Using package manager (example for Ubuntu):
sudo apt install luacheck
- Using Cargo (Rust's package manager):
cargo install stylua
- Using precompiled binaries:
- Visit the StyLua GitHub repository.
- Download the precompiled binary for your operating system.
- Place the binary in a directory accessible from your system's PATH.
Add the following hook to .pre-commit-config.yaml
:
- repo: https://github.com/rwxcorp/pre-commit-lua.git
rev: v1.0.0
hooks:
- id: stylua
- id: luacheck
This project is licensed under the MIT License. See the LICENSE file for details.