chore(deps): update dependency styler to v1.10.0 - autoclosed#111
Closed
renovate[bot] wants to merge 1 commit intomainfrom
Closed
chore(deps): update dependency styler to v1.10.0 - autoclosed#111renovate[bot] wants to merge 1 commit intomainfrom
renovate[bot] wants to merge 1 commit intomainfrom
Conversation
26b3bf0 to
1310122
Compare
1310122 to
f17a16c
Compare
f17a16c to
ea99257
Compare
ea99257 to
85748c4
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR contains the following updates:
1.3.3→1.10.0Release Notes
adobe/elixir-styler (styler)
v1.10.0Compare Source
Improvements
Two new standard-library pipe optimizations
enum |> Enum.map(fun) |> Enum.intersperse(separator)=>Enum.map_intersperse(enum, separator, fun)enum |> Enum.sort() |> Enum.reverse()=>Enum.sort(enum, :desc)And Req (the http client library) pipe optimizations, as detailed below
Req pipe optimizations
Req is a popular HTTP Client. If you aren't using it, you can just ignore this whole section!
Reqs 1-arity "execute the request" functions (
delete get head patch post put request run) have a 2-arity version that takes a superset of the argumentsReq.new/1does as its first argument, and the typicaloptionskeyword list as its second argument. And so, many places developers are calling a 1-arity function can be replaced with a 2-arity function.More succinctly, these two statements are equivalent:
foo |> Req.new() |> Req.merge(bar) |> Req.post!()Req.post!(foo, bar)Styler now rewrites the former to the latter, since "less is more" or "code is a liability".
It also rewrites
|> Keyword.merge(bar) |> Req.foo()to|> Req.foo(bar). This changes the program's behaviour, sinceKeyword.mergewould overwrite existing values in all cases, whereasReq2-arity functions intelligently deep-merge values for some keys, like:headers.v1.9.1Compare Source
Fix
v1.9.0Compare Source
This was a weird one, but I found myself often writing
to_timeoutwith plural units and then having to go back and fixthe code to be singular units instead. Polling a few colleagues, it seemed I wasn't alone in that mistake. So for the first time,
Styler will correct code that would otherwise produce a runtime error, saving you from flow-breaking backtracking.
Improvements
to_timeoutimprovements:to_timeout(hours: 2)->to_timeout(hour: 2)(plurals are valid ast, but invalid arguments to this function)to_timeout(hours: 24 * 1, seconds: 60 * 4)->to_timeout(day: 1, minute: 4). this can introduce runtime bugs due to duplicate keys, as in the following scenario:to_timeout(minute: 60, hours: 3)->to_timeout(hour: 1, hour: 3)v1.8.0Compare Source
Improvements
Rewrite single-clause case statements to be assignments (h/t 🤖)
v1.7.0Compare Source
Surprising how fast numbers go up when you're following semver.
Two new features, one being a pipe optimization and the other a style-consistency-enforcer in
condstatements.Improvements
|> Enum.filter(fun) |> List.first([default])=>|> Enum.find([default], fun)(#242, h/t @janpieper)condIf the last clause's left-hand-side is a truthy atom, map literal, or tuple, rewrite it to be
trueThis also helps Styler identify 2-clause conds that can be rewritten to
if/elsemore readily, like the following:v1.6.0Compare Source
That's right, a feature release again so soon!
Improvements
This version of Styler adds many readability improvements around ExUnit
assertandrefute, specifically when working with 1. negations or 2. someEnumstdlib functions.Some of these rewrites are not semantically equivalent due to
refutepassing for bothnilandfalse.ExUnit assert/refute rewrites
Styler now inverts negated (
!, not) assert/refute (egassert !x=>refute x) statements, and further invertsrefutewith boolean comparison operators (refute x < y=>assert x >= y) because non-trivial refutes are harder to reason about [ citation needed ]. Asserting something is not nil is the same as just asserting that something, so that's gone too now.These changes are best summarized by the following table:
assert !xrefute xassert not xrefute xassert !!xassert xassert x != nilassert xassert x == nilassert is_nil(x)assert !is_nil(x)assert xassert x not in yrefute x in yrefute xrefute !xassert xrefute not xassert xrefute x != yassert x == yrefute x !== yassert x === yrefute x != nilassert x == nilrefute x not in yassert x in yrefute x < yassert x >= yrefute x <= yassert x > yrefute x > yassert x <= yrefute x >= yassert x < yassert Enum.member?(y, x)->assert x in yassert Enum.find(x, y)->assert Enum.any?(x, y)(nb. not semantically equivalent in theory, but equivalent in practice)assert Enum.any?(y, & &1 == x)->assert x in yassert Enum.any?(y, fn var -> var == x end)->assert x in yFixes
v1.5.1Compare Source
Fixes
v1.5.0Compare Source
Improvements
:minimum_supported_elixir_versionconfiguration to better support libraries using Styler (#231, h/t @maennchen)# styler:sortwill now sort keys for struct/map typespecs (#213, h/t @rojnwa)Fixes
v1.4.2Compare Source
Fixes
# styler:sort(#230, h/t @cschmatzler)v1.4.1Compare Source
Improvements
to_timeout/1rewrites to use the next largest unit in some simple instancesFixes
v1.4.0Compare Source
Read on for details.
Improvements
Alias Lifting
This release taught Styler to try just that little bit harder when doing alias lifting.
general improvements around conflict detection, lifting in more correct places and fewer incorrect places (#193, h/t @jsw800)
use knowledge of existing aliases to shorten invocations (#201, h/t me)
example:
becomes:
Struct Updates => Map Updates
1.19 deprecates struct update syntax in favor of map update syntax.
WARNING Double check your diffs to make sure your variable is pattern matching against the same struct if you want to harness 1.19's type checking features. Apologies to folks who hoped Styler would do this step for you <3 (#199, h/t @SteffenDE)
Ex1.17+
:timer.units(x)with the newto_timeout(unit: x)forhours|minutes|seconds(This style is only applied if you're on 1.17+)Fixes
pipes: handle pipifying when the first arg is itself a pipe:c(a |> b, d)=>a |> b() |> c(d)(#214, h/t @kybishop)pipes: handle pipifying nested functionsd(c(a |> b))=>a |> b |> c() |> d(#216, h/t @emkguts)with: fix a stabbywith, else: (_ -> :ok)being rewritten to a case (#219, h/t @iamhassangm)Configuration
📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR was generated by Mend Renovate. View the repository job log.