Skip to content

Commit

Permalink
v1.0.0-rc-0
Browse files Browse the repository at this point in the history
  • Loading branch information
novaugust committed May 20, 2024
1 parent 6af5537 commit 58d131c
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 5 deletions.
46 changes: 42 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 58d131c

Please sign in to comment.