]> git.proxmox.com Git - pve-eslint.git/blob - eslint/docs/rules/no-multi-str.md
first commit
[pve-eslint.git] / eslint / docs / rules / no-multi-str.md
1 # Disallow Multiline Strings (no-multi-str)
2
3 It's possible to create multiline strings in JavaScript by using a slash before a newline, such as:
4
5 ```js
6 var x = "Line 1 \
7 Line 2";
8 ```
9
10 Some consider this to be a bad practice as it was an undocumented feature of JavaScript that was only formalized later.
11
12 ## Rule Details
13
14 This rule is aimed at preventing the use of multiline strings.
15
16 Examples of **incorrect** code for this rule:
17
18 ```js
19 /*eslint no-multi-str: "error"*/
20 var x = "Line 1 \
21 Line 2";
22 ```
23
24 Examples of **correct** code for this rule:
25
26 ```js
27 /*eslint no-multi-str: "error"*/
28
29 var x = "Line 1\n" +
30 "Line 2";
31 ```