Skip to content

Commit

Permalink
feat(neovim): linting and formatting simplified
Browse files Browse the repository at this point in the history
  • Loading branch information
AlejandroSuero committed Apr 3, 2024
1 parent 12e4dd5 commit e95c066
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 10 deletions.
10 changes: 5 additions & 5 deletions roles/neovim/files/lua/custom/plugins/editor/formatting.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ return {
opts = {
formatters_by_ft = {
lua = { "stylua" },
javascript = { { "prettierd", "prettier" } },
typescript = { { "prettierd", "prettier" } },
javascriptreact = { { "prettierd", "prettier" } },
typescriptreact = { { "prettierd", "prettier" } },
astro = { { "prettierd", "prettier" } },
javascript = { "prettierd" },
typescript = { "prettierd" },
javascriptreact = { "prettierd" },
typescriptreact = { "prettierd" },
astro = { "prettierd" },
go = { { "goimports-reviser", "golines", "gofumpt" } },
c = { "clang_format" },
},
Expand Down
20 changes: 15 additions & 5 deletions roles/neovim/files/lua/custom/plugins/editor/linting.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,26 @@ return {
config = function()
local lint = require "lint"
lint.linters_by_ft = {
javascript = { "eslint", "biomejs" },
typescript = { "eslint", "biomejs" },
javascriptreact = { "eslint", "biomejs" },
typescriptreact = { "eslint", "biomejs" },
astro = { "eslint", "biomejs" },
javascript = { "eslint_d" },
typescript = { "eslint_d" },
javascriptreact = { "eslint_d" },
typescriptreact = { "eslint_d" },
astro = { "eslint_d" },
json = { "jsonlint" },
markdown = { "markdownlint" },
lua = { "luacheck" },
go = { "golangcilint" },
yaml = { "ansible_lint", "yamllint" },
}

local lint_augroup =
vim.api.nvim_create_augroup("aome-lint", { clear = true })

vim.api.nvim_create_autocmd({ "BufEnter", "BufWritePost", "InsertLeave" }, {
group = lint_augroup,
callback = function()
lint.try_lint()
end,
})
end,
}

0 comments on commit e95c066

Please sign in to comment.