2024-04-14 18:41:15 -07:00
local util = require("conform.util")
return {
{
"stevearc/conform.nvim",
-- @class ConformOpts
opts = {
formatters_by_ft = {
2024-04-22 19:41:24 -07:00
{{ if not .isServer -}}
2024-04-14 18:41:15 -07:00
-- lua
lua = { "stylua" },
2024-04-22 19:41:24 -07:00
{{ end -}}
2024-04-14 18:41:15 -07:00
-- data/conf
sql = { "prettier" },
json = { "prettier" },
toml = { "taplo" },
yaml = { "prettier" },
-- web
html = { "prettier" },
liquid = { "prettier" },
2024-04-22 19:41:24 -07:00
css = { {{ if not .isServer }}"stylelint", {{ end }}"prettier" },
scss = { {{ if not .isServer }}"stylelint", {{ end }}"prettier" },
javascript = { {{ if not .isServer }}"eslint", {{ end }}"prettier" },
typescript = { {{ if not .isServer }}"eslint", {{ end }}"prettier" },
vue = { {{ if not .isServer }}"eslint", {{ end }}"prettier" },
2024-04-14 18:41:15 -07:00
markdown = { "prettier" },
2024-04-22 19:41:24 -07:00
{{ if not .isServer -}}
2024-04-14 18:41:15 -07:00
-- php
php = { "pint" },
blade = { "blade-formatter", "rustywind" },
2024-04-22 19:41:24 -07:00
{{ end -}}
2024-04-14 18:41:15 -07:00
-- shell
sh = { "shellcheck", "shfmt" },
fish = { "fish_indent" },
-- misc
ruby = { "prettier" },
},
formatters = {
shfmt = {
prepend_args = { "--indent=2", "--case-indent", "--binary-next-line", "--func-next-line" },
},
2024-04-22 19:41:24 -07:00
{{ if not .isServer -}}
2024-04-14 18:41:15 -07:00
pint = {
meta = {
url = "https://github.com/laravel/pint",
description = "Laravel Pint is an opinionated PHP code style fixer for minimalists. Pint is built on top of PHP-CS-Fixer and makes it simple to ensure that your code style stays clean and consistent.",
},
command = util.find_executable({
vim.fn.stdpath("data") .. "/mason/bin/pint",
"vendor/bin/pint",
}, "pint"),
args = { " $ FILENAME " },
stdin = false,
},
2024-04-22 19:41:24 -07:00
{{ end -}}
2024-04-14 18:41:15 -07:00
},
},
},
}