Why is this an issue?

Using regular expression literals is recommended over using the RegExp constructor calls if the pattern is a literal. Regular expression literals are shorter, more readable, and do not need to be escaped like string literals.

new RegExp(/foo/);
new RegExp('bar');
new RegExp('baz', 'i');
new RegExp("\\d+");
new RegExp(`qux|quuz`);

Using the RegExp constructor is suitable when the pattern is computed dynamically, for example when it is provided by the user.

/foo/;
/bar/;
/baz/i;
/\d+/;
/qux|quuz/;
new RegExp(`Dear ${title},`);

Resources

Documentation