regexNonStandardFlags
Reports non-standard regular expression flags.
✅ This rule is included in the tslogicalandlogicalStrictpresets.
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.
Examples
Section titled “Examples”Non-Standard Flag in Literal
Section titled “Non-Standard Flag in Literal”const pattern = /foo/l;const pattern = /foo/g;Non-Standard Flag in RegExp Constructor
Section titled “Non-Standard Flag in RegExp Constructor”const pattern = new RegExp("foo", "gxl");const pattern = new RegExp("foo", "gi");Options
Section titled “Options”This rule is not configurable.
When Not To Use It
Section titled “When Not To Use It”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.
Further Reading
Section titled “Further Reading”Equivalents in Other Linters
Section titled “Equivalents in Other Linters”- ESLint:
regexp/no-non-standard-flag
Made with ❤️🔥 in Boston by
Josh Goldberg and contributors.