Skip to content

Commit

Permalink
v1.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
novaugust committed Jan 13, 2025
1 parent cef6015 commit 13bc947
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 3 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
they can and will change without that change being reflected in Styler's semantic version.
## main

## 1.3.0

### Improvements

#### `# styler:sort` Styler's first comment directive
Expand Down
64 changes: 62 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@ You can learn more about the history, purpose and implementation of Styler from

## Features

- auto-fixes [many credo rules](docs/credo.md), meaning you can turn them off to speed credo up
### AST Rewrites as part of `mix format`

[See our Rewrites documentation on hexdocs](https://hexdocs.pm/styler/styles.html)
Styler fixes a plethora of elixir style and optimization issues automatically as part of `mix format`. In addition to automating corrections for [many credo rules](docs/credo.md) (meaning you can turn them off to speed credo up), Styler:

- [keeps a strict module layout](docs/module_directives.md#directive-organization)
- alphabetizes module directives
- [extracts repeated aliases](docs/module_directives.md#alias-lifting)
Expand All @@ -21,7 +25,63 @@ You can learn more about the history, purpose and implementation of Styler from
- replaces strings with sigils when the string has many escaped quotes
- ... and so much more

[See our Rewrites documentation on hexdocs](https://hexdocs.pm/styler/styles.html)
### Maintain static list order via `# styler:sort`

Styler can keep static values sorted for your team as part of its formatting pass. To instruct it to do so, replace any `# Please keep this list sorted!` notes you wrote to your teammates with `# styler:sort`.

#### Examples

```elixir
# styler:sort
[:c, :a, :b]

# styler:sort
~w(a list of words)

# styler:sort
@country_codes ~w(
en_US
po_PO
fr_CA
ja_JP
)

# styler:sort
a_var =
[
Modules,
In,
A,
List
]
```

Would yield:

```elixir
# styler:sort
[:a, :b, :c]

# styler:sort
~w(a list of words)

# styler:sort
@country_codes ~w(
en_US
fr_CA
ja_JP
po_PO
)

# styler:sort
a_var =
[
A,
In,
List,
Modules
]
```

## Who is Styler for?

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.2.1"
@version "1.3.0"
@url "https://github.com/adobe/elixir-styler"

def project do
Expand Down

0 comments on commit 13bc947

Please sign in to comment.