Git Product home page Git Product logo

eslint-plugin-no-pipe's People

Contributors

arendjr avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

eslint-plugin-no-pipe's Issues

Consider an optional rule mode for this plugin?

I agree mostly with the spirit of this plugin. I dislike how |> has been designed (and intentionally limited). But I wonder if there aren't some small exceptions where |> might have a bit of merit?

I am curious if you would consider/accept adding an optional (off by default) mode/rule for this plugin, where it doesn't outright disallow |>, but specifically disallows:

  • any usage where the topic is bound to preceding simple literal, identifier, or property reference is bound as the topic
  • any usage where the topic (%, ^, ^^, or whatever the heck they pick) is used not inside an argument to a call expression

Such a mode would still error on all these absurdities:

42 |> [ 1, 2, % ]

"Hello world" |> console.log(%)

func |> %(42)

tagFn |> %`whatever`

cb |> pr.then(%)

obj.increment |> arr.map(%)

tagFn |> %`whatever`

But the mode would still allow some |> usage, like these:

fortyTwo() | [ 1, 2 ].concat(%)

"Hello world".toUpperCase() |> console.log(%)

(obj.increment ?? identity) |> arr.map(%)

The thinking behind allowing those is:

  1. functional composition is still a valid use-case
  2. a complex expression in an argument position of a function call can be rather unreadable, so there's potentially some slight benefit in separating the expression from the call-site with the |>.

What do you think?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.