Skip to content

Rule Change: array-callback-return should support Stage 4 Array.prototype.toSorted` #16842

@sosukesuzuki

Description

@sosukesuzuki

What rule do you want to change?

array-callback-return

What change to do you want to make?

Generate more warnings

How do you think the change should be implemented?

A new default behavior

Example code

[1, 2, 3].toSorted(
  (a, b) {
    if (cond1) return -1
    if (cond2) return 1
  }
);

What does the rule currently do for this code?

Do nothing

What will the rule do after it's changed?

Warns as for Array.prototype.sort.

Participation

  • I am willing to submit a pull request to implement this change.

Additional comments

Change array by copy proposal reaches to Stage 4
ref: tc39/proposals@ad4df84

Metadata

Metadata

Assignees

No one assigned

    Labels

    acceptedThere is consensus among the team that this change meets the criteria for inclusionarchived due to ageThis issue has been archived; please open a new issue for any further discussionenhancementThis change enhances an existing feature of ESLintruleRelates to ESLint's core rules

    Type

    No type

    Projects

    Status

    Complete

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions