mirror of
https://github.com/nix-community/home-manager.git
synced 2026-10-03 03:59:23 +00:00
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:
committed by
GitHub
parent
66c4403a0e
commit
0a364342a6
4
tests/modules/programs/stylua/default.nix
Normal file
4
tests/modules/programs/stylua/default.nix
Normal file
@@ -0,0 +1,4 @@
|
||||
{
|
||||
stylua-empty-config = ./empty-config.nix;
|
||||
stylua-example-config = ./example-config.nix;
|
||||
}
|
||||
6
tests/modules/programs/stylua/empty-config.nix
Normal file
6
tests/modules/programs/stylua/empty-config.nix
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
programs.stylua.enable = true;
|
||||
nmt.script = ''
|
||||
assertPathNotExists "home-files/.config/stylua"
|
||||
'';
|
||||
}
|
||||
20
tests/modules/programs/stylua/example-config.nix
Normal file
20
tests/modules/programs/stylua/example-config.nix
Normal 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"
|
||||
'';
|
||||
}
|
||||
7
tests/modules/programs/stylua/expected-config.toml
Normal file
7
tests/modules/programs/stylua/expected-config.toml
Normal 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"
|
||||
Reference in New Issue
Block a user