chore: lint

This commit is contained in:
mpaulson 2023-12-10 12:51:03 -07:00
parent 5a3195e7bf
commit d043904d1e
5 changed files with 17 additions and 25 deletions

View File

@ -49,26 +49,17 @@ function M.setup_autocmds_and_keymaps(bufnr)
end
vim.api.nvim_buf_set_option(bufnr, "filetype", "harpoon")
vim.keymap.set(
"n",
"q",
function() M.run_toggle_command("q") end,
{ buffer = bufnr, silent = true }
)
vim.keymap.set("n", "q", function()
M.run_toggle_command("q")
end, { buffer = bufnr, silent = true })
vim.keymap.set(
"n",
"<Esc>",
function() M.run_toggle_command("Esc") end,
{ buffer = bufnr, silent = true }
)
vim.keymap.set("n", "<Esc>", function()
M.run_toggle_command("Esc")
end, { buffer = bufnr, silent = true })
vim.keymap.set(
"n",
"<CR>",
function() M.run_select_command() end,
{ buffer = bufnr, silent = true }
)
vim.keymap.set("n", "<CR>", function()
M.run_select_command()
end, { buffer = bufnr, silent = true })
vim.api.nvim_create_autocmd({ "BufWriteCmd" }, {
group = HarpoonGroup,

View File

@ -59,7 +59,7 @@ local function read_data()
local out_data = path:read()
if not out_data or out_data == '' then
if not out_data or out_data == "" then
write_data({})
out_data = path:read()
end

View File

@ -100,7 +100,10 @@ end
---@return HarpoonList
function HarpoonList:removeAt(index)
if self.items[index] then
Logger:log("HarpoonList:removeAt", { item = self.items[index], index = index })
Logger:log(
"HarpoonList:removeAt",
{ item = self.items[index], index = index }
)
Listeners.listeners:emit(
Listeners.event_names.REMOVE,
{ list = self, item = self.items[index], idx = index }

View File

@ -51,7 +51,7 @@ function HarpoonLog:log(...)
table.insert(self.lines, table.concat(lines, " "))
while #self.lines > self.max_lines do
while #self.lines > self.max_lines do
table.remove(self.lines, 1)
end
end

View File

@ -14,8 +14,8 @@ describe("harpoon", function()
end)
it("new lines with vim.inspect get removed too", function()
Logger:log({hello = "world", world = "hello"})
eq({ "{ hello = \"world\", world = \"hello\" }" }, Logger.lines)
Logger:log({ hello = "world", world = "hello" })
eq({ '{ hello = "world", world = "hello" }' }, Logger.lines)
end)
it("max lines", function()
@ -25,6 +25,4 @@ describe("harpoon", function()
Logger:log("two")
eq({ "two" }, Logger.lines)
end)
end)