stylua: init module

Stylua is deterministic 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.
This commit is contained in:
Rachit Kumar Verma
2026-08-26 18:53:02 +05:30
committed by GitHub
parent 66c4403a0e
commit 0a364342a6
6 changed files with 122 additions and 0 deletions

View File

@@ -0,0 +1,4 @@
{
stylua-empty-config = ./empty-config.nix;
stylua-example-config = ./example-config.nix;
}

View File

@@ -0,0 +1,6 @@
{
programs.stylua.enable = true;
nmt.script = ''
assertPathNotExists "home-files/.config/stylua"
'';
}

View File

@@ -0,0 +1,20 @@
{ realPkgs, ... }: {
programs.stylua = {
enable = true;
settings = {
call_parentheses = "Always";
collapse_simple_statement = "Always";
column_width = 85;
indent_type = "Spaces";
indent_width = 2;
line_endings = "Unix";
quote_style = "AutoPreferSingle";
};
};
test.unstubs = [ (_self: _super: { inherit (realPkgs) stylua; }) ];
nmt.script = ''
assertFileContent "home-files/.config/stylua/stylua.toml" ${./expected-config.toml}
assertFileRegex "home-path/bin/stylua" "search-parent-directories"
'';
}

View File

@@ -0,0 +1,7 @@
call_parentheses = "Always"
collapse_simple_statement = "Always"
column_width = 85
indent_type = "Spaces"
indent_width = 2
line_endings = "Unix"
quote_style = "AutoPreferSingle"