๐ Prefer using the String.raw tag to avoid escaping \.
๐ผ This rule is enabled in the following configs: โ
recommended, โ๏ธ unopinionated.
๐ง This rule is automatically fixable by the --fix CLI option.
String.raw can be used to avoid escaping \.
// โ
const file = "C:\\windows\\style\\path\\to\\file.js";
// โ
const file = String.raw`C:\windows\style\path\to\file.js`;// โ
const regexp = new RegExp('foo\\.bar');
// โ
const regexp = new RegExp(String.raw`foo\.bar`);// โ
const file = `C:\\windows\\temp\\myapp-${process.pid}.log`;
// โ
const file = String.raw`C:\windows\temp\myapp-${process.pid}.log`;