Skip to content

Option for disabling character class and flag sorting in transformations #199

Open
@brettz9

Description

@brettz9

Hi,

While I expect this might not be trivial given that the sorting presumably helps in building ranges, it would be very useful if this resorting could be optionally disabled.

In the project, eslint-plugin-unicorn, regexp-tree is being used to otherwise very helpful effect in the rule regex-shorthand (as per sindresorhus/eslint-plugin-unicorn#453 ). This linting rule lints source files--files which are more likely than say distribution files--to call for preserving the original sorting order, whether for better readability or maintainability (e.g., [aAbBcC]) or for causing or necessitating additional modifications of regular expressions per the linting rule any time something might be manually added or changed in a character class to break the code point sorting pattern--especially given that users are not likely to always know or wish to spend time looking up code point values for the characters they are adding.

Similarly, the auto-sorting of flags forces source into enforcing a particular sequence of flags.

Thanks for your consideration!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions