feat(cfg): add prettierd formatting on save

This commit is contained in:
EGRrqq 2023-09-24 13:38:43 -05:00
parent e1eb599844
commit b5e14de307
3 changed files with 88 additions and 2 deletions

View file

@ -0,0 +1,43 @@
return {
'MunifTanjim/prettier.nvim',
config = function()
local prettier = require("prettier")
prettier.setup({
bin = 'prettier', -- or `'prettierd'` (v0.23.3+)
filetypes = {
"css",
"graphql",
"html",
"javascript",
"javascriptreact",
"json",
"less",
"markdown",
"scss",
"typescript",
"typescriptreact",
"yaml",
},
})
prettier.setup({
["null-ls"] = {
condition = function()
return prettier.config_exists({
-- if `false`, skips checking `package.json` for `"prettier"` key
check_package_json = true,
})
end,
runtime_condition = function(params)
-- return false to skip running prettier
return true
end,
timeout = 5000,
}
})
end,
}