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.94k stars 204 forks source link

Linter for ts files works only after opening js file #536

Closed remmark99 closed 7 months ago

remmark99 commented 7 months ago

For some reason, I get lint errors in my TSX files only after opening JS file Here's my config:

  {
    "mfussenegger/nvim-lint",
    ft = {
      "javascript",
      "javascriptreact",
    },
    opts = {
      linters_by_ft = {
        typescriptreact = { "eslint_d" },
        typescript = { "eslint_d" },
        javascript = { "eslint_d" },
        javascriptreact = { "eslint_d" },
      },
    },
    config = function(_, opts)
      -- npm install -g eslint_d
      local lint = require "lint"
      lint.linters_by_ft = opts.linters_by_ft

      vim.api.nvim_create_autocmd({ "BufEnter", "BufWritePost", "TextChanged", "InsertLeave" }, {
        -- group = vim.api.augroup "Lint",
        group = vim.api.nvim_create_augroup("Lint", { clear = true }),
        callback = function()
          require("lint").try_lint()
        end,
      })
    end,
  },

https://github.com/mfussenegger/nvim-lint/assets/20582164/735e212f-680e-4863-8c77-a53550efb9f4

I am using nvchad, so problem might lie there, but I don't know how to check that