netlify/eslint-config-node

Discussing rule: max-lines-per-function

eduardoboucas opened this issue · 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?

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)?
danez commented

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

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

Sounds good! 🚀