chore: remove diagnostic suppressions after tidying nits

This commit is contained in:
Alexander Courtis 2023-01-01 13:27:05 +11:00
parent 9d27c9ebea
commit e322fbb80b
8 changed files with 24 additions and 40 deletions

View File

@ -4,15 +4,6 @@
"diagnostics": {
"globals": [
"vim"
],
"disable": [
"cast-local-type",
"lowercase-global",
"missing-parameter",
"missing-return",
"missing-return-value",
"need-check-nil",
"param-type-mismatch"
]
}
}

View File

@ -30,8 +30,8 @@ function M.reload_node_status(parent_node, projects)
end
local event_running = false
---@param _ table unused node passed by action
---@param unloaded_bufnr number optional bufnr recently unloaded via BufUnload event
---@param _ table|nil unused node passed by action
---@param unloaded_bufnr number|nil optional bufnr recently unloaded via BufUnload event
function M.reload_explorer(_, unloaded_bufnr)
if event_running or not core.get_explorer() or vim.v.exiting ~= vim.NIL then
return

View File

@ -91,8 +91,8 @@ local function custom(path)
end
---Prepare arguments for should_filter. This is done prior to should_filter for efficiency reasons.
---@param git_status table results of git.load_project_status(...)
---@param unloaded_bufnr number optional bufnr recently unloaded via BufUnload event
---@param git_status table|nil optional results of git.load_project_status(...)
---@param unloaded_bufnr number|nil optional bufnr recently unloaded via BufUnload event
---@return table
--- git_status: reference
--- unloaded_bufnr: copy

View File

@ -45,7 +45,7 @@ function Runner:_handle_incoming_data(prev_output, incoming)
self._parse_status_output(line)
end
return nil
return ""
end
function Runner:_getopts(stdout_handle, stderr_handle)

View File

@ -14,16 +14,16 @@ local function refactored(opts)
end
-- 2022/06/20
utils.move_missing_val(opts, "update_focused_file", "update_cwd", opts, "update_focused_file", "update_root")
utils.move_missing_val(opts, "", "update_cwd", opts, "", "sync_root_with_cwd")
utils.move_missing_val(opts, "update_focused_file", "update_cwd", opts, "update_focused_file", "update_root", true)
utils.move_missing_val(opts, "", "update_cwd", opts, "", "sync_root_with_cwd", true)
-- 2022/11/07
utils.move_missing_val(opts, "", "open_on_tab", opts, "tab.sync", "open", false)
utils.move_missing_val(opts, "", "open_on_tab", opts, "tab.sync", "close")
utils.move_missing_val(opts, "", "ignore_buf_on_tab_change", opts, "tab.sync", "ignore")
utils.move_missing_val(opts, "", "open_on_tab", opts, "tab.sync", "close", true)
utils.move_missing_val(opts, "", "ignore_buf_on_tab_change", opts, "tab.sync", "ignore", true)
-- 2022/11/22
utils.move_missing_val(opts, "renderer", "root_folder_modifier", opts, "renderer", "root_folder_label")
utils.move_missing_val(opts, "renderer", "root_folder_modifier", opts, "renderer", "root_folder_label", true)
end
local function removed(opts)

View File

@ -14,17 +14,19 @@ function M.raw(typ, fmt, ...)
local line = string.format(fmt, ...)
local file = io.open(M.path, "a")
if file then
io.output(file)
io.write(line)
io.close(file)
end
end
--- Write to log file via M.line
--- START is prefixed
--- @return number nanos to pass to profile_end
function M.profile_start(fmt, ...)
if not M.path or not M.config.types.profile and not M.config.types.all then
return
return 0
end
M.line("profile", "START " .. (fmt or "???"), ...)
return vim.loop.hrtime()

View File

@ -197,12 +197,8 @@ end
-- Create empty sub-tables if not present
-- @param tbl to create empty inside of
-- @param path dot separated string of sub-tables
-- @return deepest sub-table
-- @return table deepest sub-table
function M.table_create_missing(tbl, path)
if tbl == nil then
return nil
end
local t = tbl
for s in string.gmatch(path, "([^%.]+)%.*") do
if t[s] == nil then
@ -222,12 +218,8 @@ end
--- @param dst table to copy to
--- @param dst_path string dot separated string of sub-tables, created when missing
--- @param dst_pos string value pos
--- @param remove boolean default true
--- @param remove boolean
function M.move_missing_val(src, src_path, src_pos, dst, dst_path, dst_pos, remove)
if remove == nil then
remove = true
end
local ok, err = pcall(vim.validate, {
src = { src, "table" },
src_path = { src_path, "string" },
@ -246,11 +238,10 @@ function M.move_missing_val(src, src_path, src_pos, dst, dst_path, dst_pos, remo
if src[pos] and type(src[pos]) == "table" then
src = src[pos]
else
src = nil
break
return
end
end
local src_val = src and src[src_pos]
local src_val = src[src_pos]
if src_val == nil then
return
end

View File

@ -389,8 +389,8 @@ function M.restore_tab_state()
end
--- Returns the window number for nvim-tree within the tabpage specified
---@param tabpage number: (optional) the number of the chosen tabpage. Defaults to current tabpage.
---@return number
---@param tabpage number|nil (optional) the number of the chosen tabpage. Defaults to current tabpage.
---@return number|nil
function M.get_winnr(tabpage)
tabpage = tabpage or vim.api.nvim_get_current_tabpage()
local tabinfo = M.View.tabpages[tabpage]
@ -406,8 +406,8 @@ function M.get_bufnr()
end
--- Checks if nvim-tree is displaying the help ui within the tabpage specified
---@param tabpage number: (optional) the number of the chosen tabpage. Defaults to current tabpage.
---@return number
---@param tabpage number|nil (optional) the number of the chosen tabpage. Defaults to current tabpage.
---@return number|nil
function M.is_help_ui(tabpage)
tabpage = tabpage or vim.api.nvim_get_current_tabpage()
local tabinfo = M.View.tabpages[tabpage]