36 lines
1.5 KiB
Lua
36 lines
1.5 KiB
Lua
return { -- overrides `require("mason-null-ls").setup(...)`
|
|
"jay-babu/mason-null-ls.nvim",
|
|
config = function(plugin, opts)
|
|
plugin.default_config(opts) -- use the default configuration function
|
|
local null_ls = require "null-ls"
|
|
require("mason-null-ls").setup_handlers { -- setup custom handlers
|
|
prettier = function()
|
|
require("null-ls").register(null_ls.builtins.formatting.prettier.with {
|
|
condition = function(utils)
|
|
return utils.root_has_file "package.json"
|
|
or utils.root_has_file ".prettierrc"
|
|
or utils.root_has_file ".prettierrc.json"
|
|
or utils.root_has_file ".prettierrc.js"
|
|
end,
|
|
})
|
|
end,
|
|
-- For prettierd:
|
|
-- prettierd = function()
|
|
-- require("null-ls").register(require("null-ls").builtins.formatting.prettierd.with({
|
|
-- condition = function(utils)
|
|
-- return utils.root_has_file("package.json") or utils.root_has_file(".prettierrc") or utils.root_has_file(".prettierrc.json") or utils.root_has_file(".prettierrc.js")
|
|
-- end
|
|
-- }))
|
|
-- end,
|
|
-- For eslint_d:
|
|
-- eslint_d = function()
|
|
-- require("null-ls").register(require("null-ls").builtins.diagnostics.eslint_d.with({
|
|
-- condition = function(utils)
|
|
-- return utils.root_has_file("package.json") or utils.root_has_file(".eslintrc.json") or utils.root_has_file(".eslintrc.js")
|
|
-- end
|
|
-- }))
|
|
-- end,
|
|
}
|
|
end,
|
|
}
|