summaryrefslogtreecommitdiff
path: root/lua/ache/plugins
diff options
context:
space:
mode:
authorache <ache@ache.one>2024-08-09 06:00:41 +0200
committerache <ache@ache.one>2024-08-09 06:00:41 +0200
commitc6a388aeef9f7a8832c4860316a14ce680c039d5 (patch)
tree0047e5476cacbe70c511429bcfd8a3686da47180 /lua/ache/plugins
parentSupport for multiple colorschemes (diff)
Lintting ESLint without config
Diffstat (limited to 'lua/ache/plugins')
-rw-r--r--lua/ache/plugins/linting.lua59
1 files changed, 37 insertions, 22 deletions
diff --git a/lua/ache/plugins/linting.lua b/lua/ache/plugins/linting.lua
index 253107e..e6be595 100644
--- a/lua/ache/plugins/linting.lua
+++ b/lua/ache/plugins/linting.lua
@@ -1,28 +1,43 @@
+-- TODO: Add explaination of how to configure and how does it works
+--
return {
- "mfussenegger/nvim-lint",
- event = { "BufReadPre", "BufNewFile" },
- config = function()
- local lint = require("lint")
+ "mfussenegger/nvim-lint",
+ event = { "BufReadPre", "BufNewFile" },
+ config = function()
+ local lint = require("lint")
- lint.linters_by_ft = {
- javascript = { "eslint_d" },
- typescript = { "eslint_d" },
- svelte = { "eslint_d" },
- python = { "ruff" },
- }
+ lint.linters_by_ft = {
+ javascript = { "eslint_d" },
+ typescript = { "eslint_d" },
+ svelte = { "eslint_d" },
+ python = { "ruff" },
+ }
- local lint_augroup = vim.api.nvim_create_augroup("lint", { clear = true })
+ local lint_augroup = vim.api.nvim_create_augroup("lint", { clear = true })
+ local eslint = lint.linters.eslint_d
- vim.api.nvim_create_autocmd({ "BufEnter", "BufWritePost", "InsertLeave" }, {
- group = lint_augroup,
- callback = function()
- lint.try_lint()
- end,
- })
+ -- To ignore missing configuration
+ eslint.args = {
+ "--no-warn-ignored",
+ "--format",
+ "json",
+ "--stdin",
+ "--stdin-filename",
+ function()
+ return vim.api.nvim_buf_get_name(0)
+ end,
+ }
- vim.keymap.set("n", "<leader>l", function()
- lint.try_lint()
- -- TODO: Linting for file or buffer ?
- end, { desc = "Trigger linting for current file" })
- end,
+ vim.api.nvim_create_autocmd({ "BufEnter", "BufWritePost", "InsertLeave" }, {
+ group = lint_augroup,
+ callback = function()
+ lint.try_lint()
+ end,
+ })
+
+ vim.keymap.set("n", "<leader>l", function()
+ lint.try_lint()
+ -- TODO: Linting for file or buffer ?
+ end, { desc = "Trigger linting for current file" })
+ end,
}