Disallow multiple spaces in regular expressions

Proprietary

Replaces runs of two or more consecutive spaces in regular expression literals and string-literal RegExp(...) patterns with a {n} quantifier, e.g. /foo bar/ becomes /foo {3}bar/. A RegExp(...) call is left unchanged where its pattern string holds an escape sequence, its flags are not a string literal, or the file declares a binding named RegExp, or sits inside a with statement, whose object may supply RegExp. Replicates the autofix of the ESLint rule no-regex-spaces under its default options.

io.moderne.javascript.cleanup.NoRegexSpaces
mod run . --recipe=io.moderne.javascript.cleanup.NoRegexSpaces

Install it once, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.