StyLua

JohnnyMorganz·JohnnyMorganz.StyLua

A Lua code formatter

A deterministic code formatter for Lua 5.1, 5.2, 5.3, 5.4, LuaJIT, Luau and CfxLua/FiveM Lua, built using full-moon. StyLua is inspired by the likes of prettier, it parses your Lua codebase, and prints it back out from scratch, enforcing a consistent code style. StyLua mainly follows the Roblox Lua Style Guide, with a few deviations.

winget install --id JohnnyMorganz.StyLua --exact --source winget

Latest 2.6.0·October 10, 2026

Release Notes

[2.6.0] - 2026-10-10

Added

  • Luau: Added support for if local / if const condition bindings in both if statements and if expressions (e.g. if local x = getValue() then ... end)
  • Added Input mode for collapse_simple_statement, preserving whether simple statements are single-line or multi-line in the input while still formatting their contents (#1112)

Fixed

  • Fixed range formatting indenting statements one level too shallow when nested inside a function expression within a table constructor (#1145)
  • Fixed -- stylua: ignore start/end ranges inside multiline tables reformatting the ignored fields (#1134)
  • When using range formatting, semicolons outside of the provided range are no longer incorrectly formatted (#1147)
  • Luau: Fixed sort requires not recognizing imports declared with const, e.g. const Foo = require(path)
  • Luau: Fixed the read/write access modifier merging into the element type in array type shorthand, changing the meaning of the code ({ read Foo } was formatted as { readFoo }) (#1126)
  • Fixed single-line comments in CRLF files gaining an extra carriage return (\r ) on every format when line_endings = "Windows", and keeping their original when formatting to Unix line endings (#1167)

External Contributions

  • Mention conform.nvim as a Neovim formatter plugin that supports stylua by @alerque in #1124
  • Clarify the syntax for command-line formatting configuration by @kormide in #1132
  • Fix sort_requires not recognizing const imports in luau by @ddashdev in #1123
  • Fix Luau array access modifier formatting by @Companion in #1148
  • Keep out-of-range semicolons when formatting a range by @GhostCoder6969 in #1158
  • support if-local and if-const by @annieetang in #1160
  • Add Input mode for collapse_simple_statement by @ddashdev in #1112

New Contributors

  • @kormide made their first contribution in #1132
  • @ddashdev made their first contribution in #1123
  • @Companion made their first contribution in #1148
  • @GhostCoder6969 made their first contribution in #1158
  • @annieetang made their first contribution in #1160

Installer type: zip

x64—FD13B4014E3B779C244BBC03F2C282E357F15BC526DE6A6FA5ECBC447538313C

Details

Homepage
https://github.com/JohnnyMorganz/StyLua
License
MPL-2.0
Publisher
JohnnyMorganz
Support
https://github.com/JohnnyMorganz/StyLua/issues

Tags

formatterhacktoberfestlualuaformatterluaupretty-printerprinterstylua

Older versions (1)

2.5.2
x64—E77D0EA1226B8B389B43F702240091249A96EEA25857281F90EA24D0EB9EB969