Skip to content

Bug: Missing dependency detection for nested destructuring defaults in sort-objects #619

@azat-io

Description

@azat-io

Describe the bug

The sort-objects rule misses dependencies when a default value uses an identifier declared deeper inside another destructuring branch. It treats the order as valid even though one property depends on another.

Code example

let {
  a = nested,
  b: { nested } = { nested: 'default' },
} = obj;

Expected: dependency error forcing b before a. Actual: passes with no error and no fix suggested.

ESLint version

v9.39.1

ESLint Plugin Perfectionist version

next

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

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions