# regexp/sort-flags

require regex flags to be sorted

  • ⚙️ This rule is included in "plugin:regexp/recommended".
  • 🔧 The --fix option on the command line (opens new window) can automatically fix some of the problems reported by this rule.

# 📖 Rule Details

The flags of JavaScript regular expressions should be sorted alphabetically because the flags of the .flags property of RegExp objects are always sorted. Not sorting flags in regex literals misleads readers into thinking that the order may have some purpose which it doesn't.

Now loading...

# 🔧 Options


# ❤️ Compatibility

This rule was taken from eslint-plugin-clean-regex (opens new window).
This rule is compatible with clean-regex/sort-flags (opens new window) rule.

# 🚀 Version

This rule was introduced in eslint-plugin-regexp v0.9.0

# 🔍 Implementation

Last Updated: 6/25/2022, 12:32:38 PM