Skip to content

Commit 4e013e0

Browse files
committed
v1.10.1
1 parent 6055b07 commit 4e013e0

File tree

5 files changed

+13
-7
lines changed

5 files changed

+13
-7
lines changed

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,12 @@ The fastest way to see what all it can do you for you is to just try it out in y
2121
- rewrites deprecated Elixir standard library code, speeding adoption of new releases
2222
- auto-fixes many credo rules, meaning you can spend less time fighting with CI
2323

24+
### Refactoring Mix Tasks
25+
26+
Styler also includes two experimental refactoring tasks:
27+
- `mix styler.remove_unused`: deletes unused `import|alias|require` nodes that generate compiler warnings
28+
- `mix styler.inline_attrs <file>`: inlines module attributes that have a literal value and are only referenced once, removing unnecessary indirection
29+
2430
## Who is Styler for?
2531

2632
> I'm just excited to be on a team that uses Styler and moves on

docs/module_directives.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,10 @@ alias Foo.Baz.A
126126
alias Foo.Bop
127127
```
128128

129+
## Remove Unnecessary / Basic Aliases
130+
131+
Styler removes root node or single aliases like `alias Foo`, as they accomplish nothing.
132+
129133
## Alias Lifting
130134

131135
When a module with three parts is referenced two or more times, styler creates a new alias for that module and uses it.

lib/mix/tasks/inline_attributes.ex

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,7 @@
1111
defmodule Mix.Tasks.Styler.InlineAttrs do
1212
@shortdoc "EXPERIMENTAL: inlines module attributes with literal values that are only referenced once"
1313
@moduledoc """
14-
WARNING: EXPERIMENTAL
15-
16-
Inlines module attributes that are only referenced once in their module.
14+
WARNING: EXPERIMENTAL | Inlines module attributes that are only referenced once in their module.
1715
1816
**This is known to create invalid code.** It's far from perfect.
1917
It can still be a helpful first step in refactoring though.

lib/mix/tasks/remove_unused.ex

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,7 @@
1111
defmodule Mix.Tasks.Styler.RemoveUnused do
1212
@shortdoc "EXPERIMENTAL: uses unused import/alias/require compiler warnings to remove those lines"
1313
@moduledoc """
14-
WARNING: EXPERIMENTAL
15-
16-
Removes unused import/alias/require statements by compiling the app and parsing warnings, then deleting the specified lines.
14+
WARNING: EXPERIMENTAL | Removes unused import/alias/require statements by compiling the app and parsing warnings, then deleting the specified lines.
1715
1816
Usage:
1917

mix.exs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ defmodule Styler.MixProject do
1212
use Mix.Project
1313

1414
# Don't forget to bump the README when doing non-patch version changes
15-
@version "1.10.0"
15+
@version "1.10.1"
1616
@url "https://github.com/adobe/elixir-styler"
1717

1818
def project do

0 commit comments

Comments
 (0)