Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
docs(prefer-single-binding): update docs
  • Loading branch information
Olovyannikov committed Dec 14, 2025
commit d009b75e057e3534e8ba4c41d8897850821ae4bb
4 changes: 1 addition & 3 deletions .idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 10 additions & 10 deletions docs/rules/prefer-single-binding.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# effector/no-multiple-use-unit
# effector/prefer-single-binding

[Related documentation](https://effector.dev/en/api/effector-react/useunit/)

Expand Down Expand Up @@ -61,7 +61,7 @@ The rule uses heuristics to determine whether a unit is a store or an event:
// .eslintrc.js
module.exports = {
rules: {
'effector/no-multiple-use-unit': ['warn', {
'effector/prefer-single-binding': ['warn', {
allowSeparateStoresAndEvents: true
}]
}
Expand Down Expand Up @@ -122,7 +122,7 @@ This is useful when you want to maintain clear logical separation between state
// .eslintrc.js
module.exports = {
rules: {
'effector/no-multiple-use-unit': ['warn', {
'effector/prefer-single-binding': ['warn', {
enforceStoresAndEventsSeparation: true
}]
}
Expand Down Expand Up @@ -180,7 +180,7 @@ You can use both options together to enforce a specific code style:
// .eslintrc.js
module.exports = {
rules: {
'effector/no-multiple-use-unit': ['warn', {
'effector/prefer-single-binding': ['warn', {
allowSeparateStoresAndEvents: true,
enforceStoresAndEventsSeparation: true
}]
Expand Down Expand Up @@ -518,7 +518,7 @@ const [handler, handler2] = useUnit([event1, event2]);
// .eslintrc.js
module.exports = {
rules: {
'effector/no-multiple-use-unit': 'warn'
'effector/prefer-single-binding': 'warn'
}
};
```
Expand All @@ -528,7 +528,7 @@ module.exports = {
// .eslintrc.js
module.exports = {
rules: {
'effector/no-multiple-use-unit': ['warn', {
'effector/prefer-single-binding': ['warn', {
allowSeparateStoresAndEvents: true
}]
}
Expand All @@ -540,7 +540,7 @@ module.exports = {
// .eslintrc.js
module.exports = {
rules: {
'effector/no-multiple-use-unit': ['warn', {
'effector/prefer-single-binding': ['warn', {
enforceStoresAndEventsSeparation: true
}]
}
Expand All @@ -552,7 +552,7 @@ module.exports = {
// .eslintrc.js
module.exports = {
rules: {
'effector/no-multiple-use-unit': ['warn', {
'effector/prefer-single-binding': ['warn', {
allowSeparateStoresAndEvents: true,
enforceStoresAndEventsSeparation: true
}]
Expand All @@ -565,7 +565,7 @@ module.exports = {
In rare cases, you might want to keep `useUnit` calls separate for specific reasons:

```tsx
/* eslint-disable effector/no-multiple-use-unit */
/* eslint-disable effector/prefer-single-binding */
const Component = () => {
const [userStore] = useUnit([$userStore]);

Expand All @@ -576,7 +576,7 @@ const Component = () => {

return null;
};
/* eslint-enable effector/no-multiple-use-unit */
/* eslint-enable effector/prefer-single-binding */
```

However, even in these cases, consider refactoring to use a single `useUnit` call (or enabling the appropriate options) for better performance and clarity.
Expand Down