Skip to content

Commit b579a00

Browse files
authored
Merge pull request #13 from rshkarin/update-mappings
Update mappings
2 parents b9ae43a + 2917274 commit b579a00

File tree

3 files changed

+21
-4
lines changed

3 files changed

+21
-4
lines changed

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -76,12 +76,12 @@ local DEFAULT_SETTINGS = {
7676

7777
#### Basic Customization
7878

79-
Using this configuration, only linters specified in `ensure_installed` will be installed, ones specified in `nvim-lint` will be ignored.
79+
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.
8080
**NOTE:** The linters in `ensure_installed` should be written in the format of the mason's registry (https://mason-registry.dev/).
8181

8282
```lua
8383
require ('mason-nvim-lint').setup({
84-
ensure_installed = {'eslint_d', 'revive'},
84+
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
8585
})
8686
```
8787

lua/mason-nvim-lint/install.lua

+16-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,22 @@ function M.try_install(mason_linter_identifier)
4343
local Package = require "mason-core.package"
4444
local package_name, version = Package.Parse(mason_linter_identifier)
4545

46-
resolve_package(package_name)
46+
local resolved_package = resolve_package(package_name)
47+
48+
if resolved_package == nil then
49+
if not settings.current.quiet_mode then
50+
vim.notify(
51+
("[mason-nvim-lint] Linter %q cannot be resolved into a Mason package. Make sure to only provide valid linter names.")
52+
:format(
53+
package_name
54+
),
55+
vim.log.levels.WARN
56+
)
57+
return
58+
end
59+
end
60+
61+
resolved_package
4762
:if_present(
4863
---@param pkg Package
4964
function(pkg)

lua/mason-nvim-lint/mapping.lua

+3-1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ M.nvimlint_to_package = {
2525
["gdlint"] = "gdtoolkit",
2626
["golangcilint"] = "golangci-lint",
2727
["hadolint"] = "hadolint",
28+
["htmlhint"] = "htmlhint",
2829
["jsonlint"] = "jsonlint",
2930
["ktlint"] = "ktlint",
3031
["luacheck"] = "luacheck",
@@ -47,13 +48,14 @@ M.nvimlint_to_package = {
4748
["sqlfluff"] = "sqlfluff",
4849
["standardrb"] = "standardrb",
4950
["stylelint"] = "stylelint",
51+
["snyk_iac"] = "snyk",
5052
["tflint"] = "tflint",
5153
["tfsec"] = "tfsec",
5254
["trivy"] = "trivy",
5355
["vale"] = "vale",
5456
["vint"] = "vint",
5557
["vulture"] = "vulture",
56-
["write-good"] = "write-good",
58+
["write_good"] = "write-good",
5759
["yamllint"] = "yamllint",
5860
}
5961

0 commit comments

Comments
 (0)