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/. Replicates the autofix of the ESLint rule no-regex-spaces under its default options.

org.openrewrite.javascript.cleanup.NoRegexSpaces
mod run . --recipe=org.openrewrite.javascript.cleanup.NoRegexSpaces

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