eslint-config-node icon indicating copy to clipboard operation
eslint-config-node copied to clipboard

Discussing rule: max-lines-per-function

Open eduardoboucas opened this issue 4 years ago • 3 comments

While I agree with this rule in principle, I find myself fighting with it a lot. It's particularly problematic in files where we pass lots of parameters around (see https://github.com/netlify/build/blob/master/.eslintrc.js#L38-L46).

In this particular case, I like how explicit we are about the parameters we receive and pass to each function. By doing this, we can be conservative about what we expose to other functions downstream. But this makes the code more verbose, which conflicts with this rule.

Any thoughts?

eduardoboucas avatar Mar 12 '21 15:03 eduardoboucas

I agree.

What about either:

  • Increasing the number of max-lines-per-function?
  • Disabling max-lines-per-function and only relying on max-statements (which we already do)?

ehmicky avatar Mar 12 '21 15:03 ehmicky

I think especially that prettier has the hand over most of the styling, sometimes it is also out of our hands to "fix" this rule. like

const {a,b,c,d,f,g} = function();

which prettier might format to

const {
  a,
  b,
  c,
  d,
  f,
  g
} = function();

So I'm also for disabling this and rather rely on max-statements

danez avatar Jul 28 '22 13:07 danez

So I'm also for disabling this and rather rely on max-statements

Sounds good! 🚀

eduardoboucas avatar Jul 28 '22 13:07 eduardoboucas