Skip to content

Commit

Permalink
fix(setup): Fixes setup and types
Browse files Browse the repository at this point in the history
  • Loading branch information
vinicius507 committed Dec 17, 2024
1 parent 3d9595f commit 72269c7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
11 changes: 6 additions & 5 deletions lua/ft_nvim/header/init.lua
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---@class ft_nvim.HeaderConfig
---@field enabled boolean
---@field username string?
---@field email string?
---@field enabled? boolean
---@field username? string
---@field email? string
---
---Example:
---@code
Expand All @@ -22,9 +22,10 @@ local default_opts = {
return {
---@type fun(opts: ft_nvim.HeaderConfig)
setup = function(opts)
opts = vim.tbl_extend("force", default_opts, opts)
opts = vim.tbl_extend("force", default_opts, opts or {})

vim.validate({
enabled = { opts.enabled, "boolean" },
enabled = { opts.enabled, "boolean", true },
username = { opts.username, "string", true },
email = { opts.email, "string", true },
})
Expand Down
7 changes: 4 additions & 3 deletions lua/ft_nvim/norminette/init.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---@class ft_nvim.NorminetteConfig
---@field enabled boolean
---@field enabled? boolean
---@field cmd? string
---@field condition? fun(): boolean
---
Expand Down Expand Up @@ -63,9 +63,10 @@ end
return {
---@type fun(opts: ft_nvim.NorminetteConfig)
setup = function(opts)
opts = vim.tbl_extend("force", default_opts, opts)
opts = vim.tbl_extend("force", default_opts, opts or {})

vim.validate({
enabled = { opts.enabled, "boolean" },
enabled = { opts.enabled, "boolean", true },
cmd = { opts.cmd, "string", true },
condition = { opts.condition, "function", true },
})
Expand Down

0 comments on commit 72269c7

Please sign in to comment.