Closed jhpratt closed 4 years ago
The result of the pipeline isn't used, though?
Not entirely sure what you mean. The result is being pushed onto the array, which is later await
ed. This is no different than calling promises.push(sections _elem.requestUpdate())
, aside from the order of execution (which is irrelevant here). As far as I'm aware, this is a perfectly valid use under the proposal.
Here's another example, from React:
useEffect(() => {
getAllNodes()
|> R.filter(({meta: {type}}) => type === 'post', #)
|> R.sortWith([R.descend(R.path(['meta', 'date']))], #)
|> setState;
}, []);
I think the logic should be: if the end of a pipeline is a function call, then the value is used.
When we evaluated the pipeline operator for use on our team, we scrapped the idea because of this broken rule. It'd be awesome to see the PR above get finessed and accepted so we can start using it.
Thank you for the issue. Now that @babel/eslint-plugin has been released, we are making this repository read-only. If this is a change you would still like to advocate for, please reopen this in the babel/babel monorepo.
I have the following code which triggers the lint, but shouldn't.
I believe it's referring to the
promises.push
. It is used, as it's implicitly called with the pipeline operator.