Skip to content

Commit 8b2bc0b

Browse files
committed
doc: add example
1 parent 494361d commit 8b2bc0b

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

docs/rules/prefer-string-raw.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,17 @@ const file = String.raw`C:\windows\style\path\to\file.js`;
2828
```js
2929
const regexp = new RegExp(String.raw`foo\.bar`);
3030
```
31+
32+
[`String.raw`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/raw) should not be used if the string does not contain any `\`.
33+
34+
## Fail
35+
36+
```js
37+
const noBackslash = String.raw`foobar`
38+
```
39+
40+
## Pass
41+
42+
```js
43+
const noBackslash = 'foobar'
44+
```

0 commit comments

Comments
 (0)