effector / eslint-plugin

Enforcing best practices for Effector
https://eslint.effector.dev
MIT License
91 stars 16 forks source link

Rule: `max-lines-per-unit` #129

Open Lonli-Lokli opened 2 years ago

Lonli-Lokli commented 2 years ago

Enforce a maximum number of lines of code in a unit

Some people consider large functions a code smell. Large fn or filter in sample can make it hard to follow what’s going on. This rule should help enforce that style. It should have separate configurations for all major units (sample, guard, effect) with appropriate default values per each

igorkamyshev commented 2 years ago

In my mind, it's better to enforce smth like maximum cyclomatic complexity per field.

e.g. there are plenty of lines of code 👇

sample({
  clock: [
    route.opened,
    route.updated
  ],
  source: $tier,
  filter: and(
    $premiumUser,
    $subscriptionActive
  ),
  target: showModal
})

but it is steal readble.