chore: eslint and mason setup

This commit is contained in:
2026-05-03 23:01:50 +02:00
parent 3325c48cb2
commit 4d10724f93
5 changed files with 109 additions and 36 deletions

View File

@@ -19,6 +19,7 @@
"komau.vim": { "branch": "master", "commit": "4666b5b15f4ab3f6f59f6aae13a394f9e8652767" },
"lazy.nvim": { "branch": "main", "commit": "306a05526ada86a7b30af95c5cc81ffba93fef97" },
"lualine.nvim": { "branch": "master", "commit": "131a558e13f9f28b15cd235557150ccb23f89286" },
"mason.nvim": { "branch": "main", "commit": "cb8445f8ce85d957416c106b780efd51c6298f89" },
"mini.clue": { "branch": "main", "commit": "43bd6cf1c3ccdea46d403c32dbc4629fa6afa09d" },
"mini.icons": { "branch": "main", "commit": "bac6317300e205335df425296570d84322730067" },
"neo-tree.nvim": { "branch": "main", "commit": "19d20a99bf0061a5ecc4343d2f09fa713306c965" },

View File

@@ -39,7 +39,7 @@ return {
nerd_font_variant = "mono",
},
completion = {
accept = { auto_brackets = { enabled = false }, },
accept = { auto_brackets = { enabled = false } },
list = { selection = { preselect = false, auto_insert = true } },
menu = {
auto_show = true,
@@ -47,10 +47,10 @@ return {
-- nvim-cmp style menu
draw = {
columns = {
{ "label", "label_description", gap = 1 },
{ "kind_icon", "kind" }
{ "label", "label_description", gap = 1 },
{ "kind_icon", "kind" },
},
}
},
},
-- Show documentation when selecting a completion item
@@ -79,7 +79,7 @@ return {
},
{
'm4xshen/autoclose.nvim',
"m4xshen/autoclose.nvim",
opts = function()
return require("plugins.opts.autoclose")
end,

45
lua/plugins/linter.lua Normal file
View 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,
},
}

View File

@@ -1,35 +1,35 @@
local config = {
-- Define your formatters
formatters_by_ft = {
rust = { "rustfmt" },
lua = { "stylua" },
go = { "goimports", "gofmt" },
javascript = { "prettierd", "prettier", "biome", stop_after_first = true },
javascriptreact = { "prettierd", "prettier", "biome", stop_after_first = true },
typescript = { "prettierd", "prettier", "biome", stop_after_first = true },
typescriptreact = { "prettierd", "prettier", "biome", stop_after_first = true },
css = { "prettierd", "prettier", "biome", stop_after_first = true },
scss = { "prettierd", "prettier", "biome", stop_after_first = true },
-- python = function(bufnr)
-- if require("conform").get_formatter_info("ruff_format", bufnr).available then
-- return { "ruff_format" }
-- else
-- return { "isort", "black" }
-- end
-- end,
["_"] = { "trim_whitespace" }, -- run only on filetypes without formater
-- ["*"] = { "trim_whitespace" }, -- run in all filetypes
},
format_on_save = {
timeout_ms = 500,
lsp_format = "fallback",
},
-- Customize formatters
formatters = {
shfmt = {
prepend_args = { "-i", "2" },
},
},
-- Define your formatters
formatters_by_ft = {
rust = { "rustfmt" },
lua = { "stylua" },
go = { "goimports", "gofmt" },
javascript = { "prettierd", "prettier", "biome", stop_after_first = true },
javascriptreact = { "prettierd", "prettier", "biome", stop_after_first = true },
typescript = { "prettierd", "prettier", "biome", stop_after_first = true },
typescriptreact = { "prettierd", "prettier", "biome", stop_after_first = true },
css = { "prettierd", "prettier", "biome", stop_after_first = true },
scss = { "prettierd", "prettier", "biome", stop_after_first = true },
-- python = function(bufnr)
-- if require("conform").get_formatter_info("ruff_format", bufnr).available then
-- return { "ruff_format" }
-- else
-- return { "isort", "black" }
-- end
-- end,
["_"] = { "trim_whitespace" }, -- run only on filetypes without formater
-- ["*"] = { "trim_whitespace" }, -- run in all filetypes
},
format_on_save = {
timeout_ms = 500,
lsp_format = "fallback",
},
-- Customize formatters
formatters = {
shfmt = {
prepend_args = { "-i", "2" },
},
},
}
return config

View File

@@ -1,4 +1,31 @@
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",
priority = 1000,