mfussenegger / nvim-lint

An asynchronous linter plugin for Neovim complementary to the built-in Language Server Protocol support.
GNU General Public License v3.0
1.77k stars 191 forks source link

Vale linter setup exits with code 2 #528

Open pacoispaco opened 4 months ago

pacoispaco commented 4 months ago

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 get the same when I run this command in Neovim with the "test.md" file in the buffer:

:lua require("lint").try_lint()

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.

dileep-kishore commented 4 months ago

I ran into the same issue. Did you manage to resolve it?

darkylein commented 3 months ago

I'm encountering a similar issue. Executing Vale via the command line for a specific file yields the following output:

E100 [.vale.ini not found] Runtime error

no config file found

Execution stopped with code 1.

Placing a vale.ini configuration file at the root of the project appears to be a potential fix. However, this approach doesn't seem particularly optimal.

hriva commented 3 months ago

You have to sync the vale package for the first usage:

  1. You can create a ~/.config/vale/.vale.ini file
  2. Then use full path to sync the mason package with the global config. ~/.local/share/nvim/mason/packages/vale/vale --config=$HOME/.config/vale/.vale.ini sync

This is my .vale.ini: StylesPath = . MinAlertLevel = suggestion Packages = RedHat, alex [*] BasedOnStyles = Vale, RedHat, alex

Use styles=. so it syncs your sytles to where the global config is store. I hate clutter in my home folder

EDIT: source: https://docs.rockylinux.org/books/nvchad/vale_nvchad/#__tabbed_1_2

ruskeyz commented 1 month ago

@hriva thanks for the link, fixed all my errors