noUselessStringRaw
Ce contenu n’est pas encore disponible dans votre langue.
Diagnostic Category: lint/nursery/noUselessStringRaw
Since: v1.9.4
Disallow unnecessary String.raw
function in template string literals without any escape sequence.
String.raw
is useless when contains a raw string without any escape-like sequence.
Examples
Section titled ExamplesInvalid
Section titled Invalidcode-block.js:1:1 lint/nursery/noUselessStringRaw ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
⚠ String.raw is useless when the raw string doesn’t contain any escape sequence.
> 1 │ String.rawa
;
│ ^^^^^^^^^^^^^
2 │
ℹ Remove the String.raw call beacause it’s useless here, String.raw can deal with string which contains escape sequence like \n, \t, \r, \\, \”, \’.
code-block.js:1:1 lint/nursery/noUselessStringRaw ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
⚠ String.raw is useless when the raw string doesn’t contain any escape sequence.
> 1 │ String.rawa ${v}
;
│ ^^^^^^^^^^^^^^^^^^
2 │
ℹ Remove the String.raw call beacause it’s useless here, String.raw can deal with string which contains escape sequence like \n, \t, \r, \\, \”, \‘.