Skip to content

Commit

Permalink
feat(lint/format): codespell
Browse files Browse the repository at this point in the history
  • Loading branch information
realeinherjar committed Sep 17, 2023
1 parent 251eaec commit 0cee119
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 13 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Banish those unworthy soydev IDEs to the depths of Helheim!
- Neovim: `neovim fzf ripgrep fd`
- LSPs: `bash-language-server typescript-language-server rust-analyzer
vscode-langservers-extracted pyright lua-language-server`
- Linters: `shellcheck markdownlint-cli2 luacheck ruff eslint luacheck`
- Linters: `shellcheck markdownlint-cli2 luacheck ruff eslint luacheck codespell`
- Formatters: `prettierd isort black shfmt shellharden stylua`

## Tmux
Expand Down
7 changes: 4 additions & 3 deletions lua/plugins/format.lua
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,15 @@ return {
css = { { "prettierd", "prettier" } },
javascript = { { "prettierd", "prettier" } },
typescript = { { "prettierd", "prettier" } },
["*"] = { "trim_whitespace" },
["*"] = { "codespell" },
["_"] = { "trim_whitespace" },
},
format_on_save = function(bufnr)
-- Disable with a global or buffer-local variable
if vim.g.disable_autoformat or vim.b[bufnr].disable_autoformat then
return
end
return { timeout_ms = 500, lsp_fallback = true }
return { timeout_ms = 500, lsp_fallback = "always" }
end,
})
require("conform.formatters.markdownlint").command = "markdownlint-cli2"
Expand All @@ -38,7 +39,7 @@ return {
bang = true,
})
vim.keymap.set("", "<leader>f", function()
require("conform").format({ async = true, lsp_fallback = true })
require("conform").format({ async = true, lsp_fallback = "always" })
end, { desc = "[F]ormat" })
vim.api.nvim_create_user_command("FormatEnable", function()
vim.b.disable_autoformat = false
Expand Down
18 changes: 9 additions & 9 deletions lua/plugins/lint.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ return {
local markdownlint = require("lint").linters.markdownlint
markdownlint.cmd = "markdownlint-cli2"
lint.linters_by_ft = {
python = { "ruff" }, -- requires ruff to be installed
lua = { "luacheck" }, -- requires luacheck to be installed
sh = { "shellcheck" }, -- requires shellcheck to be installed
nix = { "nix" }, -- requires nix to be installed
markdown = { "markdownlint" }, -- requires markdownlint to be installed
javascript = { "eslint" }, -- requires eslint to be installed
javascriptreact = { "eslint" }, -- requires eslint to be installe
typescript = { "eslint" }, -- requires eslint to be installed
typescriptreact = { "eslint" }, -- requires eslint to be installed
python = { "ruff", "codespell" }, -- requires ruff to be installed
lua = { "luacheck", "codespell" }, -- requires luacheck to be installed
sh = { "shellcheck", "codespell" }, -- requires shellcheck to be installed
nix = { "nix", "codespell" }, -- requires nix to be installed
markdown = { "markdownlint", "codespell" }, -- requires markdownlint to be installed
javascript = { "eslint", "codespell" }, -- requires eslint to be installed
javascriptreact = { "eslint", "codespell" }, -- requires eslint to be installed
typescript = { "eslint", "codespell" }, -- requires eslint to be installed
typescriptreact = { "eslint", "codespell" }, -- requires eslint to be installed
}
vim.api.nvim_create_autocmd({ "InsertLeave", "BufWritePost" }, {
callback = function()
Expand Down

0 comments on commit 0cee119

Please sign in to comment.