From f09321af0fe865876e415e4d33952156850bf1ef Mon Sep 17 00:00:00 2001 From: Matt Enlow Date: Wed, 12 Jun 2024 15:40:14 -0700 Subject: [PATCH] v1.0.0-rc.1 --- CHANGELOG.md | 12 ++++++++---- README.md | 16 ++++++++-------- docs/styles.md | 6 +++++- mix.exs | 2 +- 4 files changed, 22 insertions(+), 14 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 55f0f95..df3342d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 @@ -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 diff --git a/README.md b/README.md index a193297..8951847 100644 --- a/README.md +++ b/README.md @@ -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/) @@ -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 ``` diff --git a/docs/styles.md b/docs/styles.md index 7b3d4f1..fdbbb0c 100644 --- a/docs/styles.md +++ b/docs/styles.md @@ -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 diff --git a/mix.exs b/mix.exs index 81fb9b9..919d9f1 100644 --- a/mix.exs +++ b/mix.exs @@ -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