feat: Add formatters

This commit is contained in:
punkfairie 2025-01-04 21:36:09 -08:00
parent 8ab6c6b964
commit dbf86525ea
Signed by: punkfairie
GPG key ID: A509E8F77FB9D696
2 changed files with 31 additions and 2 deletions

View file

@ -144,8 +144,15 @@ with final.pkgs.lib; let
shellcheck
# Formatters
alejandra
blade-formatter
fish
php84Packages.php-cs-fixer
nodePackages.prettier
rustywind
taplo
shfmt
stylelint
stylua
];
in {

View file

@ -35,7 +35,8 @@ return {
-- Prettier is last but only activated if there is a config available,
-- thereby giving it priority only when it is wanted.
formatters_by_ft = {
css = { 'biome', 'prettier' },
blade = { 'blade-formatter', 'rustywind' },
css = { 'stylelint', 'biome', 'prettier' },
fish = { 'fish_indent' },
graphql = { 'biome', 'prettier' },
handlebars = { 'prettier' },
@ -44,12 +45,17 @@ return {
javascriptreact = { 'biome', 'prettier' },
json = { 'biome', 'prettier' },
jsonc = { 'biome', 'prettier' },
liquid = { 'prettier' },
lua = { 'stylua' },
less = { 'prettier' },
markdown = { 'prettier' },
['markdown.mdx'] = { 'prettier' },
scss = { 'prettier' },
nix = { 'alejandra' },
php = { 'pint', 'php_cs_fixer', stop_after_first = true },
ruby = { 'prettier' },
scss = { 'stylelint', 'prettier' },
sh = { 'shfmt' },
toml = { 'taplo' },
typescript = { 'biome', 'prettier' },
typescriptreact = { 'biome', 'prettier' },
vue = { 'biome', 'prettier' },
@ -60,12 +66,28 @@ return {
biome = {
require_cwd = true,
},
pint = {
meta = { url = 'https://github.com/laravel/pint' },
command = require('conform.util').find_executable({
'vendor/bin/pint',
}, 'pint'),
args = { '$FILENAME' },
stdin = false,
},
prettier = {
condition = function(_, ctx)
return MarleyVim.prettier.has_parser(ctx)
and MarleyVim.prettier.has_config(ctx)
end,
},
shfmt = {
prepend_args = {
'--indent=2',
'--case-indent',
'--binary-next-line',
'--func-next-line',
},
},
},
})