Civet icon indicating copy to clipboard operation
Civet copied to clipboard

Fat pipe (`||>`) does not play nice with typescript-eslint v8

Open bbrk24 opened this issue 1 year ago • 2 comments

Evidence: bbrk24/Trilangle#142

error Expected an assignment or function call and instead saw an expression @typescript-eslint/no-unused-expressions

bbrk24 avatar Aug 06 '24 17:08 bbrk24

Hopefully this can be fixed upstream: https://github.com/eslint/eslint/issues/18758

edemaine avatar Aug 06 '24 18:08 edemaine

None of the pipelines that are triggering this end up being used as expressions -- the ones that are expressions, such as on the RHS of assignments, are fine. The erroring ones are all of the form

f()
  ||> .foo = 1
  ||> .bar = 2
  |> x.baz

where the pipeline is used as a statement and the last one is |> rather than ||>. Would it be reasonable to special-case pipeline statements and emit ; rather than ,? I believe that would circumvent this issue.

bbrk24 avatar Aug 19 '24 16:08 bbrk24

Would it be reasonable to special-case pipeline statements and emit ; rather than ,? I believe that would circumvent this issue.

Yes. Maybe we can use blockContainingStatement to detect this situation.

edemaine avatar Nov 23 '24 17:11 edemaine