Skip to content

regexNonStandardFlags

Reports non-standard regular expression flags.

✅ This rule is included in the ts logical presets.

Reports non-standard regular expression flags. Some JavaScript environments support experimental flags not defined in the ECMAScript standard. These flags should be avoided in production code as they may not work in all environments.

The standard flags are: d, g, i, m, s, u, v, y.

const pattern = /foo/l;
const pattern = new RegExp("foo", "gxl");

This rule is not configurable.

If you are targeting a specific JavaScript environment that supports non-standard flags (such as certain embedded environments or experimental runtimes), you might want to disable this rule.

Made with ❤️‍🔥 in Boston by Josh Goldberg and contributors.