diff --git a/nvim/lazy-lock.json b/nvim/lazy-lock.json index e2bcb6d..247a170 100644 --- a/nvim/lazy-lock.json +++ b/nvim/lazy-lock.json @@ -23,6 +23,7 @@ "nui.nvim": { "branch": "main", "commit": "8d3bce9764e627b62b07424e0df77f680d47ffdb" }, "nvim-autopairs": { "branch": "master", "commit": "3d02855468f94bf435db41b661b58ec4f48a06b7" }, "nvim-cmp": { "branch": "main", "commit": "12509903a5723a876abd65953109f926f4634c30" }, + "nvim-lint": { "branch": "master", "commit": "e7b4ffa6ab763af012e38b21af2c9159f10d2d33" }, "nvim-lspconfig": { "branch": "master", "commit": "6c17f8656f667727b27f5f598463afedb7791b18" }, "nvim-treesitter": { "branch": "master", "commit": "a840137349fcc35b5ad2c718a9b034b93012fa43" }, "plenary.nvim": { "branch": "master", "commit": "3707cdb1e43f5cea73afb6037e6494e7ce847a66" }, diff --git a/nvim/lua/config/lazy.lua b/nvim/lua/config/lazy.lua index a03199f..77e8a7a 100644 --- a/nvim/lua/config/lazy.lua +++ b/nvim/lua/config/lazy.lua @@ -34,8 +34,9 @@ require("lazy").setup({ { 'neovim/nvim-lspconfig', commit = '6c17f8656f667727b27f5f598463afedb7791b18' }, { 'williamboman/mason.nvim', commit = 'e2f7f9044ec30067bc11800a9e266664b88cda22' }, { 'williamboman/mason-lspconfig.nvim', commit = 'f75e877f5266e87523eb5a18fcde2081820d087b' }, - { 'MunifTanjim/eslint.nvim', commit = '05d7e86ea01dc03e6fcc7d5b39530d34ebdef477' }, + { 'MunifTanjim/eslint.nvim' }, { 'nvimtools/none-ls.nvim' }, -- for formatters and linters + { 'mfussenegger/nvim-lint' }, -- linter setup -- Cmp plugins { 'hrsh7th/nvim-cmp', commit = '12509903a5723a876abd65953109f926f4634c30' }, diff --git a/nvim/lua/user/lsp/null-ls.lua b/nvim/lua/user/lsp/null-ls.lua index d9b8e83..c4011e0 100644 --- a/nvim/lua/user/lsp/null-ls.lua +++ b/nvim/lua/user/lsp/null-ls.lua @@ -25,11 +25,12 @@ null_ls.setup { formatting.black.with { extra_args = { "--fast" } }, formatting.stylua, formatting.google_java_format, - formatting.eslint_d.with { filetypes = { "javascript", "javascriptreact" } }, + -- formatting.eslint_d.with { filetypes = { "javascript", "javascriptreact" } }, // needs cleanup / fix. disabled for now as it is not supported anymore. temporary fix: user.eslint.lua formatting.stylelint, diagnostics.flake8, - diagnostics.eslint.with { filetypes = { "javascript", "javascriptreact" } }, - code_actions.eslint_d.with { filetypes = { "javascript", "javascriptreact" } }, + -- diagnostics.eslint.with { filetypes = { "javascript", "javascriptreact" } }, // needs cleanup / fix. disabled for now as it is not supported anymore. temporary fix: user.eslint.lua + -- code_actions.eslint_d.with { filetypes = { "javascript", "javascriptreact" } }, // needs cleanup / fix. disabled for now as it is not supported anymore. temporary fix: user.eslint.lua + }, } @@ -52,3 +53,23 @@ null_ls.setup { -- run_on = "type", -- or `save` -- }, -- }) + +require('lint').linters_by_ft = { + javascript = {'eslint_d'}, +} + +vim.api.nvim_create_autocmd({ "BufWritePost" }, { + callback = function() + -- try_lint without arguments runs the linters defined in `linters_by_ft` + -- for the current filetype + require("lint").try_lint() + end, +}) + +vim.api.nvim_create_autocmd({ "BufReadPost" }, { + callback = function() + -- try_lint without arguments runs the linters defined in `linters_by_ft` + -- for the current filetype + require("lint").try_lint() + end, +})