Skip to content

Commit d4383f0

Browse files
committed
style: apply stylua formatting
1 parent a0120b0 commit d4383f0

3 files changed

Lines changed: 11 additions & 10 deletions

File tree

‎lua/effect-error-pretty/parse.lua‎

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -203,11 +203,8 @@ function M.parse(msg, opts)
203203

204204
-- TS often appends follow-up sentences after the core error; strip them so
205205
-- the `$`-anchored patterns below can still match.
206-
msg = msg
207-
:gsub("\n.*", "")
208-
:gsub("%.%s+Property.-$", "")
209-
:gsub(" with '[^']+': %w+%'.-$", "")
210-
:gsub(" with '[^']+'.-$", "")
206+
msg =
207+
msg:gsub("\n.*", ""):gsub("%.%s+Property.-$", ""):gsub(" with '[^']+': %w+%'.-$", ""):gsub(" with '[^']+'.-$", "")
211208

212209
local got, expected = msg:match("Type '(.+)' is not assignable to type '(.+)'%.?$")
213210
if not got then

‎lua/effect-error-pretty/render.lua‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,9 @@ function M.artistic(diagnostic, opts)
252252
elseif parsed.kind == "undefined" then
253253
return "╭─ ❓ Undefined Reference\n│\n│ ✗ '" .. parsed.name .. "' is not defined\n╰─"
254254
elseif parsed.kind == "module_not_found" then
255-
return "╭─ 🔗 Module Not Found\n│\n│ ✗ '" .. parsed.path .. "'\n│ ⚡ Check path or install types\n╰─"
255+
return "╭─ 🔗 Module Not Found\n│\n│ ✗ '"
256+
.. parsed.path
257+
.. "'\n│ ⚡ Check path or install types\n╰─"
256258
elseif parsed.kind == "export_not_found" then
257259
return ("╭─ 🔗 Export Not Found\n│\n│ ✗ '%s'\n│ ◇ not exported from '%s'\n╰─"):format(
258260
parsed.member,
@@ -267,7 +269,10 @@ function M.artistic(diagnostic, opts)
267269
.. parsed.value
268270
.. "\n│ ⚡ Add optional chaining (?.) or null check\n╰─"
269271
elseif parsed.kind == "arg_count" then
270-
return ("╭─ 🔢 Argument Count\n│\n│ ✗ Got %s args, expected %s\n╰─"):format(parsed.got, parsed.expected)
272+
return ("╭─ 🔢 Argument Count\n│\n│ ✗ Got %s args, expected %s\n╰─"):format(
273+
parsed.got,
274+
parsed.expected
275+
)
271276
elseif parsed.kind == "const_assign" then
272277
return "╭─ 🔒 Constant Assignment\n│\n│ ✗ '" .. parsed.name .. "' is readonly\n╰─"
273278
elseif parsed.kind == "deprecated" then

‎tests/parse_spec.lua‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -141,9 +141,8 @@ describe("parse.parse — Effect patterns", function()
141141
end)
142142

143143
it("effect_mismatch: scope required", function()
144-
local r = parse.parse(
145-
"Type 'Effect<string, never, Scope>' is not assignable to type 'Effect<string, never, never>'."
146-
)
144+
local r =
145+
parse.parse("Type 'Effect<string, never, Scope>' is not assignable to type 'Effect<string, never, never>'.")
147146
assert.are.equal("effect_mismatch", r.kind)
148147
assert.is_true(r.scope_required)
149148
assert.are.same({ "Scope" }, r.missing_services)

0 commit comments

Comments
 (0)