File tree Expand file tree Collapse file tree 5 files changed +13
-7
lines changed
Expand file tree Collapse file tree 5 files changed +13
-7
lines changed Original file line number Diff line number Diff 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
Original file line number Diff line number Diff line change @@ -126,6 +126,10 @@ alias Foo.Baz.A
126126alias 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
131135When a module with three parts is referenced two or more times, styler creates a new alias for that module and uses it.
Original file line number Diff line number Diff line change 1111defmodule 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.
Original file line number Diff line number Diff line change 1111defmodule 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
Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments