Skip to content

ESlint rule: Prevent direct usage of localeCompare method #97859

@tskarhed

Description

@tskarhed

Why is this needed:

Using the localeCompare method on a string causes a performance issues. When sorting an unbound set of values, Intl.Collatorshould be used instead, as per MDN.

See #96862 for an example.

What would you like to be added:

An ESlint rule that warns about its usage. There may be valid use cases here, where you have a known (small) set of things to sort.

Who is this feature for?

Developers

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    🚀 Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions