Closed Janiczek closed 1 week ago
I guess it might be related to a rule where .x foo
is rewritten into foo.x
, which could be thought of as a simpler variant of the above.
If we had some RuleAstPred -> RuleAstPred
combinator way of making rules that work on fn calls also work on pipelined fn calls, then that simpler rule + that combinator would give you the rule I'm proposing above.
Similar to .x foo
I think this is pretty much just a style issue which is better suited to rules with fine control like SiriusStarr/elm-review-pipeline-styles.
For example, in some cases, it might just be more readable to not use the record access shortcut
generalizableListElement
|> .toGeneral
|> expressionParenthesize
|> ...
and I think simplify reporting such cases could be annoying for users.
Right. I feel like we often have this discussion and I keep forgetting :sweat_smile: Yeah, use SiriusStarr/elm-review-pipeline-styles instead, and if it doesn't support this, then open an issue there.
fair, thanks
What the rule should do: Replace things like
foo |> .x
withfoo.x
, except for when the foo is a function call or operator call (eg. a pipeline).What problems does it solve: Makes things simpler?
Example of things the rule would report:
Example of things the rule would not report:
Should this be part of the Simplify rule or should it be a new rule? Simplify
I am looking for: