chore: eslint and mason setup
This commit is contained in:
@@ -19,6 +19,7 @@
|
|||||||
"komau.vim": { "branch": "master", "commit": "4666b5b15f4ab3f6f59f6aae13a394f9e8652767" },
|
"komau.vim": { "branch": "master", "commit": "4666b5b15f4ab3f6f59f6aae13a394f9e8652767" },
|
||||||
"lazy.nvim": { "branch": "main", "commit": "306a05526ada86a7b30af95c5cc81ffba93fef97" },
|
"lazy.nvim": { "branch": "main", "commit": "306a05526ada86a7b30af95c5cc81ffba93fef97" },
|
||||||
"lualine.nvim": { "branch": "master", "commit": "131a558e13f9f28b15cd235557150ccb23f89286" },
|
"lualine.nvim": { "branch": "master", "commit": "131a558e13f9f28b15cd235557150ccb23f89286" },
|
||||||
|
"mason.nvim": { "branch": "main", "commit": "cb8445f8ce85d957416c106b780efd51c6298f89" },
|
||||||
"mini.clue": { "branch": "main", "commit": "43bd6cf1c3ccdea46d403c32dbc4629fa6afa09d" },
|
"mini.clue": { "branch": "main", "commit": "43bd6cf1c3ccdea46d403c32dbc4629fa6afa09d" },
|
||||||
"mini.icons": { "branch": "main", "commit": "bac6317300e205335df425296570d84322730067" },
|
"mini.icons": { "branch": "main", "commit": "bac6317300e205335df425296570d84322730067" },
|
||||||
"neo-tree.nvim": { "branch": "main", "commit": "19d20a99bf0061a5ecc4343d2f09fa713306c965" },
|
"neo-tree.nvim": { "branch": "main", "commit": "19d20a99bf0061a5ecc4343d2f09fa713306c965" },
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ return {
|
|||||||
nerd_font_variant = "mono",
|
nerd_font_variant = "mono",
|
||||||
},
|
},
|
||||||
completion = {
|
completion = {
|
||||||
accept = { auto_brackets = { enabled = false }, },
|
accept = { auto_brackets = { enabled = false } },
|
||||||
list = { selection = { preselect = false, auto_insert = true } },
|
list = { selection = { preselect = false, auto_insert = true } },
|
||||||
menu = {
|
menu = {
|
||||||
auto_show = true,
|
auto_show = true,
|
||||||
@@ -47,10 +47,10 @@ return {
|
|||||||
-- nvim-cmp style menu
|
-- nvim-cmp style menu
|
||||||
draw = {
|
draw = {
|
||||||
columns = {
|
columns = {
|
||||||
{ "label", "label_description", gap = 1 },
|
{ "label", "label_description", gap = 1 },
|
||||||
{ "kind_icon", "kind" }
|
{ "kind_icon", "kind" },
|
||||||
},
|
},
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
-- Show documentation when selecting a completion item
|
-- Show documentation when selecting a completion item
|
||||||
@@ -79,7 +79,7 @@ return {
|
|||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
'm4xshen/autoclose.nvim',
|
"m4xshen/autoclose.nvim",
|
||||||
opts = function()
|
opts = function()
|
||||||
return require("plugins.opts.autoclose")
|
return require("plugins.opts.autoclose")
|
||||||
end,
|
end,
|
||||||
|
|||||||
45
lua/plugins/linter.lua
Normal file
45
lua/plugins/linter.lua
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
return {
|
||||||
|
{
|
||||||
|
"mfussenegger/nvim-lint",
|
||||||
|
events = { "BufWritePost", "BufReadPost", "InsertLeave" },
|
||||||
|
opts = {
|
||||||
|
linters_by_ft = {
|
||||||
|
fish = { "fish" },
|
||||||
|
css = { "stylelint" },
|
||||||
|
scss = { "stylelint" },
|
||||||
|
ts = { "eslint_d" },
|
||||||
|
js = { "eslint_d" },
|
||||||
|
jsx = { "eslint_d" },
|
||||||
|
tsx = { "eslint_d" },
|
||||||
|
-- Use the "*" filetype to run linters on all filetypes.
|
||||||
|
-- ['*'] = { 'global linter' },
|
||||||
|
-- Use the "_" filetype to run linters on filetypes that don't have other linters configured.
|
||||||
|
-- ['_'] = { 'fallback linter' },
|
||||||
|
-- ["*"] = { "typos" },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
config = function()
|
||||||
|
local lint = require("lint")
|
||||||
|
|
||||||
|
lint.linters_by_ft = {
|
||||||
|
javascript = { "biomejs" },
|
||||||
|
typescript = { "eslint_d" },
|
||||||
|
javascriptreact = { "biomejs" },
|
||||||
|
typescriptreact = { "biomejs" },
|
||||||
|
svelte = { "biomejs" },
|
||||||
|
python = { "ruff" },
|
||||||
|
go = { "golangcilint" },
|
||||||
|
}
|
||||||
|
|
||||||
|
local lint_augroup = vim.api.nvim_create_augroup("lint", { clear = true })
|
||||||
|
|
||||||
|
vim.api.nvim_create_autocmd({ "BufEnter", "BufWritePost", "InsertLeave" }, {
|
||||||
|
group = lint_augroup,
|
||||||
|
callback = function()
|
||||||
|
lint.try_lint()
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
}
|
||||||
@@ -1,35 +1,35 @@
|
|||||||
local config = {
|
local config = {
|
||||||
-- Define your formatters
|
-- Define your formatters
|
||||||
formatters_by_ft = {
|
formatters_by_ft = {
|
||||||
rust = { "rustfmt" },
|
rust = { "rustfmt" },
|
||||||
lua = { "stylua" },
|
lua = { "stylua" },
|
||||||
go = { "goimports", "gofmt" },
|
go = { "goimports", "gofmt" },
|
||||||
javascript = { "prettierd", "prettier", "biome", stop_after_first = true },
|
javascript = { "prettierd", "prettier", "biome", stop_after_first = true },
|
||||||
javascriptreact = { "prettierd", "prettier", "biome", stop_after_first = true },
|
javascriptreact = { "prettierd", "prettier", "biome", stop_after_first = true },
|
||||||
typescript = { "prettierd", "prettier", "biome", stop_after_first = true },
|
typescript = { "prettierd", "prettier", "biome", stop_after_first = true },
|
||||||
typescriptreact = { "prettierd", "prettier", "biome", stop_after_first = true },
|
typescriptreact = { "prettierd", "prettier", "biome", stop_after_first = true },
|
||||||
css = { "prettierd", "prettier", "biome", stop_after_first = true },
|
css = { "prettierd", "prettier", "biome", stop_after_first = true },
|
||||||
scss = { "prettierd", "prettier", "biome", stop_after_first = true },
|
scss = { "prettierd", "prettier", "biome", stop_after_first = true },
|
||||||
-- python = function(bufnr)
|
-- python = function(bufnr)
|
||||||
-- if require("conform").get_formatter_info("ruff_format", bufnr).available then
|
-- if require("conform").get_formatter_info("ruff_format", bufnr).available then
|
||||||
-- return { "ruff_format" }
|
-- return { "ruff_format" }
|
||||||
-- else
|
-- else
|
||||||
-- return { "isort", "black" }
|
-- return { "isort", "black" }
|
||||||
-- end
|
-- end
|
||||||
-- end,
|
-- end,
|
||||||
["_"] = { "trim_whitespace" }, -- run only on filetypes without formater
|
["_"] = { "trim_whitespace" }, -- run only on filetypes without formater
|
||||||
-- ["*"] = { "trim_whitespace" }, -- run in all filetypes
|
-- ["*"] = { "trim_whitespace" }, -- run in all filetypes
|
||||||
},
|
},
|
||||||
format_on_save = {
|
format_on_save = {
|
||||||
timeout_ms = 500,
|
timeout_ms = 500,
|
||||||
lsp_format = "fallback",
|
lsp_format = "fallback",
|
||||||
},
|
},
|
||||||
-- Customize formatters
|
-- Customize formatters
|
||||||
formatters = {
|
formatters = {
|
||||||
shfmt = {
|
shfmt = {
|
||||||
prepend_args = { "-i", "2" },
|
prepend_args = { "-i", "2" },
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
return config
|
return config
|
||||||
|
|||||||
@@ -1,4 +1,31 @@
|
|||||||
local config = {
|
local config = {
|
||||||
|
{
|
||||||
|
"mason-org/mason.nvim",
|
||||||
|
opts = {
|
||||||
|
ui = {
|
||||||
|
icons = {
|
||||||
|
package_installed = "✓",
|
||||||
|
package_pending = "➜",
|
||||||
|
package_uninstalled = "✗"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
ensure_isntalled = {
|
||||||
|
lsp = {
|
||||||
|
"typescript-language-server",
|
||||||
|
"eslint-lsp"
|
||||||
|
},
|
||||||
|
dap = {
|
||||||
|
},
|
||||||
|
linter = {
|
||||||
|
"eslint_d"
|
||||||
|
},
|
||||||
|
formatter = {
|
||||||
|
"prettier"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
,
|
||||||
{
|
{
|
||||||
"folke/snacks.nvim",
|
"folke/snacks.nvim",
|
||||||
priority = 1000,
|
priority = 1000,
|
||||||
|
|||||||
Reference in New Issue
Block a user