diff --git a/CHANGELOG.md b/CHANGELOG.md index 3056a91..6cb3591 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,14 +2,21 @@ ## main -## 1.0.0-alpha.0 +## 1.0.0-rc.0 -An alpha! You probably want to hold off for the beta, but feel free to take this for a spin and give feedback! +At this point, 1.0.0 feels feature complete. Two things remains for a full release: -Documentation to come. +1. feedback! +2. documentation overhaul! [monitor progress here](https://github.com/adobe/elixir-styler/pull/166) ### Improvements +Styler's two biggest outstanding bugs have been fixed, both related to compilation breaking during module directive organization. One was references to aliases being moved above where the aliases were declared, and the other was similarly module directives being moved after their uses in module directives. + +In both cases, Styler is now smart enough to auto-apply the fixes we recommended in the old Readme. + +Other than that, a slew of powerful new features have been added, the neatest one (in the author's opinion anyways) being Alias Lifting. + #### Alias Lifting Along the lines of `Credo.Check.Design.AliasUsage`, Styler now "lifts" deeply nested aliases (depth >= 3, ala `A.B.C....`) that are used more than once. @@ -41,13 +48,44 @@ end To exclude modules ending in `.Foo` from being lifted, add `styler: [alias_lifting_exclude: [Foo]]` to your `.formatter.exs` +#### Module Attribute Lifting + +A long outstanding breakage of a first pass with Styler was breaking directives that relied on module attributes which Styler moved _after_ their uses. Styler now detects these potential breakages and automatically applies our suggested fix, which is creating a variable before the module. This usually happened when folks were using a library that autogenerated their moduledocs for them. + +In code, this module: + +```elixir +defmodule MyGreatLibrary do + @library_options [...] + @moduledoc make_pretty_docs(@library_options) + use OptionsMagic, my_opts: @library_options + + ... +end +``` + +Will now be styled like so: + +```elixir +library_options = [...] + +defmodule MyGreatLibrary do + @moduledoc make_pretty_docs(library_options) + use OptionsMagic, my_opts: unquote(library_options) + + @library_options library_options + + ... +end +``` + #### Mix Config File Organization Styler now organizes `Mix.Config.config/2,3` stanzas according to erlang term sorting. This helps manage large configuration files, removing the "where should I put this" burden from developers AND helping find duplicated configuration stanzas. See the moduledoc for `Styler.Style.Configs` for more. -#### Other Improvements +#### Everything Else * `if`/`unless`: invert if and unless with `!=` or `!==`, like we do for `!` and `not` #132 * `@derive`: move `@derive` before `defstruct|schema|embedded_schema` declarations (fixes compiler warning!) #134 diff --git a/mix.exs b/mix.exs index a59868d..8fa1837 100644 --- a/mix.exs +++ b/mix.exs @@ -12,7 +12,7 @@ defmodule Styler.MixProject do use Mix.Project # Don't forget to bump the README when doing non-patch version changes - @version "1.0.0-alpha.0" + @version "1.0.0-rc.0" @url "https://github.com/adobe/elixir-styler" def project do