From 67d47f8662d0d9cb0f212892feb99445eddd21d3 Mon Sep 17 00:00:00 2001 From: Roman Shkarin Date: Sun, 14 Jul 2024 02:21:33 +0200 Subject: [PATCH 1/3] Update mappings --- lua/mason-nvim-lint/mapping.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lua/mason-nvim-lint/mapping.lua b/lua/mason-nvim-lint/mapping.lua index fd921e1..eb62ffc 100644 --- a/lua/mason-nvim-lint/mapping.lua +++ b/lua/mason-nvim-lint/mapping.lua @@ -25,6 +25,7 @@ M.nvimlint_to_package = { ["gdlint"] = "gdtoolkit", ["golangcilint"] = "golangci-lint", ["hadolint"] = "hadolint", + ["htmlhint"] = "htmlhint", ["jsonlint"] = "jsonlint", ["ktlint"] = "ktlint", ["luacheck"] = "luacheck", @@ -47,13 +48,14 @@ M.nvimlint_to_package = { ["sqlfluff"] = "sqlfluff", ["standardrb"] = "standardrb", ["stylelint"] = "stylelint", + ["snyk_iac"] = "snyk", ["tflint"] = "tflint", ["tfsec"] = "tfsec", ["trivy"] = "trivy", ["vale"] = "vale", ["vint"] = "vint", ["vulture"] = "vulture", - ["write-good"] = "write-good", + ["write_good"] = "write-good", ["yamllint"] = "yamllint", } From 34109f5f4f7fd34e68089e87a81b0163ac16b2e1 Mon Sep 17 00:00:00 2001 From: Roman Shkarin Date: Sun, 14 Jul 2024 02:21:54 +0200 Subject: [PATCH 2/3] Show error about package resolution --- lua/mason-nvim-lint/install.lua | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/lua/mason-nvim-lint/install.lua b/lua/mason-nvim-lint/install.lua index eb185ba..3aa6e20 100644 --- a/lua/mason-nvim-lint/install.lua +++ b/lua/mason-nvim-lint/install.lua @@ -43,7 +43,22 @@ function M.try_install(mason_linter_identifier) local Package = require "mason-core.package" local package_name, version = Package.Parse(mason_linter_identifier) - resolve_package(package_name) + local resolved_package = resolve_package(package_name) + + if resolved_package == nil then + if not settings.current.quiet_mode then + vim.notify( + ("[mason-nvim-lint] Linter %q cannot be resolved into a Mason package. Make sure to only provide valid linter names.") + :format( + package_name + ), + vim.log.levels.WARN + ) + return + end + end + + resolved_package :if_present( ---@param pkg Package function(pkg) From 291727457c123b0eaea8260712667367125d2f7f Mon Sep 17 00:00:00 2001 From: Roman Shkarin Date: Sun, 14 Jul 2024 02:27:16 +0200 Subject: [PATCH 3/3] Update readme --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index a6fdd9e..0346647 100644 --- a/README.md +++ b/README.md @@ -76,12 +76,12 @@ local DEFAULT_SETTINGS = { #### Basic Customization -Using this configuration, only linters specified in `ensure_installed` will be installed, ones specified in `nvim-lint` will be ignored. +Using this configuration, linters specified in `ensure_installed` will be installed directly from the mason's registry, and ones specified in `nvim-lint` will be translated to Mason format and installed. **NOTE:** The linters in `ensure_installed` should be written in the format of the mason's registry (https://mason-registry.dev/). ```lua require ('mason-nvim-lint').setup({ - ensure_installed = {'eslint_d', 'revive'}, + ensure_installed = { 'bacon' }, -- bacon linter for rust is not available in nvim-lint, so it's specified to be directly installed from the mason's registry }) ```