Repository: phoenixframework/phoenix
Pull request #4971 (2022-09-23 14:03:07)

Fix typos
Found via `codespell -S priv,assets,deps -L inflight,statics,nwe,reenable,warmup,froms,noes,cant`


Patch:
diff --git a/installer/templates/phx_web/components.ex b/installer/templates/phx_web/components.ex
index 25e7dca99..897d4fe7f 100644
--- a/installer/templates/phx_web/components.ex
+++ b/installer/templates/phx_web/components.ex
@@ -128,7 +128,7 @@ defmodule <%= @web_namespace %>.Components do
   attr :title, :string, default: nil
   attr :rest, :global
   attr :kind, :atom, doc: "one of :info, :error used for styling and flash lookup"
-  attr :autoshow, :boolean, default: true, doc: "wether to auto show the flash on mount"
+  attr :autoshow, :boolean, default: true, doc: "whether to auto show the flash on mount"
   attr :close, :boolean, default: true, doc: "whether the flash can be closed"
 
   slot :inner_block, doc: "the optional inner block that renders the flash message"
@@ -140,6 +140,7 @@ defmodule <%= @web_namespace %>.Components do
       id={@id}
       phx-mounted={@autoshow && show("##{@id}")}
       phx-click={JS.push("lv:clear-flash", value: %{key: @kind}) |> hide("#flash")}
+      role="alert"
       class={[
         "fixed hidden top-2 right-2 w-96 z-50 rounded-lg p-3 shadow-md shadow-zinc-900/5 ring-1",
         @kind == :info && "bg-emerald-50 text-emerald-800 ring-emerald-500 fill-cyan-900",
@@ -147,15 +148,15 @@ defmodule <%= @web_namespace %>.Components do
       ]}
       {@rest}
     >
-      <button :if={@close} type="button" class="group absolute top-2 right-1 p-2" aria-label="Close">
-        <Heroicons.x_mark solid class="h-5 w-5 stroke-current opacity-40 group-hover:opacity-70" />
-      </button>
       <p :if={@title} class="flex items-center gap-1.5 text-[0.8125rem] font-semibold leading-6">
         <Heroicons.information_circle :if={@kind == :info} mini class="h-4 w-4" />
         <Heroicons.exclamation_circle :if={@kind == :error} mini class="h-4 w-4" />
         <%%= @title %>
       </p>
       <p class="mt-2 text-[0.8125rem] leading-5"><%%= msg %></p>
+      <button :if={@close} type="button" class="group absolute top-2 right-1 p-2" aria-label="Close">
+        <Heroicons.x_mark solid class="h-5 w-5 stroke-current opacity-40 group-hover:opacity-70" />
+      </button>
     </div>
     """
   end
@@ -175,7 +176,7 @@ defmodule <%= @web_namespace %>.Components do
   """
   attr :for, :any, default: nil, doc: "the datastructure for the form"
   attr :as, :any, default: nil, doc: "the server side parameter to collect all input under"
-  attr :rest, :global, doc: "the arbitraty HTML attributes to apply to the form tag"
+  attr :rest, :global, doc: "the arbitrary HTML attributes to apply to the form tag"
 
   slot :inner_block, required: true
   slot :actions, doc: "the slot for form actions, such as a submit button"
@@ -203,7 +204,7 @@ defmodule <%= @web_namespace %>.Components do
   """
   attr :type, :string, default: nil
   attr :class, :string, default: nil
-  attr :rest, :global, doc: "the arbitraty HTML attributes to apply to the button tag"
+  attr :rest, :global, doc: "the arbitrary HTML attributes to apply to the button tag"
 
   slot :inner_block, required: true
 
@@ -542,7 +543,7 @@ defmodule <%= @web_namespace %>.Components do
       transition: {"transition-all transform ease-out duration-300", "opacity-0", "opacity-100"}
     )
     |> show("##{id}-container")
-    |> JS.focus_first(to: "##{id}-container")
+    |> JS.focus_first(to: "##{id}-content")
   end
 
   def hide_modal(js \\ %JS{}, id) do
diff --git a/lib/phoenix/router/helpers.ex b/lib/phoenix/router/helpers.ex
index 97bd2cec9..f7a8f6c4f 100644
--- a/lib/phoenix/router/helpers.ex
+++ b/lib/phoenix/router/helpers.ex
@@ -278,7 +278,7 @@ defmodule Phoenix.Router.Helpers do
       |> Enum.map(fn {_, bindings} -> length(bindings) end)
       |> Enum.uniq()
 
-    # Each helper defines catch alls like this:
+    # Each helper defines catch all like this:
     #
     #     def helper_path(context, action, ...binding)
     #     def helper_path(context, action, ...binding, params)
@@ -299,7 +299,7 @@ defmodule Phoenix.Router.Helpers do
   end
 
   @doc """
-  Callback for generate router catch alls.
+  Callback for generate router catch all.
   """
   def raise_route_error(mod, fun, arity, action, routes, params) do
     cond do
diff --git a/priv/templates/phx.gen.live/components.ex b/priv/templates/phx.gen.live/components.ex
index 25e7dca99..0391234ae 100644
--- a/priv/templates/phx.gen.live/components.ex
+++ b/priv/templates/phx.gen.live/components.ex
@@ -36,7 +36,7 @@ defmodule <%= @web_namespace %>.Components do
       <.modal>
   """
   attr :id, :string, required: true
-  attr :show, :boolean, default: false
+  attr :show, :boolean, default: false, doc: "show the modal automatically"
   attr :on_cancel, JS, default: %JS{}
   attr :on_confirm, JS, default: %JS{}
 


Test patch:
diff --git a/test/phoenix/endpoint/supervisor_test.exs b/test/phoenix/endpoint/supervisor_test.exs
index 3d3c03432..ede199d1a 100644
--- a/test/phoenix/endpoint/supervisor_test.exs
+++ b/test/phoenix/endpoint/supervisor_test.exs
@@ -96,7 +96,7 @@ defmodule Phoenix.Endpoint.SupervisorTest do
              end)
     end
 
-    test "init/1 doesnt start watchers when `:server` config is false" do
+    test "init/1 doesn't start watchers when `:server` config is false" do
       Application.put_env(:phoenix, WatchersEndpoint, server: false, watchers: @watchers)
       {:ok, {_, children}} = Supervisor.init({:phoenix, WatchersEndpoint, []})
 
diff --git a/test/phoenix/router/pipeline_test.exs b/test/phoenix/router/pipeline_test.exs
index 2838c2b2c..c3fd75b4c 100644
--- a/test/phoenix/router/pipeline_test.exs
+++ b/test/phoenix/router/pipeline_test.exs
@@ -160,7 +160,7 @@ defmodule Phoenix.Router.PipelineTest do
   end
 
   test "pipeline raises on conflict" do
-    assert_raise ArgumentError, ~r{there is an import from Kernel with the same nam}, fn ->
+    assert_raise ArgumentError, ~r{there is an import from Kernel with the same name}, fn ->
       defmodule ConflictingPipeline do
         use Phoenix.Router, otp_app: :phoenix
         pipeline :raise do