Skip to content

Commit

Permalink
v1.0.0-rc.1
Browse files Browse the repository at this point in the history
  • Loading branch information
novaugust committed Jun 12, 2024
1 parent ef585a4 commit f09321a
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 14 deletions.
12 changes: 8 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,15 @@ they can and will change without that change being reflected in Styler's semanti

## main

### Fixes
## 1.0.0-rc.1


### Improvements

* rewrite `a |> Enum.map(m) |> Enum.join()` to `map_join(a, m)`. we already did this for `join/2`, but missed the case for `join/1`
* Lots of documentation added. Nearly done and ready for 1.0.0.
* `Enum.into(x, [])` => `Enum.to_list(x)`
* `Enum.into(x, [], mapper)` => `Enum.map(x, mapper)`
* `a |> Enum.map(m) |> Enum.join()` to `map_join(a, m)`. we already did this for `join/2`, but missed the case for `join/1`

## 1.0.0-rc.0

Expand Down Expand Up @@ -101,8 +107,6 @@ See the moduledoc for `Styler.Style.Configs` for more.
* `Map.drop(foo, [single_key])` => `Map.delete(foo, single_key)` #161 (also in pipes)
* `Keyword.drop(foo, [single_key])` => `Keyword.delete(foo, single_key)` #161 (also in pipes)
* `lhs |> Enum.reverse() |> Kernel.++(enum)` => `lhs |> Enum.reverse(enum)`
* `Enum.into(x, [])` => `Enum.to_list(x)`
* `Enum.into(x, [], mapper)` => `Enum.map(x, mapper)`

### Fixes

Expand Down
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ 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
- [keeping a strict module layout](docs/module_directives.md#directive-organization)
- alphabetizing module directives
- [extracting repeated aliases](docs/moduledirectives.md#alias-lifting)
- piping and unpiping function calls based on the number of functons
- optimizing standard library calls (`a |> Enum.map(m) |> Enum.into(Map.new)` => `Map.new(a, m)`)
- using sigils for strings with many escaped quotes `\"`
- ... and so many other things.
- [keeps a strict module layout](docs/module_directives.md#directive-organization)
- alphabetizes module directives
- [extracts repeated aliases](docs/module_directives.md#alias-lifting)
- pipes and unpipes function calls based on the number of calls
- optimizes standard library calls (`a |> Enum.map(m) |> Enum.into(Map.new)` => `Map.new(a, m)`)
- replaces strings with sigils when the string has many escaped quotes
- ... and so much more

[See our Rewrites documentation on hexdocs for all the nitty-gritty on what all Styler does](https://hexdocs.pm/styler/)

Expand All @@ -37,7 +37,7 @@ Add `:styler` as a dependency to your project's `mix.exs`:
```elixir
def deps do
[
{:styler, "~> 1.0.0-rc.0", only: [:dev, :test], runtime: false},
{:styler, "~> 1.0.0-rc.1", only: [:dev, :test], runtime: false},
]
end
```
Expand Down
6 changes: 5 additions & 1 deletion docs/styles.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,17 @@ This rewrite is applied when the collectable is a new map, keyword list, or maps

This is an improvement for the reader, who gets a more natural language expression: "make a new map from enum" vs "enumerate enum and collect its elements into a new map"

Note that all of the examples below also apply to pipes (`enum |> Enum.into(...)`)

| Before | After |
|--------|-------|
| `Enum.into(a, %{})` | `Map.new(enum)`|
| `Enum.into(enum, %{})` | `Map.new(enum)`|
| `Enum.into(enum, Map.new())` | `Map.new(enum)`|
| `Enum.into(enum, Keyword.new())` | `Keyword.new(enum)`|
| `Enum.into(enum, MapSet.new())` | `Keyword.new(enum)`|
| `Enum.into(enum, %{}, fn x -> {x, x} end)` | `Map.new(enum, fn x -> {x, x} end)`|
| `Enum.into(enum, [])` | `Enum.to_list(enum)` |
| `Enum.into(enum, [], mapper)` | `Enum.map(enum, mapper)`|

## Map/Keyword.merge w/ single key literal -> X.put

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-rc.0"
@version "1.0.0-rc.1"
@url "https://github.com/adobe/elixir-styler"

def project do
Expand Down

0 comments on commit f09321a

Please sign in to comment.