Skip to content

Rules & Presets

This preset is recommended for most projects, so we suggest enabling it by default.

ts
import effector from "eslint-plugin-effector"

const config = [
  effector.flatConfigs.recommended, 
]
RuleDescription
enforce-effect-naming-conventionEnforce Fx as a suffix for any Effector Effect
enforce-store-naming-conventionEnforce $ as a prefix/postfix for any Effector Store
keep-options-orderEnforce options order for Effector methods
no-ambiguity-targetForbid ambiguous target in sample and guard
no-duplicate-onForbid duplicate .on calls on Stores
no-forwardPrefer sample over forward
no-getStateForbid .getState calls on Effector stores
no-guardPrefer sample over guard
no-unnecessary-combinationForbid unnecessary combinations in clock and source
no-unnecessary-duplicationForbid duplicate source and clock in sample and guard
no-useless-methodsForbid useless calls of sample and guard
no-watchRestrict usage of .watch on any Effector Unit

patronum preset

This preset is recommended for projects that use patronum.

ts
import effector from "eslint-plugin-effector"

const config = [
  effector.flatConfigs.patronum, 
]
RuleDescription
no-patronum-debugDisallow the use of patronum/debug

react preset

This preset is recommended for projects that use React with Effector.

ts
import effector from "eslint-plugin-effector"

const config = [
  effector.flatConfigs.react, 
]
RuleDescription
enforce-gate-naming-conventionEnforce a Gate is named capitalized like a React Component
mandatory-scope-bindingForbid Event and Effect usage without useUnit in React components
prefer-useUnitPrefer useUnit over deprecated useStore and useEvent hooks

scope preset

This preset is recommended for projects that use Fork API.

ts
import effector from "eslint-plugin-effector"

const config = [
  effector.flatConfigs.scope, 
]
RuleDescription
require-pickup-in-persistRequire every persist call of effector-storage to use pickup
strict-effect-handlersForbid mixing calls to both regular async functions and Effects in the same function

future preset

Effector is evolving! Future-proof your code with this preset, which enforces best practices for future releases of Effector.

ts
import effector from "eslint-plugin-effector"

const config = [
  effector.flatConfigs.future, 
]
RuleDescription
no-domain-unit-creatorsDisallow using Domain methods to create units

Other Rules

Some ESLint rules are yet to be included in any preset but can be enabled individually if they suit your project's needs.

RuleDescription
no-duplicate-clock-or-source-array-valuesForbid duplicate units in clock/source arrays

Last updated:

Released under the MIT License