local linters = {
	astro = { "eslint_d" },
	bash = { "shellcheck" },
	javascript = { "eslint_d" },
	javascriptreact = { "eslint_d" },
	go = { "revive" },
	markdown = { "markdownlint" },
	quarto = { "markdownlint" },
	sh = { "shellcheck" },
	svelte = { "eslint_d" },
	text = {},
	typescript = { "eslint_d" },
	typescriptreact = { "eslint_d" },
}

return {
	-- linting setup
	{
		"rshkarin/mason-nvim-lint",
		dependencies = {
			{
				"mfussenegger/nvim-lint",
				config = function()
					require("lint").linters_by_ft = linters
					require("lint").linters.markdownlint.args = { "--stdin", "--disable", "MD013", "--" }
					vim.api.nvim_create_autocmd({ "BufWritePost", "InsertLeave" }, {
						callback = function()
							if not vim.g.disable_autolint then
								require("lint").try_lint()
							end
						end,
					})
				end,
				dependencies = { "williamboman/mason.nvim" },
			},
		},
		event = { "BufReadPost", "BufNewFile", "BufWritePre" },
		opts = {},
	},
}
