feat: fix eslint - moved to lspconfig setup
This commit is contained in:
parent
290c00be62
commit
7eda72ff16
6 changed files with 18 additions and 7 deletions
6
init.lua
6
init.lua
|
@ -1,6 +1,6 @@
|
|||
if vim.fn.has('nvim-0.10') == 0 then
|
||||
error('Need Neovim v0.10+ (Nightly) in order to run Cosmic!')
|
||||
end
|
||||
-- if vim.fn.has('nvim-0.10') == 0 then
|
||||
-- error('Need Neovim v0.10+ (Nightly) in order to run Cosmic!')
|
||||
-- end
|
||||
|
||||
local ok, err = pcall(require, 'cosmic')
|
||||
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
"mason.nvim": { "branch": "main", "commit": "3b5068f0fc565f337d67a2d315d935f574848ee7" },
|
||||
"neodev.nvim": { "branch": "main", "commit": "84e0290f5600e8b89c0dfcafc864f45496a53400" },
|
||||
"noice.nvim": { "branch": "main", "commit": "bf67d70bd7265d075191e7812d8eb42b9791f737" },
|
||||
"none-ls-extras.nvim": { "branch": "main", "commit": "c226aca7a506dd4325fb96188bffe804d24bbf18" },
|
||||
"none-ls.nvim": { "branch": "main", "commit": "ff3819c52ca04232fb70fbd6c1639de9abcbe122" },
|
||||
"nui.nvim": { "branch": "main", "commit": "756c59f46057cd2d43619cd3a6d4e01b2aa60295" },
|
||||
"nvim-autopairs": { "branch": "master", "commit": "c6139ca0d5ad7af129ea6c89cb4c56093f2c034a" },
|
||||
|
|
|
@ -28,7 +28,7 @@ local default_config = {
|
|||
-- lsp servers that should be installed
|
||||
ensure_installed = {
|
||||
'astro',
|
||||
'eslint_d',
|
||||
'eslint',
|
||||
'prettierd',
|
||||
'cssls',
|
||||
'gopls',
|
||||
|
@ -46,6 +46,7 @@ local default_config = {
|
|||
servers = {
|
||||
astro = true,
|
||||
tailwindcss = true,
|
||||
eslint = true,
|
||||
jsonls = {
|
||||
format = false,
|
||||
},
|
||||
|
|
10
lua/cosmic/lsp/providers/eslint.lua
Normal file
10
lua/cosmic/lsp/providers/eslint.lua
Normal file
|
@ -0,0 +1,10 @@
|
|||
local default_on_attach = require('cosmic.lsp.providers.defaults').on_attach
|
||||
return {
|
||||
on_attach = function(client, bufnr)
|
||||
default_on_attach(client, bufnr)
|
||||
vim.api.nvim_create_autocmd("BufWritePre", {
|
||||
buffer = bufnr,
|
||||
command = "EslintFixAll",
|
||||
})
|
||||
end,
|
||||
}
|
|
@ -31,6 +31,8 @@ return {
|
|||
opts = u.merge(opts, require('cosmic.lsp.providers.jsonls'))
|
||||
elseif server == 'pyright' then
|
||||
opts = u.merge(opts, require('cosmic.lsp.providers.pyright'))
|
||||
elseif server == 'eslint' then
|
||||
opts = u.merge(opts, require('cosmic.lsp.providers.eslint'))
|
||||
elseif server == 'lua_ls' then
|
||||
opts = u.merge(opts, require('cosmic.lsp.providers.lua_ls'))
|
||||
end
|
||||
|
|
|
@ -20,10 +20,7 @@ return {
|
|||
|
||||
config_opts.sources = u.merge_list({
|
||||
null_ls.builtins.code_actions.gitsigns,
|
||||
null_ls.builtins.code_actions.eslint_d,
|
||||
null_ls.builtins.diagnostics.eslint_d,
|
||||
null_ls.builtins.diagnostics.markdownlint,
|
||||
null_ls.builtins.formatting.eslint_d,
|
||||
null_ls.builtins.formatting.prettierd.with({
|
||||
env = {
|
||||
PRETTIERD_LOCAL_PRETTIER_ONLY = 1,
|
||||
|
|
Loading…
Add table
Reference in a new issue