Vale linter setup with nvim-lint & Mason exits with code 2

I’m using Neovim v0.9.5 with nvim.lazy and have installed the nvim-lint plugin. I have installed the “Vale” linter with Mason. I have configured Vale in in the ~/.local/share/nvim/mason/packages/vale/ directory and verified I can run Vale there on the command line.

I have this config file for nvim-lint:

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

        lint.linters_by_ft = {
            text = { "vale", },
            markdown = { "vale", },
        }

        vim.api.nvim_create_autocmd({ "BufWritePost" }, {
            callback = function()
                require("lint").try_lint()
            end,
        })
    end,
}

I open a “test.md” file with some text in Neovim, when I save the buffer I get:

Linter command `vale` exited with code: 2

I’ve looked in the log files in ~/.local/state/nvim/ but can see nothing from nvim-lint or Vale there

Any help in solving this would be appreciated.

Have you tried to run vale on this file from the command line?

Yes. I have verified I can run Vale there on the command line on that file.

I got it fixed by including a .vale.ini file in the folder where the .md file is located. You can find more info about the config file through this article