Skip to content

Commit

Permalink
fix: set quoted default to handle regex escaping issues
Browse files Browse the repository at this point in the history
  • Loading branch information
zachdaniel committed Dec 13, 2024
1 parent 0c49284 commit a8c41cc
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions lib/igniter/project/igniter_config.ex
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,11 @@ defmodule Igniter.Project.IgniterConfig do
"A list of strings or regexes. Any files that equal (in the case of strings) or match (in the case of regexes) will not be moved.",
default: [
~r"lib/mix"
]
],
quoted_default:
quote do
[~r"lib/mix"]
end
]
]

Expand Down Expand Up @@ -165,9 +169,10 @@ defmodule Igniter.Project.IgniterConfig do
if Igniter.Code.List.list?(rightmost) do
Enum.reduce_while(@configs, {:ok, zipper}, fn {name, config}, {:ok, zipper} ->
default =
quote do
unquote(config[:default])
end
config[:quoted_default] ||
quote do
unquote(Macro.escape(config[:default]))
end

set_result =
Igniter.Code.Common.within(zipper, fn zipper ->
Expand Down

0 comments on commit a8c41cc

Please sign in to comment.