]> git.proxmox.com Git - pve-eslint.git/blame_incremental - eslint/docs/src/rules/no-multi-str.md
import 8.41.0 source
[pve-eslint.git] / eslint / docs / src / rules / no-multi-str.md
... / ...
CommitLineData
1---
2title: no-multi-str
3rule_type: suggestion
4---
5
6
7It's possible to create multiline strings in JavaScript by using a slash before a newline, such as:
8
9```js
10var x = "Line 1 \
11 Line 2";
12```
13
14Some consider this to be a bad practice as it was an undocumented feature of JavaScript that was only formalized later.
15
16## Rule Details
17
18This rule is aimed at preventing the use of multiline strings.
19
20Examples of **incorrect** code for this rule:
21
22::: incorrect
23
24```js
25/*eslint no-multi-str: "error"*/
26
27var x = "some very \
28long text";
29```
30
31:::
32
33Examples of **correct** code for this rule:
34
35::: correct
36
37```js
38/*eslint no-multi-str: "error"*/
39
40var x = "some very long text";
41
42var x = "some very " +
43 "long text";
44```
45
46:::