[feat]: conditional formatters
Opened this issue · 2 comments
bennypowers commented
I'd like to run prettier if and only if the current project has a prettier config (.prettierrc
or prettier
in package.json)
prettier.nvim has an option for this https://github.com/MunifTanjim/prettier.nvim#setting-up-prettiernvim
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,
}
})
bennypowers commented
I adapted MT's code in my dotfiles