My Neovim Plugins #7 โ€” nvim-lint

nvim-lint is another null-ls replacement. It helps me by running eslint_d if I enter a file or create a new one. That's it. ๐Ÿ˜Ž

Config

return {
	"mfussenegger/nvim-lint",
	event = {
		"BufReadPre",
		"BufNewFile",
	},
	config = function()
		local lint = require("lint")

		lint.linters_by_ft = {
			javascript = { "eslint_d" },
			typescript = { "eslint_d" },
			javascriptreact = { "eslint_d" },
			typescriptreact = { "eslint_d" },
		}

		lint.linters.eslint_d.args = {
			"--no-warn-ignored", -- https://github.com/mfussenegger/nvim-lint/issues/462
			"--format",
			"json",
			"--stdin",
			"--stdin-filename",
			function()
				return vim.api.nvim_buf_get_name(0)
			end,
		}

		local lint_augroup = vim.api.nvim_create_augroup("lint", { clear = true })

		vim.api.nvim_create_autocmd({ "BufEnter", "BufWritePost", "InsertLeave" }, {
			group = lint_augroup,
			callback = function()
				lint.try_lint()
			end,
		})
	end,
}

76 of #100DaysToOffload

#log #neovim

Thoughts? Discuss...