lint: stricter type checking
This commit is contained in:
parent
f60bb7f793
commit
1360be5fda
9 changed files with 25 additions and 3 deletions
9
.luarc.json
Normal file
9
.luarc.json
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
{
|
||||||
|
"runtime": {
|
||||||
|
"version": "LuaJIT",
|
||||||
|
"pathStrict": true
|
||||||
|
},
|
||||||
|
"type": {
|
||||||
|
"checkTableShape": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -34,6 +34,9 @@ local function read_link_data(path, cb)
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
---@class (exact) oil.FilesAdapter: oil.Adapter
|
||||||
|
---@field to_short_os_path fun(path: string, entry_type: nil|oil.EntryType): string
|
||||||
|
|
||||||
---@param path string
|
---@param path string
|
||||||
---@param entry_type nil|oil.EntryType
|
---@param entry_type nil|oil.EntryType
|
||||||
---@return string
|
---@return string
|
||||||
|
|
@ -284,6 +287,7 @@ end
|
||||||
---@param column_defs string[]
|
---@param column_defs string[]
|
||||||
---@param cb fun(err?: string, entries?: oil.InternalEntry[], fetch_more?: fun())
|
---@param cb fun(err?: string, entries?: oil.InternalEntry[], fetch_more?: fun())
|
||||||
local function list_windows_drives(url, column_defs, cb)
|
local function list_windows_drives(url, column_defs, cb)
|
||||||
|
---@cast M oil.FilesAdapter
|
||||||
local fetch_meta = columns.get_metadata_fetcher(M, column_defs)
|
local fetch_meta = columns.get_metadata_fetcher(M, column_defs)
|
||||||
local stdout = ""
|
local stdout = ""
|
||||||
local jid = vim.fn.jobstart({ "wmic", "logicaldisk", "get", "name" }, {
|
local jid = vim.fn.jobstart({ "wmic", "logicaldisk", "get", "name" }, {
|
||||||
|
|
@ -341,6 +345,7 @@ M.list = function(url, column_defs, cb)
|
||||||
return list_windows_drives(url, column_defs, cb)
|
return list_windows_drives(url, column_defs, cb)
|
||||||
end
|
end
|
||||||
local dir = fs.posix_to_os_path(path)
|
local dir = fs.posix_to_os_path(path)
|
||||||
|
---@cast M oil.Adapter
|
||||||
local fetch_meta = columns.get_metadata_fetcher(M, column_defs)
|
local fetch_meta = columns.get_metadata_fetcher(M, column_defs)
|
||||||
|
|
||||||
---@diagnostic disable-next-line: param-type-mismatch, discard-returns
|
---@diagnostic disable-next-line: param-type-mismatch, discard-returns
|
||||||
|
|
|
||||||
|
|
@ -50,6 +50,7 @@ M.parse_url = function(oil_url)
|
||||||
error(string.format("Malformed SSH url: %s", oil_url))
|
error(string.format("Malformed SSH url: %s", oil_url))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
---@cast ret oil.sshUrl
|
||||||
return ret
|
return ret
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -440,6 +441,7 @@ M.goto_file = function()
|
||||||
url.path = vim.fs.dirname(fullpath)
|
url.path = vim.fs.dirname(fullpath)
|
||||||
local parurl = url_to_str(url)
|
local parurl = url_to_str(url)
|
||||||
|
|
||||||
|
---@cast M oil.Adapter
|
||||||
util.adapter_list_all(M, parurl, {}, function(err, entries)
|
util.adapter_list_all(M, parurl, {}, function(err, entries)
|
||||||
if err then
|
if err then
|
||||||
vim.notify(string.format("Error finding file '%s': %s", fname, err), vim.log.levels.ERROR)
|
vim.notify(string.format("Error finding file '%s': %s", fname, err), vim.log.levels.ERROR)
|
||||||
|
|
|
||||||
|
|
@ -176,6 +176,7 @@ function SSHConnection.new(url)
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
---@cast self oil.sshConnection
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -70,6 +70,7 @@ end
|
||||||
---@param url oil.sshUrl
|
---@param url oil.sshUrl
|
||||||
---@return oil.sshFs
|
---@return oil.sshFs
|
||||||
function SSHFS.new(url)
|
function SSHFS.new(url)
|
||||||
|
---@type oil.sshFs
|
||||||
return setmetatable({
|
return setmetatable({
|
||||||
conn = SSHConnection.new(url),
|
conn = SSHConnection.new(url),
|
||||||
}, {
|
}, {
|
||||||
|
|
|
||||||
|
|
@ -210,6 +210,7 @@ local function read_trash_info(info_file, cb)
|
||||||
cb(".trashinfo file points to non-existant file")
|
cb(".trashinfo file points to non-existant file")
|
||||||
else
|
else
|
||||||
trash_info.stat = trash_stat
|
trash_info.stat = trash_stat
|
||||||
|
---@cast trash_info oil.TrashInfo
|
||||||
cb(nil, trash_info)
|
cb(nil, trash_info)
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,7 @@ function PowershellConnection.new(init_command)
|
||||||
|
|
||||||
self:_init(init_command)
|
self:_init(init_command)
|
||||||
|
|
||||||
|
---@type oil.PowershellConnection
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -98,7 +98,7 @@ M.calculate_height = function(desired_height, opts)
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
---@class (exact) conform.WinLayout
|
---@class (exact) oil.WinLayout
|
||||||
---@field width integer
|
---@field width integer
|
||||||
---@field height integer
|
---@field height integer
|
||||||
---@field row integer
|
---@field row integer
|
||||||
|
|
@ -139,14 +139,15 @@ end
|
||||||
---@param winid integer
|
---@param winid integer
|
||||||
---@param direction "above"|"below"|"left"|"right"|"auto"
|
---@param direction "above"|"below"|"left"|"right"|"auto"
|
||||||
---@param gap integer
|
---@param gap integer
|
||||||
---@return conform.WinLayout root_dim New dimensions of the original window
|
---@return oil.WinLayout root_dim New dimensions of the original window
|
||||||
---@return conform.WinLayout new_dim New dimensions of the new window
|
---@return oil.WinLayout new_dim New dimensions of the new window
|
||||||
M.split_window = function(winid, direction, gap)
|
M.split_window = function(winid, direction, gap)
|
||||||
if direction == "auto" then
|
if direction == "auto" then
|
||||||
direction = vim.o.splitright and "right" or "left"
|
direction = vim.o.splitright and "right" or "left"
|
||||||
end
|
end
|
||||||
|
|
||||||
local float_config = vim.api.nvim_win_get_config(winid)
|
local float_config = vim.api.nvim_win_get_config(winid)
|
||||||
|
---@type oil.WinLayout
|
||||||
local dim_root = {
|
local dim_root = {
|
||||||
width = float_config.width,
|
width = float_config.width,
|
||||||
height = float_config.height,
|
height = float_config.height,
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ local Trie = {}
|
||||||
|
|
||||||
---@return oil.Trie
|
---@return oil.Trie
|
||||||
Trie.new = function()
|
Trie.new = function()
|
||||||
|
---@type oil.Trie
|
||||||
return setmetatable({
|
return setmetatable({
|
||||||
root = { values = {}, children = {} },
|
root = { values = {}, children = {} },
|
||||||
}, {
|
}, {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue