knip
knip copied to clipboard
Escape all regex special characters in identifiers (fix #595)
Rather than just escaping $, escape all regex special characters in any identifiers to make sure the RegExp that is created is valid.
Used the list of characters to escape from the regex-escaping proposal
https://github.com/tc39/proposal-regex-escaping/blob/66d654ea6561ea064045c7ecf2da6870c892c9be/polyfill.js#L4