Skip to content

Conversation

@Olovyannikov
Copy link

@Olovyannikov Olovyannikov commented Dec 9, 2025

Problem: implicit subscriptions when forgot remove unused subscriptions inside react components
e.g.:

const { setValue } = useUnit({ 
  value: $store, // not used, but create unnecessary re-render
  setValue: event 
})

Why is this important?

Implicit subscriptions can lead to:

  • Performance issues: unnecessary re-renders when unused stores update
  • Hard-to-debug behavior: component re-renders for unclear reasons
  • Memory leaks: subscriptions that are never cleaned up properly

Rule Details

This rule enforces that:

  • All properties passed in an object to useUnit must be destructured to prevent implicit subscriptions;
  • All elements passed in an array to useUnit must be destructured to prevent implicit subscriptions also.

@netlify
Copy link

netlify bot commented Dec 9, 2025

Deploy Preview for eslint-plugin ready!

Name Link
🔨 Latest commit 9accf5e
🔍 Latest deploy log https://app.netlify.com/projects/eslint-plugin/deploys/6937f4559c566800086f8d65
😎 Deploy Preview https://deploy-preview-175--eslint-plugin.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@Olovyannikov Olovyannikov force-pushed the new/use-unit-destructuring branch from 865e946 to d687cb3 Compare December 9, 2025 09:57
@Olovyannikov Olovyannikov force-pushed the new/use-unit-destructuring branch from ddd9966 to 9accf5e Compare December 9, 2025 10:05
@Olovyannikov Olovyannikov changed the title feat(rule): add new rule for destructured units feat(use-unit-desctricturing): add new rule for destructured units Dec 14, 2025
@Olovyannikov Olovyannikov changed the title feat(use-unit-desctricturing): add new rule for destructured units feat(use-unit-destructuring): add new rule for destructured units Dec 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant