fix(prettier): use prettier to check if prettier should run on the file

This commit is contained in:
Folke Lemaitre
2024-06-06 17:38:12 +02:00
parent a9aea4b5a1
commit 0255b8fdb1

View File

@ -57,9 +57,8 @@ return {
return true
end
if enabled[ctx.filename] == nil then
enabled[ctx.filename] = vim.fs.find(function(name, path)
return name:match("^%.prettierrc%.?") or name:match("^prettier%.config%.")
end, { path = ctx.filename, upward = true })[1] ~= nil
vim.fn.system({ "prettier", "--find-config-path", ctx.filename })
enabled[ctx.filename] = vim.v.shell_error == 0
end
return enabled[ctx.filename]
end,