### Styler Code Rewriting Example: Case to If Source: https://hexdocs.pm/styler/1.9.1/styler This example illustrates a potential behavioral change introduced by Styler. It shows how a `case` statement that would raise an error for non-boolean inputs can be rewritten by Styler into an `if` statement, which might not raise an error in the same scenarios. ```elixir # Before: this case statement... case foo do true -> :ok false -> :error end # After: ... is rewritten by Styler to be an if statement!. if foo do :ok else :error end ``` -------------------------------- ### Configure Styler Plugin in .formatter.exs Source: https://hexdocs.pm/styler/1.9.1/styler This code adds Styler as a plugin to your `.formatter.exs` file, enabling its formatting and rewriting capabilities when you run `mix format`. This is the primary way to activate Styler in your project. ```elixir [ plugins: [Styler] ] ``` -------------------------------- ### Add Styler Dependency to mix.exs Source: https://hexdocs.pm/styler/1.9.1/styler This snippet shows how to add Styler as a development and test dependency in your Elixir project's `mix.exs` file. It specifies the version and ensures Styler is only used during development and testing. ```elixir def deps do [ {:styler, ">= 1.9", only: [:dev, :test], runtime: false} ] end ``` -------------------------------- ### Configure Styler Options in .formatter.exs Source: https://hexdocs.pm/styler/1.9.1/styler This snippet demonstrates advanced Styler configuration within your `.formatter.exs` file. It shows how to set `alias_lifting_exclude` to prevent specific modules from being auto-aliased and `minimum_supported_elixir_version` to control deprecation rewrites. ```elixir [ plugins: [Styler], styler: alias_lifting_exclude: [...], minimum_supported_elixir_version: "..." ] ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.