Skip to content

[$500] Create an ESLint rule to detect multiple uses of withOnyx #27463

@tgolen

Description

@tgolen

Problem

When withOnyx is used multiple times while composing components, it adds overhead to what Onyx has to keep track of and also prevents optimizations like batched render updates from working to their full potential.

Solution

Create a custom ESLint in https://github.com/Expensify/eslint-config-expensify/tree/main/eslint-plugin-expensify which detects when withOnyx() is used multiple times in the same file, and throws an error. The error should give instructions on the best practices which is something like:

Only use withOnyx() once. If there are dependent Onyx keys, they can all be handled in a single instance of withOnyx through the use of selectors.

That should also link to the Onyx readme, and I'm going to write a specific section in there about the best practice that we can link to.

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01f185d4f92edd4f6c
  • Upwork Job ID: 1702383017796775936
  • Last Price Increase: 2023-09-14
  • Automatic offers:
    • mollfpr | Reviewer | 26743007
    • studentofcoding | Contributor | 26743012

Metadata

Metadata

Labels

ExternalAdded to denote the issue can be worked on by a contributorNewFeatureSomething to build that is a new item.ReviewingHas a PR in reviewWeeklyKSv2

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions