Skip to content

Feature: Sort React Hook Dependency Arrays #178

Description

@stevensacks

Describe the rule

First off, amazing plugin. I just discovered it today. I've been using separate sorting plugins and now I can just use perfectionist!

React Hook dependency array order has no effect on functionality. In keeping with sorting everywhere else, I wrote my own ESLint plugin to sort them.

https://github.com/stevensacks/eslint-plugin-sort-react-dependency-arrays

It seems like this functionality would be a natural addition to your great library. Perhaps you'd consider adding it? Thanks!

Code example

Before:

useEffect(() => {
  // ... some code
}, [t, isSubmitting, success, error]);

After:

useEffect(() => {
  // ... some code
}, [error, isSubmitting, success, t]);

Additional comments

No response

Validations

  • Read the docs.
  • Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions